Re: Advice: Which drawing API to use?
Re: Advice: Which drawing API to use?
- Subject: Re: Advice: Which drawing API to use?
- From: Graham Cox <email@hidden>
- Date: Wed, 24 Aug 2011 13:47:48 +1000
On 24/08/2011, at 1:36 PM, John Pannell wrote:
> 1. View is zoomable and looks good at all zoom levels.
> 2. Text looks good and is antialiased.
> 3. All elements support subtle transparency.
> 4. Animation (i.e. flow in pipes) is a bonus.
>
> My gut is to go with Core Animation: items 1, 3, and 4 are all straightforward, but I have encountered issues with text antialiasing of text layers with transparency. I know I can achieve all four items with Cocoa/Quartz, but it seems like more work than CA. My biggest concern is a lack of familiarity with zooming a view containing text and maintaining a quality appearance - I've not tried this in either API.
>
> I'd appreciate any discussion on these APIs, just to get me feeling confident enough one way or the other to get off the fence. I can't believe how long I've sat around waiting for mental clarity on this - starting to understand the whole architecture astronaut thing :-)
Hi John,
Zooming shouldn't be an issue - zooming works by setting a scale transform (indirectly) on the view and in general 'just works', but as I pointed out in another thread earlier today, I have a class that makes this really easy: http://apptree.net/gczoomview.htm
If you add layers or draw text in that view (actually a subclass of course), they will look correct. Well, I think that's true for e.g. CATextLayer, though I haven't tried it to be certain. Certainly drawing text directly in the view will antialias sharply no matter how the view is zoomed. I assume that CATextLayer will do the same as long as you ensure that it recreates its cached image by invalidating it appropriately.
I've used CALayers a bit lately and they're pretty cool, so it's definitely a consideration. If you want animation, it's the only game in town.
If you want to go the classic route of drawing with Quartz, then you could look at my DrawKit framework (same site as above), which gives you a complete architecture for drawing interactively. The public version is a little out of date right now, but still works pretty well. About the only thing it doesn't give you out of the box is the 'pipes' connecting each object, but I've always felt these wouldn't be hard to do.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden