[Pixman] [cairo] pixman: New ARM NEON optimizations
Bill Spitzak
spitzak at gmail.com
Thu Feb 17 10:41:28 PST 2011
Siarhei Siamashka wrote:
> On Friday 11 February 2011 12:30:33 Soeren Sandmann wrote:
>> If I had a time machine, I would go back and make - among others -
>> these two changes to Render:
>
> [...]
>
>> (2) The RGB channels of Alpha-only images would be considered to be
>> the same as the alpha channel, and not 0 as they are now. For
>> example, a 0xb9 pixel in an a8 image would be considered
>> equivalent to 0xb9b9b9b9 and not to 0xb9000000. That is, they
>> would be considered a translucent white rather than a translucent
>> black.
>>
>> These two changes together would have the effect that (a) the equation
>> would be much easier to understand visually (composite src and dst,
>> then clip to the mask and write back), and (b) component alpha would
>> become completely regular with no need for the "component_alpha" bit
>> in pictures.
>
> Regarding the (b) part, probably as a side effect of current implementation,
> right now it is possible to do some operations with images having
> non-premultiplied alpha:
>
> src_img = pixman_image_create_bits (
> PIXMAN_x8b8g8r8, width, height, src, stride);
> msk_img = pixman_image_create_bits (
> PIXMAN_a8b8g8r8, width, height, src, stride);
> dst_img = pixman_image_create_bits (
> PIXMAN_a8r8g8b8, width, height, dst, stride);
>
> pixman_image_composite (PIXMAN_OP_SRC, src_img, msk_img, dst_img,
> 0, 0, 0, 0, 0, 0, width, height);
That certainly is useful and I thought it was officially supported by
Cairo (using a 4-channel image as a mask is the same as using the alpha
channel). However I don't see how changing the interpretation of the
color of a one-channel image will make any difference to this.
I agree with Soeren that treating one-channel images as though
r==g==b==a (ie it is a white premultiplied image) is much more useful
than as a black premultiplied image and should be done.
More information about the Pixman
mailing list