CAShaperLayer -renderInContext not working?

I can create UIImage from the Core Animation level using the following code:

- (UIImage*)contentsImage;
{
   UIGraphicsBeginImageContext([self bounds].size);
   [self renderInContext:UIGraphicsGetCurrentContext()];
   UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
   UIGraphicsEndImageContext();

   return image;
}

This code is in my derived CALayer class. The problem I am facing is that I have two CAShapeLayers that are child levels of my layer that are not displayed as a result of the resulting image. If I add standard CALayers as children, they will receive a fine. Apple docs say:

Displays the recipient and its sublayers in the specified context.

It also says that it is available with iPhone OS 2.0. Wondering if something is missing or I need to file a radar.

Any ideas that could prevent a CAShapeLayers child from getting into the image?

Thanks.

+3
3

CALayer renderInContext . CAShapeLayer path , :

.

, renderInContext CAShapeLayer . .

+4

, , CALayer renderInContext, :

**Important**: The Mac OS X v10.5 implementation of this method does not
support the entire Core Animation composition model. QCCompositionLayer, 
CAOpenGLLayer, and QTMovieLayer layers are not rendered. Additionally,
layers that use 3D transforms are not rendered, nor are layers that specify 
backgroundFilters, filters, compositingFilter, or a mask values. 
Future versions of Mac OS X may add support for rendering these layers
and properties.

, UIView drawRect . UIView, subviews, subviews, drawRect ( , , drawRect, , subview). , drawRect , .

, , , renderInContext CALayer drawInContext? , . . , , , .

0

I gave him a radar. I see no reason in the documents that it should not work. I will answer here if / when Apple responds to the radar.

0
source

Source: https://habr.com/ru/post/1715252/


All Articles