#FEATURE by cg
class: PNGReader
changed: #setColorType:
class: PNGReader class
comment/format in: #documentation
EnforcedImageTypeQuery allows rgb (instead of rgba)
read comment in that query class
--- a/PNGReader.st Fri Jan 12 22:10:59 2018 +0100
+++ b/PNGReader.st Tue Jan 16 16:20:36 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1996 by Claus Gittinger
All Rights Reserved
@@ -53,6 +55,11 @@
writer can only store mask with depth24 images (for now).
writer only generates unfiltered non-interlaced data.
+ [Special:]
+ the EnforcedImageTypeQuery is asked for;
+ if #rgb is returned AND the image is rgba, then the alpha channel is ignored
+ and an rgb (Depth24Image) is returned instead.
+
[See also:]
Image Form Icon
BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader
@@ -526,6 +533,9 @@
^ false.
].
photometric := #rgba.
+ ImageReader::EnforcedImageTypeQuery query == #rgb ifTrue:[
+ photometric := #rgb
+ ].
samplesPerPixel := 4.
bitsPerSample := Array with:bitsPerChannel with:bitsPerChannel with:bitsPerChannel with:bitsPerChannel.
depth := bitsPerChannel * 4.