Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drawViewHierarchyInRect is incomplete #1

Open
MattFoley opened this issue Jul 17, 2013 · 2 comments
Open

drawViewHierarchyInRect is incomplete #1

MattFoley opened this issue Jul 17, 2013 · 2 comments

Comments

@MattFoley
Copy link

Not to be a stickler, but drawViewHierarchyInRect cannot be copied with pre-iOS7 APIs, except for UIGetScreenImage(), which is now a private method.

The problems arise when you attempt to "renderInContext" a layer that is either backed by a CATiledLayer, or has a CATransform3D applied to. CATiledLayer's only render a single tile at a time through the pipeline, so renderInContext will give you a large image with only one square filled in. This can be mitigated by writing quite a bit of code to force each tile to render one at a time and then combine it into one final image. I can show you the example code for this if you are interested.

The bigger problem is 3D Transforms.

Due to the nature of the rendering pipeline, CATransform3D's will not be rendered in your context. You can try this out yourself with the iOS7 UIPickerView, which is now backed by 3D transformations. You'll find that the components are all in the wrong spaces, and any other 3D transform view will appear flat after rendering.

I spent a solid week attempting to make 3D transforms work with the current API's and failed. My closest attempt was done by iterating over the subview/layer/sublayer hierarchy, render each layer one at time, apply the 3D transform to the image rendered, and the combine with the previous images. I failed, due to inconsistencies in CoreImage's rendering of 3D transforms.

@RolandasRazma
Copy link
Owner

You right. Didn't thought about that... Thanks for info, will think what to do about it. The correct thing would be remove this call I guess.

@MattFoley
Copy link
Author

I was hoping you might have figured it out, and when I saw you hadn't, I just wanted to give you a heads up. Still, good work on this framework!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants