discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSView drawing in tool


From: Fred Kiefer
Subject: Re: NSView drawing in tool
Date: Tue, 23 Jun 2009 09:30:37 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Andreas Höschler wrote:
> Hi all,
> 
>> I have a tool (service) that is supposed to generate PNG images using
>> NSView drawRect and
>>
>>       NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
>> initWithFocusedViewRect:[mapView bounds]];
>>
>> When running this tool and calling the above method (NSView, NSImage
>> stuff,...) I get
>>
>> GSFontInfo.m:71  Assertion failed in GSFontEnumerator(class), method
>> sharedEnumerator.  Called with fontEnumeratorClass unset. The shared
>> NSApplication instance must be created before methods that need the
>> backend may be called.
>>
>> OK, I modified my main.m to call
>>
>>       [NSApplication sharedApplication];
>>
>> before starting the event loop with [[NSRunLoop currentRunLoop] run],
>> but this gives me
>>
>>     /opt/GNUstep/Local/Tools/OSMMapServer: Uncaught exception
>> WindowServerCommunication, reason: Unable to connect to X Server `'
>>
>> What am i missing?
> 
> I tried to run my  OSMMapServer. There I get
> 
> 2009-06-22 23:58:50.268 OSMMapServer[3122] *** Assertion failure in
> -[MapView lockFocus], AppKit.subproj/NSView.m:2343
> lockFocus sent to a view whose window is deferred and does not yet have
> a corresponding platform window
> 
> It seems I am on the wrong track with my approach!? Is there any example
> of a GNUstep tool that generates PNGs or TIFFs from a NSView after
> drawing NSBezierPaths?
> How is this done correctly? Hints are greatly appreciated!
> 

Was this the result of running your code on MacOSX? You didn't say so,
but the error message clearly isn't from GNUstep.

Why do you insist on your code being a tool? Wouldn't an application be
a better fit?
On MacOSX you could try to work with an NSImage instead of an NSView.
You can just draw on that instead of drawing to the view. On GNUstep
this is currently not fully supported. Any help to improve that would be
highly appreciated

Fred




reply via email to

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