[Pixman] [RFC] A spans interface for pixman
sandmann at cs.au.dk
Wed Aug 17 16:30:57 PDT 2011
Bill Spitzak <spitzak at gmail.com> writes:
>> 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.
A way to introduce this behavior without breaking backwards
compatibility would be to just add new PIXMAN_w8/w4/w1 format that would
operate in this way.
I'm not sure which other one-channel images you mean. Aside from
a8/a4/a1, the only other one-channel images pixman supports are g8/g4/g1
and c8/c4/c1 which are paletted and not used much.
>> 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.
What I meant was that you could rasterize all the polygons at the same
time, and then do the intersect/union at the subpixel scanline
level. That would produce the same accuracy as intersecting the polygons
> Can the polygon images be scaled or transformed when used as a source?
> (and produce a correct antialiased result, not scaled pixels).
Right now they can't, but they probably should considering all other
images can be. Is this any more complicated than simply transforming all
the edge endpoints?
> 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?
I don't know if a polygon pattern is interesting as a user-visible
concept in cairo.
More information about the Pixman