uigraphicscontext - draw CGImageRef (not UIImage) into image context -


here's how draw uiimage in context:

uigraphicsbeginimagecontextwithoptions(size, no, 0.0f); [someuiimage drawinrect:cgrectmake(...)]; [someotheruiimage drawinrect:cgrectmake(...)]; [someotheruiimage drawinrect:cgrectmake(...)]; uiimage *yourresult = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); 

no problem. however, have cgimageref built somehow.

cgimageref happyimageref = cgimagecreatewithimageinrect(blah blah); 

i want draw in context.

uigraphicsbeginimagecontextwithoptions(size, no, 0.0f); [ happyimageref .. somehowdrawinrect:cgrectmake(...)]; uiimage *yourresult = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); 

how do that?

to clear, can convert uiimage

uiimage *wasteful = [uiimage imagewithcgimage:happyimageref]; 

but seems incredibly inefficient. how it?

i'm sure i'm confused or missing simple, thanks.

use cgcontextdrawimage

uigraphicsbeginimagecontextwithoptions(size, no, 0.0f); cgcontextdrawimage(uigraphicsgetcurrentcontext(),cgrectmake(...), happyimageref); uiimage *yourresult = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -