[Lazarus] TBitBtn image, how to make background transparent?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] TBitBtn image, how to make background transparent?

Free Pascal - Lazarus mailing list
I am trying to make a bitmap image for a TBitBtn button such that the
background of the image will be transpoarent and therefore the button
color will be visible.

But I don't succeed with this, the background I use for the image is
visible on the button.
Even if I set the same color as the buttonface to the background it
becomes visible on the button because the button itself has gadient
color....
So not the same color at the top of the button and at the bottom.

I was under the impression that button images use the color of pixel
(1, 1) as the define for the transparent color, so I have the complete
border set to the same background color.
Not working....

Or is a specific color defined as the transparent color, if so what is
this color? (RGB please)

What can I do to use glyphs on a TBitButton?

--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TBitBtn image, how to make background transparent?

Free Pascal - Lazarus mailing list
On 13.05.2019 22:36, Bo Berglund via lazarus wrote:
> I am trying to make a bitmap image for a TBitBtn button such that the
> background of the image will be transpoarent and therefore the button
> color will be visible.

What OS and WidgetSet? If you are on win32 - AFAIR a PNG works just fine.

Ondrej

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TBitBtn image, how to make background transparent?

Free Pascal - Lazarus mailing list
On Mon, 13 May 2019 22:41:32 +0200, Ondrej Pokorny via lazarus
<[hidden email]> wrote:

>On 13.05.2019 22:36, Bo Berglund via lazarus wrote:
>> I am trying to make a bitmap image for a TBitBtn button such that the
>> background of the image will be transpoarent and therefore the button
>> color will be visible.
>
>What OS and WidgetSet? If you are on win32 - AFAIR a PNG works just fine.
>

Windows 7 x64, Lazarus 2.0.0 32 bit, fpc 3.0.4

I have tried creating a png image (24x24 pixels) with a gray
background equal to the shade at the bottom of the TBitBtn.
When I assign this image as the glyph of the TBitBtn I can see the
image square against the button since the button's gray color is
whiting out towards the top.
So my gray shade is not transparent...

----- BUT WAIT A MINUTE!  -------

Even as the button appears with the colored square inside the Lazarus
IDE the background actually disappears (becomes transparent) when I
compile the application and run it!
So it seems like the form is displaying the button in a different way
in the IDE from when the program is running.

I did not know this and I had a number of other items I was coding on
so I did not test it actually running, believing that what I see in
the IDE is what I get when running.

Issue resolved.

--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] TBitBtn image, how to make background transparent?

Free Pascal - Lazarus mailing list
On 13.05.2019 23:42, Bo Berglund via lazarus wrote:
> I have tried creating a png image (24x24 pixels) with a gray
> background equal to the shade at the bottom of the TBitBtn.
> When I assign this image as the glyph of the TBitBtn I can see the
> image square against the button since the button's gray color is
> whiting out towards the top.
> So my gray shade is not transparent...

PNG supports alpha-channel - use it.

Ondrej

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus