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

Re: gdk_imlib images with transparency: solved



Hello again,

well, it was quite obvious why it did not work: the mask was not applied
After a quick look into the gtk sources (gtkpixmap.c) and its expose function
the answer was there.
Now i do 

static GtkPixmap *p;
/* buffer, gc, gdk_imlib and other init stuff omitted */

void init() {
  GdkPixmap *s;
  GdkBitmap *b;
  if (gdk_imlib_load_file_to_pixmap("transparent.png", &s, &b))
    {
      p = gtk_pixmap_new(s, b);
      gdk_imlib_free_pixmap(s);
    }
}

void draw() {
  if (GTK_PIXMAP(p)->mask) {
    gdk_gc_set_clip_mask(gc, GTK_PIXMAP(p)->mask);
    gdk_gc_set_clip_origin(gc, x, y);
  }
  gdk_draw_pixmap(buffer, gc, GTK_PIXMAP(p)->pixmap, 0, 0, x, y, -1, -1);
  gdk_gc_set_clip_mask(gc, NULL);
}

and it works perfectly.
http://www.azzit.de/squaroid/board.jpg   :-)

> Post the small section(s) of code where you load the image and then draw
> to a pixmap and then draw the pixmap to the screen.

Thanx,
Lukas

-- 
Jenkinson's Law:
	It won't work.



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