Simple API and associated alpha

Samuel Williams <[email protected]>
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAHkN8V8OSJt4a3L9oOGwBpA06vk_tVvdYQ_sRg7dEnXR4O2wcQ@mail.gmail.com>
I'm using the simple API to read an 8-bit RGBA PNG.

Here is the image:
https://github.com/kurocha/images/blob/master/test/Images/fixtures/bacon.png

I'm writing some tests to check the behaviour in comparison to WebP.

Here is the documentation I'm reading:

When an alpha channel is present it is expected to denote pixel coverage
of the color or luminance channels and is returned as an associated alpha
channel: the color/gray channels are scaled (pre-multiplied) by the alpha
value.

I've written a test to load this image, and where the alpha channel is
0, I also expect color channel to be zero.

Here is the code that uses the simple API to read the pixel data:
https://github.com/kurocha/images/blob/2cb3397cd5ed6966cf1fd852dca855909b80c15e/source/Images/PNGImage.cpp#L43-L50

Here is the test:

https://github.com/kurocha/images/blob/2cb3397cd5ed6966cf1fd852dca855909b80c15e/test/Images/Test.Transparency.cpp#L30-L38

However, in many cases this is not true. Is this a bug? Am I
misinterpreting the documentation?

Thanks
Samuel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.