| Trying to render image without a Display [message #429487] | 
Sun, 07 March 2004 16:51   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
I am using SWT to generate an image that I want to save to a JPG file. 
The generation and the save are working fine. It draws the image I want 
onto the screen, extracts the Image from the Display and saves it as a JPG. 
 
I want to run this program in background where there is no display device 
available. I tried using the printer but, while I got no errors, my JPG 
file was empty. 
 
Is there a way to use Display in this 'off-line' environment? 
 
Thanks 
Roger
 |  
 |  
  | 
 | 
 | 
| Re: Trying to render image without a Display [message #429988 is a reply to message #429759] | 
Tue, 09 March 2004 04:54   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Roger wrote: 
 
> "off-line" at the moment means running as a service under win2k, although 
> it might be a *nix daemon eventually. 
>  
> I tried drawing on an image, but I still need a device. The constructors 
> for Image all take Device as the first arg. I used the Printer instead of 
> the Display and got no errors but everything was blank. 
 
On a Unix machine you need access to a X11 display in order to use any  
AWT drawing operations, even when drawing on an image. It might be the  
same for SWT (I haven't tried that yet). XFree comes with Xvfb, a  
virtual framebuffer server, which can be used on a server machine to  
create a headless X11 display for AWT. 
 
For Windows services, there's an option "Allow service to interact with  
desktop" in the service properties. Did you try that? I suppose you  
could create a regular SWT Display if desktop interaction is enabled. 
 
--  
Stefan Zeiger    http://www.szeiger.de    http://www.novocode.com 
My SWT controls: http://www.novocode.com/swt
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.04961 seconds