Re: [gtk-list] GtkDrawingArea question



Hi Sergei

I have the following piece of code that works for me:
(You need a #include "gdkprivate.h" somewhere in the file. Also it draws
on a pixmap, which may not be what you want. If you want it to draw
directly on your drawing area, use your drawing area widget in the calls
to PARAMPL, instead of the pixmap.)

    pixmap = gdk_pixmap_new(widget->window,
                          gwidth,
                          gheight,
                          -1);
    sprintf(geometry,"%dx%d",gwidth,
                           gheight);
    parampl ("XDRAWABLE_DISPLAY", ((GdkWindowPrivate*)pixmap)->xdisplay);
    parampl ("XDRAWABLE_DRAWABLE1",&(((GdkWindowPrivate*)pixmap)->xwindow));
    parampl ("XDRAWABLE_DRAWABLE2",&(((GdkWindowPrivate*)pixmap)->xwindow));
    parampl ("BITMAPSIZE", geometry);

    pl_handle = newpl ("Xdrawable", NULL, NULL, stderr);

    selectpl (pl_handle);
    openpl ();
    fspace (0.0, 0.0, width/height, 1.0);
    erase ();      /* erase Plotter's graphics display, aka draw it*/

Conrad

*-----------------------------------------*                                  
| Conrad Steenberg                        |                                  
| Caltech, Mail Code 220-47               |                                  
| Pasadena, CA, 91125                     |                                  
| e-mail: conrad@srl.caltech.edu          |                                  
| Tel: (626) 395-2964 Fax: (626) 449-8676 |                                  
*-----------------------------------------*                                  



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]