New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility for Fl_PNG_Image, 4/8bit + alpha channel #234
Comments
Thanks for your report, I'll look into it... |
@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: 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:
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;
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 (
I'm sure that FLTK can load and display all these images. All these images have |
Okay, I think I found the "problem". See original post above:
@rageworx: This seems to be a misunderstanding on your part. In I used the image
which is clearly a 4-bit grayscale image with alpha (the latter is not displayed by
The code in question is (slightly modified):
As you can see the channel values * mulb (2) would obviously be > 255 which is wrong. Conclusion: FLTK's code is correct WRT handling bit depth 4 gray+alpha PNG images and your patch can't be accepted. As a proof here's a screenshot of four images:
There are slight differences in brightness, maybe also caused by background diffs, but I'd say that your patched version is definitely the "worst" display and, as shown before, obviously not correct. So, unless I missed something essential, FLTK is correct and this issue should be closed. |
Dear @Albrecht-S , and @fire-eggs . Thank you for all, Line 412 in da4d16b
I will rollback my repo to origin Fl_PNG_Image.cxx. Thought all 2depth will be processed to RGB555 or RGB565 to RGB(3depth). Regards, Raph.K. |
Yes, you right, It wasn't tested as well, it's my fault. (and it will be back to previous codes)
Anyway, Firefox renders different way ... what's different, should we know ? |
Thanks for the feedback and for closing this issue.
I tried it with |
Dear, FLTK developers.
I've been found an issue for Fl_PNG_Image cannot read some PNG files of this condition with @fire-eggs for this issue ( rageworx/fl_imgtk#16 )
So I tested with my own clonned Fl_PNG_Image to solve this issue here.
If alpha channel existed, array converting to RGBA, then process to each graphics driver.
My Fl_PNG_Image may not the best choice, but it should be make better to load variable PNG images.
Regards, Raph.K.
The text was updated successfully, but these errors were encountered: