[cairo] [cairo-commit] export meta-surface
Behdad Esfahbod
behdad at behdad.org
Thu Aug 13 12:02:11 PDT 2009
On 08/12/2009 07:51 PM, Carl Worth wrote:
> On Fri, Jul 03, 2009 at 10:34:50AM -0700, Chris Wilson wrote:
>> New commits:
>> commit 6003ab77e1ebefadb97338de0e7da4a76d973b1a
>> Author: Chris Wilson<chris at chris-wilson.co.uk>
>> Date: Fri Jul 3 18:26:50 2009 +0100
>>
>> Export meta-surface
>>
>> The meta-surface is a vital tool to record a trace of drawing commands
>> in-memory. As such it is used throughout cairo.
>>
>> The value of such a surface is immediately obvious and should be
>> applicable for many applications. The first such case is by
>> cairo-test-trace which wants to record the entire graph of drawing commands
>> that affect a surface in the event of a failure.
>
> Thanks for doing this. It's been desired for a very long time, of
> course.
[...]
> That issue of width and height was really the only thing that kept me
> from exporting meta surfaces almost from the beginning.
My only reason for not exporting it before is that of font options. For
meta-surface extents to be accurate and/or to avoid surprises when replaying,
one must set the font options when drawing to the meta surface to that of the
final surface. One can say this is the user's duty, however, at least it
should be documented in bold letters. If we have a create_similar way to
create meta surfaces, that fixes this issue as create_similar copies the font
options. Still, this issue limits how one can use the meta surface in that a
meta surface will be most useful when people want to draw to something,
measure the extents, create a final surface and draw to it again. Now, for
that kind of usage using the meta-surface, one still needs to 1) create a
surface similar to the final surface first just to get the font options out of
it, and 2) what are they supposed to use as meta-surface extents? Infinity
extents needed.
We may also want to add a note that meta-surfaces may consume huge amounts of
memory since they keep a snapshot of all images, etc.
Another useful method to export from the meta surface is the to-path()
operation that we use in the user-font.
That's all from my side.
Cheers,
behdad
More information about the cairo
mailing list