[Lazarus] Alpha transparency on GTK2 widgetset

Kostas Michalopoulos badsectoracula at gmail.com
Sat Jan 4 16:20:27 CET 2014

Looking in the code, I think i see the problem. The graphics
operations for GTK2 use GDK drawables which do not support alpha
blending. The bitmaps can be stored in 32bit pixbufs, but those are
not drawables and when a graphics operation is needed (drawing to a
canvas or blitting from one image to another), the graphics context
contains a generated pixmap (which only holds RGB data) and a mask
(which is 1bit). So all drawing operations are limited to 1bit

However GDK does offer functionality for drawing pixbufs to drawables
but it is incompatible with the rest of the GDK graphics operations
(f.e. you can't draw an arc to a pixbuf so pixbufs cannot be used for

For now i'm looking into trying to use the pixbuf when an image
operation is requested and see if that helps for solving the most
glaring issues with toolbars having no transparency and converting
between tbitmap to tlazintfimage and back losing the alpha channel. It
wont solve the issue of other operations (f.e. drawing a line, arc,
rectangle, etc over an image with alpha channel), but that would
require a complete rewrite of the GTK2 graphics context code to use
Cairo (which will be necessary for GTK3 anyway).

On Sat, Jan 4, 2014 at 2:24 PM, Juha Manninen <juha.manninen62 at gmail.com> wrote:
> On Sat, Jan 4, 2014 at 3:00 PM, Kostas Michalopoulos
> <badsectoracula at gmail.com> wrote:
>> What is the problem with (full) transparency in GTK2?
> I have no idea.
>> Is anyone working on this?
> Unfortunately not. There are only few people who know the GTK2
> bindings code. We would need more contributors for it.
> Right now I am going through Mantis issues with target 1.2. There are
>> 270 of them. Uhhh!
> Most of them must be postponed but maybe we can make it down to 250 before that.
> Anybody who is interested, please look at the issues.
> Find the ones already fixed and provide patches for the ones that are
> not. Thanks. :)
> Juha
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

More information about the Lazarus mailing list