[Pixman] [RFC] A spans interface for pixman
Bill Spitzak
spitzak at gmail.com
Wed Aug 17 10:32:41 PDT 2011
Soeren Sandmann wrote:
> Yes; to be a bit more precise, with the current code, the alpha channel
> is a sampled version of the polygon and the rgb channels are 0. Ie., the
> pixels are black with varying levels of opacity.
>
> An interesting alternative possibility would be to consider the RGB
> channels duplicates of the alpha channel, which would make the pixels
> shades of white instead.
This is definitely better and much more useful. I would in fact have ALL
1-channel images treated this way, removing a lot of need to have
different operators whose purpose is only to source a 1-channel image
that defaults to acting like 0,0,0,x. I'm not sure what will break in
pixman and/or cairo if this is done, however.
> It could be interesting to add support for polygon operators:
>
> pixman_image_create_polygon_intersection (polygon1, polygon2)
> pixman_image_create_polygon_union (polygon1, polygon2);
> ...
>
> These would return a new polygon image that would contain pointers to
> the other two.
It may be possible to actually intersect these and make a new polygon
with full accuracy. Though in some cases such as matching lines it can
be painful and may produce a much larger number of path components than
the two originals. But also if users do this enough times you will end
up with a whole tree of polygons and CSG-like work.
It may help to detect when the result is identical to one of the inputs
or to the empty polygon. Such a test may be fast and will reduce the
size of the tree after many polygons.
Questions:
Can the polygon images be scaled or transformed when used as a source?
(and produce a correct antialiased result, not scaled pixels).
At the cairo level how could a user directly create a polygon surface?
Could it just detect that you only drew paths filled with white?
More information about the Pixman
mailing list