GDK....



Has Gdk's GC mask stuff been tested throroughly?

is there ANYTHING wrong with the code below - i have checked that the
mask is correct because the EXACT smae mask if used as a shape mask for
the window is perfect - but as a GC clip mask it sometimes works,
sometimes does not (sometimes it is the correct mask, sometimes a
completely blank mask, sometimes a completely opaque mask).

   gc=gdk_gc_new(p);
   gdk_imlib_render(im,w,h);
   pp=gdk_imlib_move_image(im);
   mm=gdk_imlib_move_mask(im);
   if (mm)
     {
        gdk_gc_set_clip_mask(gc,mm);
        gdk_gc_set_clip_origin(gc,x,y);
     }
   gdk_window_copy_area(p,gc,x,y,pp,0,0,w,h);
   gdk_imlib_free_pixmap(pp);
   gdk_gc_destroy(gc);

the above code is flakey, but the below code works perfectly:

   gdk_window_get_size(p,&w,&h);
   if ((w<=0)||(h<=0)) return;
   gdk_imlib_render(im,w,h);
   pp=gdk_imlib_move_image(im);
   mm=gdk_imlib_move_mask(im);
   gdk_window_set_back_pixmap(p,pp,0);
   if (mm) gdk_window_shape_combine_mask(p,mm,0,0);
   gdk_window_clear(p);
   gdk_imlib_free_pixmap(pp);

I have checked the  w,h and pp and mm pixmap and mask variables and they
are all correct - as expected. Has anyone got a finger to point at my
stupid mistake? I have run out of fingers - I chopped them off.


-- 
--------------- Codito, ergo sum - "I code, therefore I am" --------------------
raster@rasterman.com       /\___ /\ ___/||\___ ____/|/\___  raster@redhat.com
Carsten Haitzler           | _ //__\\ __||_ __\\ ___|| _ /  Red Hat Advanced
218/21 Conner Drive        || // __ \\_ \ | |   \ _/_|| /   Development Labs
Chapel Hill NC 27514 USA   ||\\\/  \//__/ |_|   /___/||\\   919 547 0012 ext 282
+1 (919) 929 9443, 801 4392   For pure Enlightenmenthttp://www.rasterman.com/ 



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