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

Re: The Code of the Clip Mask Offset Problem




whoops! I got it backwards! make it:

x - actor->sprites[actor->seq].offsetx,
y - actor->sprites[actor->seq].offsety);

instead (I think...)


On Wed, 2 Feb 2000, it was written:

[ 
[ Well, if I understand you right, you want to have one xpm that contains
[ all the frames; e.g.:
[ 
[ _________________________________________________
[ |     |     |     |     |     |     |     |     |
[ |     |     |     |     |     |     |     |     |
[ |_____|_____|_____|_____|_____|_____|_____|_____|
[ 1     2     3     4     5     6     7     8     
[ 
[ am I understanding?
[ 
[ I don't know if this conserves any more resources than having separate
[ xpms, but it's a fascinating idea -- like a real of movie film.
[ 
[ Anyway, the step I think you're missing is *moving* the clip mask so that
[ the appropriate portion of the clip mask lines up with portion of the xpm
[ that you are drawing to the screen.
[ 
[ I think this line:
[ 
[   gdk_gc_set_clip_origin(gc, x, y);
[ 
[ should look more like:
[ 
[   gdk_gc_set_clip_origin (gc,
[                           actor->sprites[actor->seq].offsetx - x,
[                           actor->sprites[actor->seq].offsety - y);
[ 
[ Thus the clip mask follows the movement of the entire pixmap, even though
[ you're only drawing part of it...
[ 
[ hope that helps
[ 
[ - andy
[ 
[ 
[ 
[ 
[ On Wed, 2 Feb 2000, Arndt Schwaiger wrote:
[ 
[ [ 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 
[ [ 
[ [ 
[ [ -- 
[ [          To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
[ [                        "unsubscribe" as the Subject.
[ [ 
[ [ 	Mailing list concerns should be mailed to <listmaster@redhat.com>
[ [ 
[ 
[ 
[ -- 
[          To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
[                        "unsubscribe" as the Subject.
[ 
[ 	Mailing list concerns should be mailed to <listmaster@redhat.com>
[ 



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