Posted: Sun Jan 06, 2008 5:04 pm Post subject: [Solved] Read png with transparent color
Hi to all!
Conceptual problem: I would like to read in a png and define one RGB value as transparent color (let's say: 0/0/0). No alpha channel involved.
My first idea was to create a transparency bitmap, to read the image as pixbuf, to render it to a pixmap and finally to apply the bitmap as transparency mask. Unfortunatly I didn't find any method to apply a transparency mask to a pixmap afterwards. The only method I could find, was gdk_pixmap_create_from_xpm_d(), dealing with transparency masks in company with a read in from XPM data. But I would be very glad to avoid XPM.
Does anybody has an idea? Thank you very much!
Best regards
Croco
Last edited by croco on Tue Jan 08, 2008 3:26 pm; edited 1 time in total
1.) Which object type for storing the png? There are many to choose: Image, pixbuf, pixmap. A long time I was focused on pixmaps, finally discovered, that the alpha channel was not copied, but just applied to the color values, when rendering the png into the background. Therefore a transfer from pixbuf to pixmap was not a good idea.
2.) To read out single pixel values is a litle complicated on pixbufs. Only way I could see: Change pixbuf to pixmap and thatone to image. (Unless one reads the values directly from memory. But that's not to prefer).
3.) How to get the transparency color into the alpha channel? The hint I got here, thank you very much.