[Lazarus] Alpha transparency on GTK2 widgetset

Marc Weustink marc at dommelstein.net
Sun Jan 5 15:56:42 CET 2014

Nice job.
I had a different approach in mind, but that required a rewrite of 
gtk2devicecontext and a lot of cairo stuff. This effectively would be 
similar to gtk3 and take a lot of time.
After some initial rewrites, life changed and my time became limited. At 
the same time I heard rumors about a start of a gtk3 interface. So the 
interest of changing gtk2 dropped.
I'm glad you wrote this patch.


On 4-1-2014 19:22, Kostas Michalopoulos wrote:
> 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
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

More information about the Lazarus mailing list