Re: pixbuf<->cairo_surface_t conversion



On Thu, Sep 2, 2010 at 3:52 PM, Havoc Pennington <hp pobox com> wrote:
> Hi,
>
> I thought of another approach to this problem. Don't expose the pixbuf
> format at all; keep it as-is. However, add:
>
>  gdk_pixbuf_get_cairo_surface()
>  gdk_pixbuf_new_from_cairo_surface(cairo_surface_t *surface);
>
> Now, keep the cairo surface internally, strong-ref'd by the pixbuf.
> The pixbuf would have pixels == NULL. If someone does
> gdk_pixbuf_get_pixels(), then lazily create the old pixbuf format and
> keep that copy of the pixels around. Otherwise, never create the old
> format.

Some variations of this theme (make GdkPixbuf a wrapper around a cairo
surface) have been discussed. It is certainly attractive in terms of
the amount of new api, and in terms of keeping the GdkPixbuf-based gtk
apis intact.

One thing I wonder about though: one of the big reasons to keep
GdkPixbuf around is the image loaders. But in this scheme, every
pixbuf thats loaded from a file would end up with an old-style
internal representation, right ?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]