[Lazarus] Alpha transparency

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Thu Feb 18 17:28:28 CET 2010


Ummm, actually this is conceptually wrong, because the images are not
stored in memory using the format of the file, so for any image format
you can simply set TRasterImage.PixelFormat to pf32bit to allocate a
8-bit channel for Alpha while in memory.

The problem is that I can't find routines to draw to this Alpha
channel. It seams it isn't yet implemented, and because Delphi doesn't
implement it we also need to think of an interface for this.

Also, 32-bit Bitmaps support transparency:

http://en.wikipedia.org/wiki/Comparison_of_graphics_file_formats

The separate classes for each format only implement load/saving to
stream/file ... the actual in memory format options is common.

> To do what you want you can use TPortableNetworkGraphic (for PNG format) in
> place of TBitmap. It's nearly the same interface (common parent component)
> with PNG format abilities in more (such as alpha channel).

Not really. Have you ever checked the declaration of
TPortableNetworkGraphic? It doesn't implement anything except
load/saving to stream/file

I took a look at the interface from TPNGObject (from TPNGImage
project) which was bought by Delphi and it seams only to offer a
scanline for the alpha channel.

-- 
Felipe Monteiro de Carvalho




More information about the Lazarus mailing list