[cairo] Goocanvas: absolute-position animation and "update"
confusion
Carl Worth
cworth at cworth.org
Sat Dec 2 08:44:40 PST 2006
On Thu, 30 Nov 2006 14:43:00 +0000, Damon Chaplin wrote:
> I just committed some changes so you can avoid all the boilerplate code.
> demo/demo-item.c is a lot simpler now.
Thanks, that does look a lot better now. It's still enough
boilerplate, (mostly the gobject inheritance stuff), that I'll
still probably try to share one class for all my program's widgets,
but that should be just fine.
Meanwhile, here are a couple of snags I ran into:
1. I'd like to be able to animate an item to an absolute position,
rather than a relative position. Would you be interested in having
two variants for that? [Separate, interesting things to do would
be to animate along a path, and to animate with something other
than linear timing along it.]
2. Since I have to compute a relative offset to use the current
animate functions I have to be able to query the item's current
position. Unfortunately, in demo-item.c there appear to be two
copies of the position and size, (an "x,y,width,height" in DemoItem
and a position/size that the canvas itself manipulates with things
like animate). Having two copies makes things harder since I have
to carefully keep them in synch. Is there a good reason to have
these two copies?
3. As far as keeping the two copies of position/size in synch, I
haven't succeeded at doing that yet. What are the correct semantics
of the "update" function? In demo-item I see it copying a position
from demo_item->x,y to its parent objects simple->bounds.x1,y1.
This seems to be necessary on the "update" to get the constructed
"x,y" value to replace a stale (0,0) in simple-bounds. However,
after doing any animation, subsequent calls to "update" still now
have stale data in demo_item->x,y and the correct position in
simple->bounds. Am I just confused? What's the best way out of this
mess?
Oh, and finally, I accidentally rotated an item during an animation
one time and I think I saw it shrink and grow on the way, (at least
the way I wrote the paint function). It looked like maybe the canvas
was keeping the size of the bounds unchanged and the rotated drawing
was shrinking to always fit within those bounds. Maybe this was my
bug---I didn't look closely since I wasn't actually trying to rotate
anything anyway.
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20061202/54dafd15/attachment-0001.pgp
More information about the cairo
mailing list