Re: Resize or extend a cairo surface
Andrea Canciani <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAN_5=BAMedg0TXP-=cREo8fkFmjDZNy0o2wwdQhD9JX=SbdykA@mail.gmail.com> |
On Thu, Dec 15, 2011 at 1:10 PM, Benjamin Warren <[email protected]> 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) Andrea > > > Thanks > > Benjamin > -- > cairo mailing list > [email protected] > http://lists.cairographics.org/mailman/listinfo/cairo -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo