Re: How to make 2D lines look 3D
Re: How to make 2D lines look 3D
- Subject: Re: How to make 2D lines look 3D
- From: Matthias Arndt <email@hidden>
- Date: Fri, 31 Dec 2010 16:29:53 +0100
Hi all!
Am 23.12.2010 um 15:52 schrieb Matthias Arndt:
> I think the only way to decide for the best way is a test app, performing several thousand drawings in each method, but did I miss any important approach? Do you know one of the mentioned methods not being worth the effort? Any suppestions, ideas, additions?
For those of you interested in the results, here's what I did: With a sample app drawing random lines I measured different approaches:
- Cocoa NSBezierPath to draw each line three times (with an outline in black and the highlight in white): Original situation
- Same concept as before, but using CoreGraphics: 10% performance improvement
- Construct an outline path in CoreGraphics and fill it with a gradient: 10% - 80% better performance
- Construct an outline path in CoreGraphics and draw an inner shadow: 10 times worse performance!
- Draw 2D lines in OpenGL
I dropped the OpenGL approach due to too many drawbacks, e. g. missing round line caps, resolution-dependence of line width, ... The shadow approach looks best, but is out of question due to its bad performance.
At the end I tweaked the gradient approach a bit, what costs me nearly all performance improvements (depending on the number of lines), but is looking ways better than the old method (if you're interested in the result, here's a link to a screenshot in the Developer Forum's thread: <https://devforums.apple.com/thread/81174>).
Happy New Year, Matthias_______________________________________________
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