discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawing to NSImage off display


From: Fred Kiefer
Subject: Re: drawing to NSImage off display
Date: Sat, 09 May 2009 16:38:21 +0200

Hi Scott,

when you are saying that it worked before, at what time was that? A few days 
ago, weeks, months? As far as I know, drawing in a separate thread should have 
produced an error up until two months ago.

Is your code working when executed in the main thread? If not we should try to 
get it working there first.

Is there already anything in that image you are drawing on? 

It would be helpful if you could send full working code to reproduce the 
problem, then sonebody could look at your code directly and also test whether 
it works on his machine. That somebody couldn't be me at the moment, as I am 
travelling, but as soon as I am back I would test your code.

Fred

PS: There was a similar bug report some time ago, but this is fixd and closed 
now. Perhaps you could have a look at that.

-------- Original-Nachricht --------
> Datum: Fri, 08 May 2009 18:45:00 -0700
> Von: Scott Christley <schristley@mac.com>
> An: gnustep <discuss-gnustep@gnu.org>
> Betreff: drawing to NSImage off display

> 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
> 
> 
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnustep

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss 
für nur 17,95 Euro/mtl.!* 
http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a




reply via email to

[Prev in Thread] Current Thread [Next in Thread]