I'm writing an alternative widget library for AwesomeWM. In this project, I would like to give the user some functions for manipulating nodes, but some operations are easier to optimize than others.
For example, if someone scales an element down, then maybe the element has to be redrawn, and I'll have to mark the dirty areas for redraw on the parent, so not much I can optimize.
But if translate an element in the layout, especially an element on which something very expensive was drawn, for example a trigonometric math function that I used to graph a bunch of points on the surface, then it would be much nicer to store the surface somewhere, tell cairo to use that when redrawing, and mark the dirty areas for redraw on the parent.
My question is: can I cache a surface and make cairo use it later instead of redrawing it every time?
(Example code would be much appreciated. I'm new to cairo.)