[cairo] drawing on and reusing an off-screen image surface
Kalle Vahlman
kalle.vahlman at gmail.com
Mon Dec 3 00:50:02 PST 2007
2007/12/3, Peter Groves <pdgroves at gmail.com>:
> #tell cairo to use the cached rasterized image as the "paint"
> cairo_set_source(gtk_widget_ctx, _background_pattern)
You don't need to create the intermediate pattern yourself if you use
set_source_surface(), btw.
> #(**)paint the whole gtk_widget_ctx canvas with the image.
> cairo_paint(gtk_widget_ctx)
Just in case you are not doing it, before this, you'll want to set the
clip mask to the exposed area in order to not update the whole area
every time. Simply calling gdk_cairo_rectangle() and cairo_clip()
should do it.
> #do any additional drawings that occur each re-paint on top
> my_draw_the_foreground_method(gtk_widget_ctx)
> }
>
>
> Regarding (**), this is the step that most confuses me: when the call
> to cairo_paint is made, will _background_pattern be re-rendered (from
> vector to raster form), or is the rasterized form created exactly once
> when cairo_pattern_create_for_surface(...) is called in startup()?
It depends on the surface type: Image surfaces are rasterized when
they are drawn, ie. no vectorized version exists after the call to
stroke(), fill() or similar calls. SVG surfaces however do have a
vectorized version, but I'm not sure exactly how the surface to
surface paints go with those... someone more into the details of that
surface type should comment on that.
--
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
More information about the cairo
mailing list