• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: / bar graphics /
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: / bar graphics /
      • From: Jim Witte <email@hidden>
References: 
 >/ bar graphics / (From: Luis E! <email@hidden>)

  • Prev by Date: Re: Sleeping and waking NSThread
  • Next by Date: CFStream and Cocoa stream
  • Previous by thread: / bar graphics /
  • Next by thread: Re: / bar graphics /
  • Index(es):
    • Date
    • Thread