FLTK logo

Re: [fltk/fltk] Compatibility for Fl_PNG_Image, 4/8bit + alpha channel (#234)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] Compatibility for Fl_PNG_Image, 4/8bit + alpha channel (#234) Albrecht Schlosser May 22, 2021  
 

@rageworx: Thanks for your "heart" emoji. A first (preliminary) comment: FLTK supports grayscale with alpha channel, hence I think it wouldn't be necessary to convert all gray+alpha images to RGBA which makes them larger than necessary (in terms of memory usage). Gray + alpha (in FLTK images: d() == 2) would suffice (see below).

I didn't test with example "1 and 2 bpp" images yet but I'm going to test this later. I'll try to modify your patch accordingly.

FYI: There are currently 11 "gray+alpha" images in the FLTK source distribution which show that FLTK can load gray+alpha images, at least 8bpp:

$ file documentation/src/Fl_Light_Button.png 
documentation/src/Fl_Light_Button.png: PNG image data, 130 x 30, 8-bit gray+alpha, non-interlaced

I tried the test program you posted here as pngtest1.zip but this test program (built on Linux) seems to always issue warnings and errors (on all images I tested so far) like this;

$ pngtest documentation/src/Fl_Light_Button.png
> load file = documentation/src/Fl_Light_Button.png
> PNG version : 1.6.37
> color type = 00000004
> alpha channel existed
> tRNS ( transparency ) = 0
> color bit depth = 8
libpng warning: IDAT: bad parameters to zlib
libpng error: [00][00][00][00]: invalid chunk type

The "IDAT: bad parameters to zlib" warning seems to be always, but the error is different. I hoped this test would help but unfortunately it doesn't seem so. The errors seem to be like those you posted but they have nothing to do with FLTK (the test program is not using FLTK). Is there anything wrong with this test program?

Looks like I need to dive deeper into this...

PS: Full list of "gray+alpha" images in FLTK docs (file *.png|grep 'gray+alpha'):

adjuster1.png:         PNG image data, 125 x 120, 8-bit gray+alpha, non-interlaced
counter.png:           PNG image data, 210 x 115, 8-bit gray+alpha, non-interlaced
Fl_Light_Button.png:   PNG image data, 130 x 30, 8-bit gray+alpha, non-interlaced
Fl_Return_Button.png:  PNG image data, 160 x 30, 8-bit gray+alpha, non-interlaced
Fl_Roller.png:         PNG image data, 145 x 120, 8-bit gray+alpha, non-interlaced
Fl_Round_Button.png:   PNG image data, 148 x 29, 8-bit gray+alpha, non-interlaced
Fl_Value_Input.png:    PNG image data, 140 x 50, 8-bit gray+alpha, non-interlaced
Fl_Value_Output.png:   PNG image data, 135 x 50, 8-bit gray+alpha, non-interlaced
scrollbar.png:         PNG image data, 130 x 120, 8-bit gray+alpha, non-interlaced
tabs.png:              PNG image data, 309 x 209, 8-bit gray+alpha, non-interlaced
text.png:              PNG image data, 213 x 187, 8-bit gray+alpha, non-interlaced

I'm sure that FLTK can load and display all these images. All these images have d() == 2 after loading (just tested).


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.