[cairo] Translate the content of a painted surface
mmassonnet at gmail.com
Wed Jun 9 11:53:30 PDT 2010
I'm currently doing a GTK+ widget, and it is the first time I draw
some dynamic content. So I imagined some possibilities but the problem
is I don't know enough about Cairo and I will have to play a lot more.
I imagined the following scenario:
- Keep a CairoImageSurface in memory
- Destroy/Repaint it entirely only when needed (requisition changed...)
- Translate the existing content to the left and update only a small part of it
So far, I am able to draw what I want, but can't get along with the
"translate the existing content" . Now I have some questions:
- I draw on the GdkWindow "context" retrieved through
gdk_cairo_create(), do I have to always invalidate the window in order
to update the content? Or can I use the existing content and translate
- If the previous question is negative, I have been trying to
translate the content of a CairoImageSurface without success, is this
possible at least? Or does it also have to be whipped out?
Otherwise I still have some tricks in mind in order to achieve this.
By example, by using two surfaces, an old one and a new one. I paint
the old one on the new but shifted/"translated", update the small
part, and keep a reference from the new on the old one, and so forth.
Thanks for your attention.
More information about the cairo