Please sign in to comment.
PNG input conversion rewrite for better transparency/alpha support.
There are two possible representations of transparency in PNG files: alpha channel for :truecolor-alpha and :greyscale-alpha colour types, and a separate transparency map in a tRNS ancillary chunk. PNG-READ retains the difference by keeping data from tRNS as a separate TRANSPARENCY property of png-state. New version of OPTICL:READ-PNG-STREAM uses transparency data for OPTICL alpha channel when reading a PNG with no "native" alpha channel implied by colour-type. Additionally, as OPTICL has no equivalent for :greyscale-alpha, greyscale images with (any kind of) transparency data are converted to RGBA. Due to a bug in PNG-READ (fix committed on pull request <Ramarren/png-read#3>), PNG-READ::TRANPARENCY property contained a raw representation of tRNS ancillary chunk instead of 2D 8-bit transparency data (that's how it was intended to work). A workaround for unfixed PNG-READ was added to this version of OPTICL:READ-PNG-STREAM: If TRANSPARENCY is not a 2D-array, its content is ignored (as if there were no alpha channel). Warning or error could be more appropriate here. Turning :greyscale-alpha colour type to RGBA is an example of new use cases supported by rewritten READ-PNG-STREAM, even with older PNG-READ.
- Loading branch information...