[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
drawing to NSImage off display
From: |
Scott Christley |
Subject: |
drawing to NSImage off display |
Date: |
Fri, 8 May 2009 18:22:29 -0700 |
Hello,
Some code which use to work is no longer working and I'm not sure why.
I use some worker threads to do computation, then they draw into their
own personal NSImage objects, which are then passed over to the main
GUI thread to be displayed. It seems that the drawing into the
NSImage is not working properly. The method for each worker thread
looks somewhat like this:
- doWork
{
// do some stuff
[image lockFocus];
[[NSColor greenColor] set];
NSRectFill(aRect);
// do some more drawing
[image unlockFocus];
}
Is there any reason why drawing into NSImage, either off display or in
worker threads, should not work?
I verified that nothing is wrong with the rest of my code, because I
can change that -doWork method to just load an image from a file, like
this, and the image displays just fine:
image = [[NSImage alloc] initWithContentsOfFile: file];
On a secondary note, I tried saving the image to a file, after I -
unlockFocus, but it produces a corrupt file.
[[image TIFFRepresentation] writeToFile: file atomically: NO];
I'm using GNUstep from SVN, on Debian with the art backend.
thanks
Scott
- drawing to NSImage off display,
Scott Christley <=