Re: transparent window



I think I figure out what is wrong:

For the drawing Pixmap, because the depth of the pixmap may not be 1, so that,
if you use
    gdk_draw_pixmap (tarea->mask, tarea->bitmap_gc, src, xsrc, ysrc, xdest, ydest,
width, height);
in the function
   gtk_transparency_draw_pixmap(...).
Because the bitmap_gc only supports depth 1, and the src, which is the pixmap may
have depth more than 1;
if this happened, then it will cause problem.

To fix this problem, only need to simply
Change :
    gdk_draw_pixmap (tarea->mask, tarea->bitmap_gc, src, xsrc, ysrc, xdest, ydest,
width, height);
in the gtk_transparency_draw_pixmap(...)
To:
    gdk_draw_rectangle( tarea->mask, tarea->bitmap_gc, true, xdest, ydest, width,
height );

I tryed this and it works perfect.

Any way, your basic idea about the Transparency is absolutely great!
Thank you very much!

Jiang


Paul Barton-Davis wrote:

> In message <393575A9.F47A6D8D@echostar.com>you write:
> >I create a GtkTransparency by using this new widget.
> >However, It is always wrong when I use gtk_transparency_draw_pixmap(...),
> >it always shows the following error message:
> >
> >    Gdk-ERROR **: BadMatch (invalid parameter attributes)
> >    serial 386 error_code 8 request_code 62 minor_code 0
> >
> >And I found it seems because of the call
> >    gdk_draw_pixmap (tarea->mask, tarea->bitmap_gc, src, xsrc, ysrc, xdest, yd
> >est, width, height);
> >in the function
> >    gtk_transparency_draw_pixmap(...).
> >
> >But I cannot figure out what is wrong,  I wonder whether you got any idea?
> >The test program what I make is as the followings:
>
> Try specifying a null GC. The BadMatch sounds to me as though you're
> using a GC with one depth in a context that requires a different one.
>
> If I get time, I'll try out the test program you sent.
>
> You should also know that your program is missing an important pair of
> calls. The model for GtkTransparency is based on the use of a
> transparent "overhead projector" sheet:
>
>           wipe it clean
>           draw on it
>           project it onto the wall (display)
>
> So, any actual use of the drawing routines should almost always be
> surrounded by
>
>            gtk_transparency_wipe (GTK_TRANSPARENCY(widget));
>            ...
>            gtk_transparency_project (GTK_TRANSPARENCY(widget));
>
> There are exceptions to this, but this typical usage. Sorry there is
> no documentation.
>
> --p
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-list





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