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

Gustavo Carneiro gjcarneiro at gmail.com
Mon Dec 4 09:32:47 PST 2006


On 12/4/06, Carl Worth <cworth at cworth.org> 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.)
>
> > (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.


  I have to agree I often have found goo_canvas_item_translate() a pretty
useless method (at least so far), and so I end up doing something like:

  def _move_to(self, x, y):
        self.x = x
        self.y = y
        M = cairo.Matrix()
        M.translate(self.x, self.y)
        self.set_transform(M)

  Hope it helps.

-- 
Gustavo J. A. M. Carneiro
"The universe is always one step beyond logic."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/cairo/attachments/20061204/82cc317f/attachment.html


More information about the cairo mailing list