[ROOT] CreatePictureFromFile/CopyArea

From: Thomas Bretz (tbretz@astro.uni-wuerzburg.de)
Date: Fri Jun 07 2002 - 12:00:47 MEST


Hi,

what's wrong with the macro below? CreatePictureFromFile already
fails...
Reading the same file into the TGPicturePool works, but that's nothing
which will help (but tells us, that the file is ok)

I'm using root 3.02/07. It did somthing similar with 2.25 (I read the
file by myself and used CreatePictureFromData instead) and this worked.
In 3.00 and 3.01 I got some massages about a 'Bad Window' or similar,
now it simply doesn't do anything and CreatePictureFromData return with
kTRUE.

Thomas.

void test()
{
    TGMainFrame *main=new TGMainFrame(gClient->GetRoot(), 200, 200);
    TGFrame *frame=new TGFrame(gClient->GetRoot(), 150, 150);

    main->AddFrame(frame);
    frame->Move(10, 10);

    main->MapSubwindows();
    main->MapWindow();

    Pixmap_t fPixmap=kNone;
    Pixmap_t mask = kNone;
    PictureAttributes_t attr;
    memset(&attr, 0, sizeof(attr));

    if (!gVirtualX->CreatePictureFromFile(frame->GetId(), "~/Mars/marslogo.xpm",
                                          fPixmap, mask, attr))
        return;

    cout << "created." << endl;

    GContext_t fDefGC = gVirtualX->CreateGC(frame->GetId(), 0); // GetBckgndGC().GetGC(); //
    gVirtualX->CopyArea(fPixmap, frame->GetId(), fDefGC,
                        0, 0, 100, 100, 10, 10);
}



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