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.
uigraphicsbeginimagecontextwithoptions(size, no, 0.0f); cgcontextdrawimage(uigraphicsgetcurrentcontext(),cgrectmake(...), happyimageref); uiimage *yourresult = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
Comments
Post a Comment