The Code of the Clip Mask Offset Problem



Hi there,

some freaks asked me for my problem code....here it is:

I am creating one big animation pixmap and its mask with this:

sprite32_pixmap = gdk_pixmap_create_from_xpm_d (drawing_area_widget->window, 
         				        &sprite32_mask,
						NULL,
						(gchar **) sprite32_xpm);

sprite32_pixmap will be the big one and sprite32_mask its mask !
The image is 256 pixels width and 32 pixels high.
There are 8 animations steps ( each step has 32 X 32 pixels )

Now I want to do the animation routine like this:

void DrawActor(GdkPixmap *drawing_buffer, GtkWidget *drawing_area_widget,
typActor *actor)
{
  GdkGC *gc;
  gint  x, y;
  
  gc = drawing_area_widget->style->fg_gc[GTK_STATE_NORMAL];

  x = actor->posx;
  y = actor->posy;

  gdk_gc_set_clip_mask(gc, sprite32_mask);
  gdk_gc_set_clip_origin(gc, x, y);

  gdk_draw_pixmap(drawing_buffer, 
		  drawing_area_widget->style->fg_gc[GTK_STATE_NORMAL], 
		  sprite32_pixmap, 
		  actor->sprites[actor->seq].offsetx, 
		  actor->sprites[actor->seq].offsety, 
		  x, y, 
		  actor->width, 
		  actor->height);

  gdk_gc_set_clip_mask(gc, NULL);

  actor->seq++;
  
  if (actor->seq >= actor->nseq) { actor->seq = 0; } 

}

The actor struct handles all animation settings like position, width, height
and offsets on the pixmap.

The lines :
        ...actor->sprites[actor->seq].offsetx, 
           actor->sprites[actor->seq].offsety,...

I want to use to say which animation step is the current step (an offset in
the big picture) !

THE PROBLEM IS: Only the first animation step has the correct mask.
                All other steps are masked by the mask of the first
animation step (the first 32 X 32 pixels) !!!

I guess, that the offsets into source work only with the pixmap and not with
its mask !!
Is this right or am I a lamer ??? THIS SUCKS, because I dont want to use
many xpms for only one animation.
I have to do 100 or more animations and I want to use only one big animation
pixmap !!!

Has anyone any idea how I can handle this ??? Is this a bug or not ???
Please help me, because its my dissertation !!! Please !!

Many thanx and greetinx
Arndt 



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