Re: / bar graphics /
Re: / bar graphics /
- Subject: Re: / bar graphics /
- From: Yann Bizeul <email@hidden>
- Date: Mon, 21 Jun 2004 19:32:31 +0200
>
I need to do a bar graphic based on an array of data.
>
I saw that you can draw things in a NSView, but you
>
have to specify the drawing in only one method:
>
drawRect:.
True
>
I changed to OpenGL but it seems it's the same: you
>
can only draw things inside the drawRect: method.
Ouch, switching to openGL just to not draw in a single place ?
>
I need to have this array as an input parameter and I
>
don't know what to do... any ideas? Is there a
>
different/easier way to draw graphics than the ones
>
named above?
What is the problem drawing in the drawRect: method ? Are you afraid of
the overhead of drawing the whole thing each time the view needs to be
displayed ? If yes, I think there is no problem with this, drawings
rectangles and colors, even with shadows is a very simple and quick
work that can handle easily hundreds of rects.
I think the best thing you could do is subclassing an NSView, and add
methods to pass your array as argument, then methodes called into
drawRect: will read this array and draw items according to data.
With Panther, you can even check the rect needed to redraw, and
redisplay only needed parts.
--
Yann Bizeul - yann at tynsoe.org
http://projects.tynsoe.org/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.