[Lazarus] Alpha transparency on GTK2 widgetset

Kostas Michalopoulos badsectoracula at gmail.com
Sat Jan 4 19:22:23 CET 2014


I've made a patch that fixes the common cases (drawing an image with
an alpha channel with optional scaling and flipping). It can be
downloaded here:

http://bugs.freepascal.org/view.php?id=25491

Here is also an image showing what this fixes:

http://i.imgur.com/FH8wbX0.png

The test program (attached on the bug report) shows the toolbar,
image/icon and generated bitmap with TLazIntfImage/TRawImage. The
latter is drawn normally, stretched, flipped and both stretched and
flipped (as a side note the flipping doesn't seem to work under
Windows but the API seems to support it and the unpatched GTK2 also
supported that, so this is probably a bug in the Win32 widgetset).

Also the watches toolbar in Lazarus is shown before and after the
patch (notice the jaggies and missing pixels in the unpatched
version).


On Sat, Jan 4, 2014 at 4:38 PM, Juha Manninen <juha.manninen62 at gmail.com> wrote:
> On Sat, Jan 4, 2014 at 5:20 PM, Kostas Michalopoulos
> <badsectoracula at gmail.com> wrote:
>> Looking in the code, I think i see the problem.
>> [...]
>
> Impressive. I still mostly don't understand GTK2 bindings code.
>
>
>> 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).
>
> A patch for GTK2 bindings would surely be welcome.
> Do you know that GTK3 bindings also exist. They have a different
> architecture than GTK2 bindings.
> Zeljan has started them but they are in alpha state now.
> Contributions are welcome there, too.
>
> 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