[cairo] Re: Goocanvas: absolute-position animation and "update" confusion

Damon Chaplin damon at karuna.uklinux.net
Tue Dec 5 04:37:31 PST 2006


On Mon, 2006-12-04 at 08:35 -0800, Carl Worth wrote: 
> On Mon, 04 Dec 2006 13:01:13 +0000, Damon Chaplin wrote:
> > If you were using pieces on a chess board, you'd use each piece's
> > transform to position it within the board, then
> > goo_canvas_item_animate() would do what you want.
> 
> OK. So maybe it would make sense to update demo-item.c to position
> itself with the matrix instead. (I was just using the implementation
> of the demo as documentation so far and I found the non-matrix
> positioning in demo-item.c and the use of goo_canvas_item_animate
> elsewhere, and got confused when the didn't work together.)

Yes, it is a bit confusing. Though I don't really think items should
change their own coordinate space. If you have the item itself and
higher-level/application code both changing the item's transformation
matrix it could get even more confusing. 

Maybe better documentation would solve this. It isn't very difficult
once you understand how it works.


> > (The current documentation is slightly wrong, though, so I'll fix that -
> > the arguments passed in are used for the final transformation matrix,
> > not as offsets from the current one.)
> 
> Wait, which function is documented incorrectly? Is that animate or
> translate? That sounds like the "relative vs. absolute" problems I ran
> into.

goo_canvas_item_animate() is wrong at present. It suggests the x & y
values are offsets, but they are currently used as absolute values.

Though if we switch to interpolating the translation/scale/rotation
separately, to get better animation, we might have to use relative
values instead. Unless someone knows a way to calculate the current
translation/scale/rotation from a transformation matrix.

Damon




More information about the cairo mailing list