[cairo] [PATCH] [API] Support component-alpha.

Soeren Sandmann sandmann at daimi.au.dk
Tue Oct 20 08:29:05 PDT 2009

Chris Wilson <chris at chris-wilson.co.uk> writes:

> Hmm, I can appreciate that using a per-component mask complicates
> everything, but how does this actually differ from cairo/pixman
> currently for normal gradients?
> At the moment there are a few bugs in Cairo where a per-component glyph
> mask is being generated, but that information is not being passed along
> to the rasteriser (the most obvious example is fallback glyph rendering
> for xlib). The question simply becomes: can we define how per-component
> alpha masks are supposed to operate and so be exported to users?

Well, there are two subtly different concepts in play here:

1. The concept of a 'three times horizontally supersampled image'

2. The concept of 'values to be presented to an output device'

It seems to me that (1) is the only thing a user can really be
expected to provide, because while (2) can be computed from (1), to do
a good job of it, you have to know about device characteristics and
human vision, then apply appropriate filtering and correction. You
also need to control which color space compositing takes place in.

If the component_alpha pattern property uses interpretation (2), then
we are effectively asking users to use their understanding of cairo
internals to compute something quite non-trivial.

In principle, component alpha could be supported as a property on
surfaces that says "when rendering to this surface, assume that it
will eventually be displayed on a subpixel-capable
monitor". Gradients, fonts and geometry rendered to such a surface
would then be supersampled and filtered appropriately by cairo.

A "supersampled" property on image patterns would then indicate that
the image was horizontally supersampled three times. Rendering could
make use of this information any way it wanted to. The property would
be ignored for gradients, just as filters are currently ignored.

I'm not really arguing for or against the proposed API, just trying to
make sure it has well-defined semantics.


More information about the cairo mailing list