Re: [ROOT] gVirtualX->PutImage and TCanvas

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue May 04 2004 - 09:17:21 MEST


Hi Thomas,

You will find below a short example illustrating the TASImage class.
You can change teh filling of the buffer at your will.

Rene Brun

void test()
{
    gSystem->Load("libASImage");
    TCanvas *c=new TCanvas;
    double buf[100*100];
    for (int j=0; j<100*100; j++)
        buf[j]=j;

    TASImage *i = new TASImage("image",buf,100, 100);
    i->Draw();
}



Thomas Bretz wrote:
> 
> 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.
> 
>   --------------------------------------------------------------------------------
>                  Name: MImage2.cc
>    MImage2.cc    Type: unspecified type (APPLICATION/octet-stream)
>              Encoding: BASE64
> 
>                 Name: MImage2.h
>    MImage2.h    Type: unspecified type (APPLICATION/octet-stream)
>             Encoding: BASE64
> 
>   --------------------------------------------------------------------------------
> 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();
> }



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