• 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: Drawing faster with NSImage???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing faster with NSImage???


  • Subject: Re: Drawing faster with NSImage???
  • From: Joshua Orr <email@hidden>
  • Date: Mon, 17 Dec 2001 14:23:11 -0700

On Monday, December 17, 2001, at 01:40 PM, Nat! wrote:

On Montag, Dezember 17, 2001, at 08:41 Uhr, Joshua D. Orr wrote:

I have a app that does a lot of drawing. I have been thinking if
I draw to
an NSImage and then when they scroll around, the just scroll around the
NSImage. When they change something I could recalculate the
NSImage. I am
trying to find the best way to do this, does anyone have any
suggestions?

You could make your drawing code a subclass of NSImageRep (not
NSBitmapImageRep I suppose) and do your drawing there. The NSImage
that owns that imageRep will automatically cache the drawing for
you. You may need to recache the NSImage (throw away the cache),
when something changed.

Cheers
Nat!
-----------------------------------------------------
Some people drink deep from the fountains of life, and
some just gargle. -- DLR
_______________________________________________
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.



Right now I use a subclass of NSView to draw everything using NSBezierPath's. Would this type of drawing work with NSImageRep and NSImage? I also need to know where the user clicks in the NSView in the window. Would NSImageRep user actions like that? I was originally thinking I could somehow draw into a NSImage when something changed, and then draw the NSImage into the NSView until I needed to redraw it. Another question I just thought of: Could I just re-draw portions of the NSImage, so I don't have to redraw the entire image when only something small changed?

The ultimate thing I want to do is just somehow cache my drawing so that when the user scrolls around the NSView, it does nto have to keep redrawing all the lines, etc. with NSBezierPath's. I have looked all over the docs, and it looks like doing it with an NSImage would be the way to go, but I am now sure. Any suggestions would be helpful! If an NSImage is the way to go, could someone just briefly tell me what would the best way to go about would be?

Thanks in advance!


  • Follow-Ups:
    • Re: Drawing faster with NSImage???
      • From: Andre Lipinski <email@hidden>
References: 
 >Re: Drawing faster with NSImage??? (From: Nat! <email@hidden>)

  • Prev by Date: Re: PB/IB things that have stopped working
  • Next by Date: Desktop fusion
  • Previous by thread: Re: Drawing faster with NSImage???
  • Next by thread: Re: Drawing faster with NSImage???
  • Index(es):
    • Date
    • Thread