Re: [ROOT] Root, Win32 drawing, funny Device Contexts, building root, etc.

From: Valeri Fine (fine@bnl.gov)
Date: Tue Aug 13 2002 - 18:59:13 MEST


Juts my 2 cents.

The current Win32 version of ROOT doesn't provide any conversion from Win32 pixmaps to
any common image file format.

However one can save the current TPad / TCanvas with various image formats using Qt layer

http://www.usatlas.bnl.gov/~fine/QtRoot/QtRoot.html#features
http://www.usatlas.bnl.gov/~fine/QtRoot/TQtSaveAsDialog.gif

It works with no difference and with no extra ROOT classes under Linux as well as 
under Windows.

The announced Qt layer doesn't rely on any particular ROOT version and can be adopted for
any even very old ROOT version.(Of course one is required to be able re-compile some 
base ROOT share libraries against of that new layer).

What about MS project I think the TrollTech provided "qmake" utility is a good example
how things can be handled. It is provided with the source code. It implies one can borrow 
some "ideas" from there with no problem

                         Hope this helps, Valeri

-----
Dr.Valeri Fine
STAR/US Atlas                                   E-mail: fine@bnl.gov
Brookhaven National Lab                    Phone: +1 631 344 7806
Upton, NY 11973-5000                       FAX:     +1 631 344 4206
USA



----- Original Message ----- 
From: "Rene Brun" <Rene.Brun@cern.ch>
To: "Gordon Watts" <gwatts@epe.phys.washington.edu>
Cc: <roottalk@pcroot.cern.ch>
Sent: Tuesday, August 13, 2002 6:07 AM
Subject: Re: [ROOT] Root, Win32 drawing, funny Device Contexts, building root, etc.


> Hi Gordon,
> 
> I just want to answer a few points of your mail (it seems that
> the Windows gurus are still on holidays!).
> 
> To install Root under Windows, we use the CYGWIN environment. See:
> 
>  http://root.cern.ch/root/Install.html
>  http://root.cern.ch/root/Cygwin.html
> 
> I mentionned many many times to this list: if somebody comes with
> an acceptable solution on Windows to automatically import AND export
> from/to CVS to/from VisualStudio project, we will take it.
> 
> Concerning your question about gif images in batch, I agree that
> going to Postscript is really a slow process.
> Fons and Reiner Rolfs are currently introducing a new set of
> image processing classes in Root (most of it already in CVS).
> These classes (see TImage) include conversion functions,
> including from canvas to (png, gif, jpg,etc).
> In the current CVS version, you can look at the short tutorial pad2png.C
> This example currently does not work in batch, but it will work in batch
> in the near future.
> This solution will be more general and much faster than the Postscript
> solution.
> I suppose that Fons and Reiner will post more information once the feature
> is working.
> 
> Rene Brun
> 
> On Sun, 4 Aug 2002, Gordon Watts wrote:
> 
> > Hi,
> > 
> >   I've a few very quick questions. I really like the idea behind Carrot,
> > the apache component that allows you to just place a root file in the
> > web server. I've been thinking about how to implement it in my spare
> > time in Windows. During a recent plane flight I tackled what I thought
> > would be the simplest part: getting root to draw a histogram, capturing
> > that drawing, and rendering it as a gif/jpeg that I could then feed to
> > the web.
> > 
> >  
> > 
> >   Summary of questions: help understanding how root draws in the win32
> > build, status of the gdk win32 port, how to build(static libs?)/debug
> > root from source.
> > 
> >  
> > 
> >   My first attempt was simply to run root in batch mode, generate a
> > postscript file, and then render it with ghostview. Works, but is
> > horribly slow.
> > 
> >  
> > 
> >   My second idea was to just screen scrape, basically. Have root draw
> > onto the screen, find out where it drew it, and then scrape the data
> > off. Andy Hass, who did ActiveRoot, basically uses this technique. This
> > works just fine interactively. The problem is you don't want windows
> > flashing up on your web server machine. Potentially, this is solved by
> > having the component run as a Windows Service, giving it its own
> > security ID, and thus its own private desktop. Alas, that doesn't seem
> > to work either.
> > 
> >  
> > 
> >   So I set out figuring out why and trying to get it to work. Basically,
> > I suspect that the default screen Device Context (DC) for a service is
> > not good enough for drawing in some way (too small, mono, etc.). To test
> > this out, I did the following (slimy) things...
> > 
> >  
> > 
> >   First create a blank canvas. Get the TWin32CanvasImp object from the
> > new canvas, and extract the size of the screen. Create a full color
> > bitmap of the correct size, then assign it to the fObjectDC member
> > variable of the canvas implementation object (slim warning: I had to
> > make fObjectDC a public instance variable to do this). Then do a
> > hist->Draw() and a canvas->Update(). Lo, in interactive mode, it works
> > just fine. Though the window frame pops up, you never see the histogram
> > drawn, however, the gif/jpeg file written out by the code contains the
> > histogram's image!
> > 
> >  
> > 
> >   When it is run as a service, however, this does not work. I tried a
> > few things. For example, I colored the whole bitmap red before I let
> > root get a hold of it. In interactive mode it is completely overwritten
> > with the correct image of the histo, when running as a service, nothing
> > at all is done to it. So it is almost as if either the drawing functions
> > weren't getting called, or there is something wrong with the pens,
> > brushes, etc., that are used to draw and nothing gets changed in the bit
> > map.
> > 
> >  
> > 
> >   I started trying to delve down into source code at this point (I was
> > looking at version 3.03.07). I discovered the gdk version, and tried
> > that (3.03.06) - wave of the future, so if I could be an early adopter,
> > that would be great, however, the interactive version crashed as soon as
> > I did a "TCanvas c1;" statement, so I gave up on that. That left me with
> > trying to understand how the graphics calls are actually made. I can't.
> > I could use some help here: How, exactly, are the draw functions in W32
> > called? If there is a roottalk mailing already, I'd love to read it
> > (couldn't find it in my many searches of the mailing list). Also,
> > someone who knows the internals of this code may well know what the
> > likely points of failure are.
> > 
> >  
> > 
> >   On a final note, at one point I decided the best way to track this
> > down was with the debugger. However, I was unable to build root. I
> > followed the instructions, but since I'm using VC 7... I got stuck on
> > building libCint.dll (how can you turn off sharable libraries and build
> > static ones? I didn't see a switch in the configure script) - undefined
> > symbols: _TI3?Avlength_error@std@@ for example. It is probably something
> > dumb, but I wasn't able to track it down in the short time I spent
> > exploring this avenue. BTW, once built, is it easy to run a debugger on
> > root?
> > 
> >  
> > 
> >   Any help would be appreciated. And I'm more than happy to
> > show/share/post/etc. code if anyone wants to see it. Many thanks.
> > 
> >  
> > 
> >             Cheers,
> > 
> >                         Gordon.
> > 
> >  
> > 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:04 MET