objective c - Can't capture masks within view layer -


so i'm applying image mask uiview layer following code:

calayer *masklayer = [calayer layer]; uiimage *maskimage = self.image.image; masklayer.contents = (id)maskimage.cgimage; masklayer.frame = cgrectmake(0.0, 0.0,1235, 935); self.bgview.layer.mask = masklayer; 

everything fine , dandy, mask covers view content , works. however, trying take screenshot let user save image. i'm using following code:

uigraphicsbeginimagecontext(captureframe.size); [self.bgview.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *viewimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); uiimagewritetosavedphotosalbum(viewimage, nil, nil, nil); 

the frame fine, , saving photo library. problem mask applied layer not show in jpg. have tried nesting bgview uiview, , trying renderincontext: that, same thing. appears if mask not being applied in final jpg.

any ideas? thank you.

it's unfortunate, that's how works. documentation -[calayer renderincontext:] says:

... layers use 3d transforms not rendered, nor layers specify backgroundfilters, filters, compositingfilter, or mask values.

coreanimation intended on-screen, animated drawing; isn't general-purpose graphics framework. try using coregraphics instead -- isn't difficult, you'll have more control, , you'll higher-quality output.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -