Re: The Code of the Clip Mask Offset Problem




Arndt Schwaiger <arsc0001@stud.uni-sb.de> writes:

> Hi Owen,
> 
> thanx for your mail, but I know that this is the problem.
> I dont know how to code the same offset for my mask.
> There is no "gdk_set_clip_mask_offset" .
> How can I do this job, this is my problem.
> I think, its no good, that the gdk_library uses not the same offset to the mask.

There is definitely a "gdk_set_clip_mask_offset" - it's called
gdk_gc_set_clip_origin() and you are already calling it.
You just need to add in your additional offsets.

In:

  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);

Change

  gdk_gc_set_clip_origin(gc, x, y);

to:

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

Hope this helps,
                                        Owen

> >Well, I guess the problem with your code can be expressed by saying
> >that the clip mask origin applies to the destination not the
> >source. So as you draw different portions of the source onto the same
> >portion of destination, you need to offset the clip mask origin
> >appropriately. (Generally by the negative of the xsrc/ysrc you
> >are using as offsets into your source image.)
> >
> >You might want to try drawing the situation on a piece of
> >paper.



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