On 26/04/2013, at 12:07 AM, James Montgomerie <ja...@montgomerie.net> wrote:

> If you have quite simple requirements, a CAShapeLayer might work.  


I found that CAShapeLayer is not very good when it is scaled up significantly, 
e.g. in a view that gets zoomed by more than 4x or so. It depends on its size - 
because the path is always rendered in screen space, the size of the tile 
needed can quickly exceed the limits of OpenGL.

This is a severe limitation if you plan to use CAShapeLayer for a vector 
composition that you plan to make zoomable.

> 
> You'll need to create a CGPath to give it to render. On iOS, UIBezierPath can 
> help with creating the CGPath if you don't want to drop to the CGPath API (no 
> such luck on Mac - NSBezierPath can't be trivially converted to a CGPath 
> AFAIK).  The C-based CGPath API is not bad though.

Converting a NSBezierPath to a CGPath is easy - just iterate over the elements 
and call the appropriate CGPath methods. Going the other way is harder, as it 
requires that you set up a callback for CGPathApply.

Using the Core Graphics API directly (maybe embedded in classes of your own 
device) is likely to be the most portable and fastest method for rendering 
vector graphics.


--Graham




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to