RE: [ROOT] gVirtualX->PutImage and TCanvas

From: Valeri Fine (fine@bnl.gov)
Date: Tue May 04 2004 - 02:49:55 MEST


Hello Thomas,

Did I understand correctly that you tried to use 
http://root.cern.ch/root/htmldoc/TVirtualX.html#TVirtualX:PutImage
method to paint TCanvas ?

I am afraid this method can not be used to paint TCanvas / TPad
To do that you have to provide the "Drawable_t id" for TPad. 
As soon as I know there is no method to do that.
One can get the "Drawable_t" for the parent widget of TCanvas. 
However it is not the TCanvas itself.

With TCanvas the best thing you can do, you can draw the parent widget
using PutImage method, but then ROOT will paint the real and empty
TCanvas/TPad over.

To do what you want you should regard using the TGFrame object rather
TCanvas/TPad. Then you can apply PutImage method to paint it.
(see: 
http://root.cern.ch/root/htmldoc/src/TGColorPick.cxx.html#TGColorPick:Do
Redraw 
for example)

Another way to manage thing is to provide your own implementation of
TImage abstract ROOT class using the existent TASImage implementation as
a pattern

With the mixed Qt/ROOT env you can just apply the class 
http://doc.trolltech.com/3.3/qmovie.html to paint the TCanvas /TPad as
well.

Mean time I made a quick test with Qt/Root/OpenGL rendering on my 900
Mhz laptop to find I can achieve 100 OpenGL frame/second rendering rate
rotating the OpenGL image generated by "shapes.C" macro. 
I made very this test because of it does provide the built
frame-per-second counter, see: 
http://artis.imag.fr/Members/Gilles.Debunne/QGLViewer/shortcuts.html 


Hope this helps,

----
Best regards
                   Valeri


> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch] On
> Behalf Of Thomas Bretz
> Sent: Monday, May 03, 2004 4:36 PM
> To: Valeriy Onuchin
> Cc: roottalk@pcroot.cern.ch
> Subject: Re: [ROOT] gVirtualX->PutImage and TCanvas
> 
> Hi,
> sorry, I don't know what happened. I hope this time they are complete.
> Thomas.
> On
> Mon, 3 May 2004, Valeriy Onuchin wrote:
> > Hi Thomas,
> > two files in attachment are empty.
> >
> > Regards. Valeriy
> >
> > ----- Original Message -----
> > From: "Thomas Bretz" <Thomas_Bretz@ph.tum.de>
> > To: <roottalk@pcroot.cern.ch>
> > Sent: Monday, May 03, 2004 6:45 PM
> > Subject: [ROOT] gVirtualX->PutImage and TCanvas
> >
> >
> > > Hi,
> > >
> > > with the (very simple) attached class I try to display a gray
scaled
> > > bitmap in a canvas. It doesn't work. Can somebody explain me, what
I'm
> > > doing wrong?
> > >
> > > (I'm developing this class, because I need a really fast access to
the
> > > screen - 25fps - which I think I won't get with the big overgead
of
> > > TASImage)
> > >
> > > Thanks in advance,
> > > Thomas.
> > >
> > >
> >
> >
> >
------------------------------------------------------------------------
------
> --
> >
> >
> > > void test()
> > > {
> > >     TCanvas *c=new TCanvas;
> > >
> > >     MImage2 *i = new MImage2(100, 100);
> > >
> > >     byte buf[100*100];
> > >
> > >     for (int j=0; j<100*100; j++)
> > >         buf[j]=j;
> > >
> > >     i->DrawImg(buf);
> > >     i->Draw();
> > > }
> > >
> >
> -----
> Würden Sie Windows 95 die Kontrolle eines AKWs überlassen?
> Hiroshima '45...! Tschernobyl '86...!! Windows 95...!!!
> Unix ist benutzerfreundlich - es ist nur etwas wählerisch..." (Walter
Misar)
> Was sagt ein arbeitsloser Physiker zu einem Physiker mit Arbeit?
>  - "Eine Currywurst mit Pommes bitte!"



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET