[cairo] New surface: cairo_combined_surface_t
Behdad Esfahbod
behdad at cs.toronto.edu
Thu Jun 1 13:45:49 PDT 2006
On Thu, 1 Jun 2006, Vladimir Vukicevic wrote:
> On 5/31/06, Kouhei Sutou <kou at cozmixng.org> wrote:
> > To solve those problems, I suggeste that cairo provides a surface can combine
> > some surfaces and show those surfaces as a surface to cairo_t. And then, we can
> > write the above code as the following:
> >
> > ...
> > combined_surface = cairo_combined_surface(ps_surface, pdf_surface, NULL);
>
> Not a bad idea, but I think it will be difficult to implement in
> practice. The surfaces will almost certainly need fallback for
> different operations, and fallback happens in the generic surface
> layer, signalled by the backend surface returning an error code
> stating that the operation is unsupported. In the combined_surface
> case, the actual backend is the combined surface.
>
> So, when a composite request comes in that the pdf surface can hande,
> but the ps surface can not, you need the fallback to happen for the ps
> surface but not for the pdf surface. You can't return unsupported,
> since that would cause fallback rendering to happen for both -- so
> you'd have to implement the fallback yourself.
Not necessarily. If you implement the combined surface as a
simple container the keeps a collection of other cairo_surface_t
pointers and just dispatch incoming requests to all of them, you
get fallback for all of them for free. You probably should
return a failure message if at least one of the surfaces fail...
> This might not be as bad as it sounds, since a lot of that code is
> abstracted away in cairo-surface-fallback, but a lot is not; it may be
> more trouble than it's worth, especially given the duplication of
> fallback handling code.
>
> - Vlad
--behdad
http://behdad.org/
"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
-- Dan Bern, "New American Language"
More information about the cairo
mailing list