• 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: NSImage lockFocus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage lockFocus


  • Subject: Re: NSImage lockFocus
  • From: Ondra Cada <email@hidden>
  • Date: Sun, 23 Sep 2001 13:41:06 +0200

johnpstr,

>>>>>> email@hidden (j) wrote at Sat, 22 Sep 2001 21:51:48 -0400:
j> Now I've taken a look at all the drawing related docs I could find, and
j> it seems to me that one can draw into an NSView even when outside of the
j> drawRect: function as long as one uses the 'lockFocus' call. I also
j> noticed that NSImage has this very same call. So logic would follow that
j> if I locked focus on an NSImage, I could draw into it (provided its size
j> was set correctly beforehand.)
j>
j> Needless to say, it doesn't seem to work..

I guess you need to call [[myView window] display] as well. The drawing is
normally cached and performed only when application is idle.

j> I have even gone so far as to
j> try to lockFocusOnRepresentation (after adding an appropriate
j> representation with the proper number of colours and size,) but that
j> fails miserably as apparently NSImageReps do not respond to the -init
j> call!

I'm not sure I quite understand this. Anyway, if you want to make and
initialize a new image rep, use the appropriate service of the concrete
class, like imageRepWithData:, or perhaps
initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:
(for BitmapImageRep), or other...
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc


References: 
 >NSImage lockFocus (From: email@hidden)

  • Prev by Date: Re: Naive Pop-Up Button Example
  • Next by Date: Re: Multidimensiaon Arrays in Cocoa
  • Previous by thread: NSImage lockFocus
  • Next by thread: Re: NSImage lockFocus
  • Index(es):
    • Date
    • Thread