Forum > Win32/64

BitBtn - display error

(1/2) > >>

Ally:
An icon with transparent image areas is not displayed correctly on a BitBtn.
Partially transparent pixels are not rendered with their actual color, but as a gray tone.
This results in very unattractive display errors, especially where transparent pixels are used to provide a smoother display.
So far I have only noticed this problem with BitBtn. SpeedButton, DirectoryEdit, ToolButton or MenuItem's render the icons correctly.
Attached is an example to illustrate the problem. (Win10, Lazarus 2.2.0 FPC 3.2.2 x86_64-win64-win32/win64)

Some time ago I wrote a bugreport about this and in the meantime I saw that there are some more reports describing this bug.
Unfortunately there was no feedback in the bugtracker.

In the German Lazarus forum I also addressed this (https://www.lazarusforum.de/viewtopic.php?p=124148#p124148).

Thereby it turned out:
That the problem is only present under Windows.
TBitBtn is a TWinControl descendant.
TSpeedButton is a TGraphicControl descendant and does not have the problem.

Now I'm not exactly an expert in this field, but I tried to get to the bottom of it anyway. Unfortunately without success.

So my question to you is: who knows something about this and can localize the place where the BitBtn icon is drawn, different from the other components.
Maybe a few small hints are enough to make it easier for the experts in the developer team to get started.

Here is an enlarged view where you can see the difference well.

wp:

--- Quote from: Ally on March 01, 2022, 12:13:31 pm ---An icon with transparent image areas [...]

--- End quote ---
Just to make sure: you loaded the image list in your demo with alpha-channel png images rather than with transparent ico files as your description might suggest?

Since only TBitBtn is affected and since this is drawn by the widgetset I'd guess that this probably is a Windows issue, or calling out-dated painting painting routines from the era when alpha-channel transparency was still unknown to Windows. BTW, could you check out your demo with Delphi?

Handoko:
Tested the OP's BitBtnDisplayError.zip on Lazarus 2.2.0 64-bit GTK2 Ubuntu Mate 21.10. All the icons seem okay, see the attached screenshot (400% zoom):

Ally:
@wp


--- Quote ---Just to make sure: you loaded the image list in your demo with alpha-channel png images rather than with transparent ico files as your description might suggest?
--- End quote ---

Yes, of course the "Icons" are as usual transparent PNG's which are inserted over an ImageList.


--- Quote ---BTW, could you check out your demo with Delphi?
--- End quote ---

My last Delphi is version 7 and there, without additional extensions, only BMP's without transparency are supported.
But the idea is good. Maybe someone, who has a current Delphi, is so kind and tests this briefly?


@Handoko

Thanks for testing.
This confirms what I said above: The problem could only be observed under Windows so far.

wp:

--- Quote from: Ally on March 01, 2022, 01:13:16 pm ---My last Delphi is version 7 and there, without additional extensions, only BMP's without transparency are supported.
But the idea is good. Maybe someone, who has a current Delphi, is so kind and tests this briefly?

--- End quote ---
Oh what a mess! I have the XE10.3.3 community edition, and even today they only allow me to load bmp into TBitBtn.Glyph! Then I remembered that they equipped TButton with a TImageList now, and TImageList does allow me to load png, but the images now have a black background.

Navigation

[0] Message Index

[#] Next page

Go to full version