[cairo] How to export image_surface pixel data?
Carl Worth
cworth at redhat.com
Tue Jan 17 15:55:31 PST 2006
On Tue, 17 Jan 2006 18:38:24 -0500, Owen Taylor wrote:
>
> Multiple return values are distinctly language binding unfriendly.
Thanks. The choice was feeling arbitrary, so it's good to get
guidance, (as well as a reminder about what led to separate get_width
and get_height originally).
> But even then you have to know the order. (C has the ordering problem
> too, actually..)
Oh, good point. I'll definitely take more type safety over less typing.
> From the GdkPixbuf experience I'd caution thinking ahead of time about
> what the above means for modifying data behind cairo's back. Are
> the cairo_surface_mark_dirty() and cairo_surface_flush() sufficient?
>
> Can you avoid copying the entire contents in:
>
> Create image surface
> Draw to it
> Draw to PS surface metafile
>
> ? For GdkPixbuf I've regretted not having a lock_data(), unlock_data()
> instead,
There is a good point to be made that mark_dirty only provides the
second half of a lock_data/unlock_data() pair. We could still add the
first half of that pair to provide more efficient behavior when used,
(and do the more pessimistic copying in your meta-file example
otherwise).
As it turns out, we're doing copying all over the place in the
meta-surface paths right now (waiting for an implementation of
copy-on-write for surfaces).
Any suggestions on what a "lock" function to pair with mark_dirty
might be named? As you mention below, get_data can't serve this
purpose since we also need locking for the create_from_data case.
> though that particular Rubicon may already have been crossed
> with the current ability to create an image surface from user data.
This is the train of thought that has led me not to feel hesitant
about adding get_data, (even on the eve of a major release).
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060117/6c41731e/attachment.pgp
More information about the cairo
mailing list