RolandasRazma / RRiOS7Backport

libRRiOS7Backport is an effort to backport parts of iOS7 to iOS6/iOS5
MIT License
14 stars 6 forks source link

drawViewHierarchyInRect is incomplete #1

Open MattFoley opened 11 years ago

MattFoley commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

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!