[Lazarus] Alpha transparency on GTK2 widgetset

Kostas Michalopoulos badsectoracula at gmail.com
Sun Jan 5 17:35:40 CET 2014


Yeah, the "proper" approach would be to make a Cairo-based
gtk2devicecontext implementation and it might still be a valid goal,
depending on how long the gtk3 interface will be in development (after
all it took years for the gtk2 interface to become the default in
Linux). Also i think that with gtk2 and gtk3 being incompatible, we'll
see gtk2 to remain around for a while, especially in non-GNOME-based
desktop environments (such as MATE, the GNOME2 fork, XFCE, etc).

But for the short term, this solves some common issues. Some of the
stuff mentioned in the related bugs seem to require a more solid
conversion to Cairo since currently there is a lot of information
"lost" with the conversions between pixmaps and pixbufs.


On Sun, Jan 5, 2014 at 3:56 PM, Marc Weustink <marc at dommelstein.net> wrote:
> 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.
>
> Marc
>
>
>
>
> 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
>>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




More information about the Lazarus mailing list