[cairo] How to move a path

Daniel Amelang daniel.amelang at gmail.com
Wed Feb 28 17:35:14 PST 2007


On 2/22/07, fred <fred at vaynom.net> wrote:
> Hi everybody!
>
> I have a lot of shape on a cairo surface, and I would like to move these
> shape with the mouse. I don't know the shape, because I have to suppose
> that they have been drawn by a user.
> Currently, each time that a user starts a new shape, I create a new
> ImageSurface, and save the Path of the draw.
> After, I recover the ImageSurface, and add it to the main context.
>
> When a user want to move a shape, I don't know what could I do in order
> to manage it.
>
> I don't think that I use the good method, and I really need help!

Hi Fred,

What you're describing (having the user "move" a shape") requires
statefulness. Cairo (by design) doesn't provide that for you. You'll
need to look into a canvas library, or roll your own (by maintaining
data structures with shape information and more). You might want to
look into GooCanvas to start. Hmm...I don't see a website for it right
away, but the mailing list is here:

https://lists.sourceforge.net/lists/listinfo/goocanvas-devel

The author (Damon Chaplin) is on this list, so maybe he can take it from here :)

Dan


More information about the cairo mailing list