[Pixman] A6R6G6B6 (or A8R5G6B5)
sandmann at cs.au.dk
Tue Mar 13 06:46:43 PDT 2012
Leon Woestenberg <sidebranch.linux at gmail.com> writes:
> What is the purpose of color_to_pixel()? Not all formats are supported in
> there, why not?
The function is used in pixman_image_fill_boxes() to convert a
full-precision pixman_color_t to a value than can be directly written to
a pixman image.
If a format is not supported by color_to_pixel(),
pixman_image_fill_boxes() will fall back to using
pixman_image_composite32() with a solid source, which may be a little
slower. So color_to_pixel() is basically an optimization.
> Also, what to do when there would be a 32-bit field with 4 ARGB components
> within 24-bit, and a X8 to fill it up?
> PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
> PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
> Would this work as expected?
> PIXMAN_x8a8r5g6b5 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,5,6,5),
Assuming you mean PIXMAN_TYPE_ARGB and not TYPE_ABGR in the above, this
is really a question of whether the X bits in TYPE_ARGB formats are
located at the top or at the bottom of the pixel. Considering that with
x8r8g8b8 pixels they are located at the top, and that the x4a4 format
has both an x channel and an a channel, I think that it is supposed to
Whether it *does* work, I don't know. There isn't any precedence in
Pixman for having both an alpha channel and an x channel in a TYPE_ARGB
format, so there could be bugs.
More information about the Pixman