[cairo] Resize or extend a cairo surface
ranma42 at gmail.com
Thu Dec 15 13:29:35 PST 2011
On Thu, Dec 15, 2011 at 1:10 PM, Benjamin Warren
<benjamin.a.warren at gmail.com> wrote:
> The situation is that my python script is rendering svg images to a
> cairo.Context, which is attached to a cairo.ImageSurface with set
> dimensions. When the script 'runs out of space' to draw the svg images
> I want it to effectively resize/extend the surface dimensions to make
> space for more svg images.
> (I cannot preallocate the space because I don't know the number or
> size of the images in advance.)
> From what I have read I understand that you cannot actually resize a
> cairo surface, the solution seems to be to copy the old surface to a
> new larger surface, is this correct?
> What is the best way to go about this?
I think that I would do it like this:
- draw everything to an unbound recording surface
- get its extents and create an image surface of an appropriate size
- paint the recording surface on the image surface
(recording surfaces are available since cairo 1.10)
> cairo mailing list
> cairo at cairographics.org
More information about the cairo