Decode 16bit alpha channel in PNG_ALPHA_PNG mode using simplified API

Alexey Vorobiov <[email protected]> Wed, 2 Oct 2019 15:26:18 +0300
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAFVPgZZ+swR-+QEw3duMmMOjCT20pgxukuqKLQfxm+fbeODt7w@mail.gmail.com>
Hi all. I noticed weird behavior of simplified API - alpha channel decoded
in different way for 8 and 16 bit RGBA files: for PNG_FORMAT_RGBA format
alpha read mode is PNG_ALPHA_PNG(as I expect), but
for PNG_FORMAT_LINEAR_RGB_ALPHA it's PNG_ALPHA_STANDARD and it's not what I
want.
Alpha read mode is set in pngread.c:3749
      if (linear != 0)
      {
         /* If there *is* an alpha channel in the input it must be
multiplied
          * out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG.
          */
         if ((base_format & PNG_FORMAT_FLAG_ALPHA) != 0)
            mode = PNG_ALPHA_STANDARD; /* associated alpha */

         else
            mode = PNG_ALPHA_PNG;

         output_gamma = PNG_GAMMA_LINEAR;
      }
      else
      {
         mode = PNG_ALPHA_PNG;
         output_gamma = PNG_DEFAULT_sRGB;
      }
If I edit source it works as I expect, so why behavior is different for 8
and 16 bit and how I can read 16bit alpha in PNG_ALPHA_PNG mode using
simplified API?

_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement