Hi folks,

first a kind of disclaimer: Addressing different graphic technologies (Quartz 
2D, OpenGL ES, Cocoa classes) I was quite uncertain in list I should write this 
posting: feel free to forward me to anyone you'll find appropriate ... I posted 
the same question to the Developer Forums, but they seem to be quite deserted.

I decided to re-think some basic drawing concepts of my app during this holiday 
season, and I'd appreciated your input to cover all bases. Therefore I'm not 
asking for specific code snippets or such, but for some advice, maybe pointing 
me to the right direction:

In my app I draw several thousand lines on a canvas. These lines should look 
like three-dimensional objects, although the context lacks any z-coordinate: 
all lines are just draw above each other. Currently I fake the effect by 
drawing three NSBezierPaths for each line: A large black one to create the 
outline, a smaller one with the actual color, and a white one providing a 
highlight. Here's a link to a screenshot in the Developer Forum's thread, just 
to give you the idea:

<https://devforums.apple.com/thread/81174>

With over 10,000 lines, each one resulting in three paths (and color changes), 
you can image the performance. When I posted a similar question a year ago, I 
optimized the app to redraw visible lines only and checked the performance 
using Quartz 2D classes (not significantly faster), and although I hadn't 
received any user complaints about the performance, I'd like to improve it.

Basically I came up this three alternatives:

(1.) Use an NSGradient to achieve the 3D effect: as lines are drawn at 
different angles I'm not sure how to rotate the gradient, maybe perform a 
rotation transformation of the whole coordinate space?
(2.) Use images to "stamp" the lines: each image needs to be repeated depending 
on the line's length, and rotated according to the line's direction (see above)
(3.) Go for OpenGL ES: I never programmed OpenGL before, and I'm kind of afraid 
what it'll require to make the rest of the app work (hit testing, printing, 
drag'n'drop, ...)

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?

Really appreciate your feedback!

Merry Xmas to all of you, 
Matthias_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to