[XForms] Using Xform in background without display
Jens Thoms Toerring
jt at toerring.de
Thu Mar 13 14:02:21 EDT 2008
To subscribers of the xforms list
Hi Didier,
On Thu, Mar 13, 2008 at 05:07:01PM +0100, Didier Verkindt wrote:
> My application uses Xform for GUI and ROOT for making plots.
> And in some cases, I do not want to interact with the application,
> I would like to run it in background, producing a ROOT plot that
> is written as a jpg file (thanks to ROOT's class TImageDump)
> TImageDump *imgdump = new TImageDump(jpgFileName);
> gDDCanvas->Paint();
> TImage *img = imgdump->GetImage();
> img->SetImageQuality(img->kImgFast);
> img->SetImageCompression(60);
> imgdump->Close();
> imgdump->Delete();
None of these functions seem to be from XForms but ROOT (at
least as far as I can tell), so if you don't use any XForms
functions you don't have to invoke fl_initialize() at all.
I think if this is the case it's rather simple. Do something
like this (sorry, it's in C and not C++, but I am not that
good at C++ and it probably will be nearly the same):
int
main( int argc,
char * argv[ ] )
{
int i;
for ( i = 1; i < argc; i++ )
if ( ! strcmp( argv[ i ], "-nodisplay" ) )
break;
if ( i == argc ) /* "-nodisplay" not found */
fl_initialize( &argc, argv, "Whatever", 0, 0 );
That way you avoid calling fl_initialize() when the program
is invoked with the "-nodisplay" option. And that should be
fine as long as you don't call any XForms functions after-
wards (you will probably find out if you do so anyway since
then XForms would complain loudly;-)
Best regards, Jens
--
\ Jens Thoms Toerring ________ jt at toerring.de
\_______________________________ http://toerring.de
_______________________________________________
To unsubscribe, send any message to
xforms-leave at bob.usuhs.mil or see:
http://cweblog.usuhs.mil/mailman/listinfo/xforms
List Archive: http://bob.usuhs.mil/pipermail/xforms and
http://bob.usuhs.mil/mailserv/list-archives/
Development: http://savannah.nongnu.org/files/?group=xforms
More information about the Xforms
mailing list