Issues creating alpha-channel-transparent images in gtk2
* Lazarus/FPC Version: Laz/main at various commits + FPC 3.22 * Operating System: Manjaro Linux, Mint, Ubuntu, macOS Mojave, Windows 11 * CPU / Bitness: virtual machines hosted on Win 11 (Intel/64 bit). The IDE is 64 bit in all cases, additionally 32 bit on Windows. ## What happens The wiki article https://wiki.freepascal.org/Developing_with_Graphics#Creating_and_drawing_a_transparent_bitmap_for_a_TImage shows code how to create a semi-transparent image by means of TLazIntfImage and how to display it in a TImage. This works correctly in the win, cocoa and qt5 widgetsets, but presents a black rectangle in gtk2. ## What did you expect gtk2 should work in the same way as the other widgetsets (tested: qt5, cocoa, win32/64, gtk3 (but with other issues, see below)). ## Steps to reproduce The attached project comes with build modes for gtk2, gtk3, qt5, cocoa and windows, gtk2 pre-selected. It creates the alpha-blended image of above wiki article in two ways: 1. Button "Create image as LazIntfImage" works with a TLazIntfImage, like in the wiki. This works correctly in all widgetsets, except for gtk2 where the entire image turns black. When the "Use white background" checkbox is checked the blackness disappears, the drawing can be seen, however on a white background. 2. Button "Create Image as FPImage" uses the must fundamental fcl-image library to create the alpha-blended drawing. Since this cannot be displayed directly in a TImage (at least to my knowledge) I saved the image to a temporary stream and made the TImage load the image from it - now the result is correct, even on gtk2! I think this clearly indicates that something is wrong in the way how gtk2 handles the alpha channel in TLazIntfImage. [transparent_fclimage_intfimage.zip](/uploads/f2d12a161ea46bdf1e5a75b474230dff/transparent_fclimage_intfimage.zip) ## Remarks on gtk3 ## The "black image" issue is not observed on Linux/gtk3, but here the red and blue color channels are exchanged. It also does not draw the form background with a GradientFill as requested. ## Screenshots (Linux Mint) | Description | Screenshot | | ------ | ------ | | gtk2<br> created as LazIntfImage | ![grafik](/uploads/e97a3a20db85e21e5e235cb3d245a582/grafik.png) | | gtk2<br>created as LazIntfImage<br>with white background | ![grafik](/uploads/8ff6cfd56273727b7a095d5b24240fc3/grafik.png) | | gtk2<br>created as FPImage | ![grafik](/uploads/ff05098d3fdfa0cce9feacc2de37e092/grafik.png) | | gtk3<br>created as LazIntfImage | ![grafik](/uploads/b5d58fa38c33e9cb6f7d57ec9c6882cf/grafik.png) | | qt5<br>created as LazIntfImage | ![grafik](/uploads/51386078a7060c1335b070de63e5a748/grafik.png) |
issue