discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSView drawing in tool


From: Andreas Höschler
Subject: Re: NSView drawing in tool
Date: Tue, 23 Jun 2009 10:56:44 +0200

Hi Fred,

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.

No this last output was from my attempt on MacOSX and can be rather ignored since I have to get this to run on GNUstep. On GNUstep I get

Abort (core dumped)Tools/OSMMapServer: Uncaught exception WindowServerCommunication, reason: Unable to connect to X Server `'

Why do you insist on your code being a tool? Wouldn't an application be
a better fit?

No, definitely not. The tool is a service running in the background (managed by cron), responding to XML requests from client apps. In this special case the purpose of the service is to generate images (map tiles) (PNG or TIPP) according to a given XML request. The service has the logic to generate the images and the connection to the database holding the data, not the client apps.

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

I just realized that the tool works as expected on GNUstep when being logged in on the console of the machine supposed to run the service. However, in production this service is supposed to be started by cron with noone being logged in!? Any idea how to get around the

Abort (core dumped)Tools/OSMMapServer: Uncaught exception WindowServerCommunication, reason: Unable to connect to X Server `'

problem then?

Thanks a lot!

Regards,

    Andreas










reply via email to

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