Recent

Author Topic: Transparency on TSpeedButtons Not Working  (Read 8105 times)

mrouse55

  • Newbie
  • Posts: 4
Transparency on TSpeedButtons Not Working
« on: July 25, 2014, 08:11:17 pm »
The Transparency on TSpeedButtons doesn't seem to be working correctly.  It recognizes the lower-left pixel as the transparency color, but instead of being transparent, it turns everything that is that color white.  If it actually made it transparent, it would be perfect, but white, or any other solid color doesn't work since the button is on a gradient. I am working on Windows 8, if that makes a difference.

Thanks in advance for any help

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Transparency on TSpeedButtons Not Working
« Reply #1 on: July 25, 2014, 08:30:05 pm »
you make no sense to be honest, there is no lower-left pixel on the transparency for the tspeedbutton unless you are talking about the transparency  on the icon of tspeedbutton which is more a problem of the imagelist/glyph and has nothing to do with the button it self.

Any pictures or a small sample to see what you are talking about would be good at this point.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

mrouse55

  • Newbie
  • Posts: 4
Re: Transparency on TSpeedButtons Not Working
« Reply #2 on: July 25, 2014, 09:11:47 pm »
Yes - the transparency color on the glyph is set and seems to work except that instead of being transparent, the background is white.  I've attached three clips.  Glyph.png shows the .bmp file that I'm using for the glyph.  The green area is what I want to be transparent.  TransparencyOff.png is what the button looks like if transparency is set to False.  TransparencyOn.png shows the button with transparency set to True.  As you can see, the green area that should be transparent is white.

Thanks again,

Mark

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Transparency on TSpeedButtons Not Working
« Reply #3 on: July 25, 2014, 09:38:12 pm »
I guess that glyphs on TSpeedBtn are painted via ThemeServices.DrawIcon() method where the transparency is managed by widgetset. Simply try to assign some transparent *.png. It works out of box here (Qt, GTK2), no tricks needed.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

mrouse55

  • Newbie
  • Posts: 4
Re: Transparency on TSpeedButtons Not Working
« Reply #4 on: July 25, 2014, 09:50:32 pm »
I tried a transparent .png with no luck.  However, I did discover that it works properly if I change the "Flat" property from the default of False to True.  I'm not sure what "Flat" does, but it should probably be documented that it needs to be "True" to support transparency.

Thanks,

Mark

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Transparency on TSpeedButtons Not Working
« Reply #5 on: July 25, 2014, 10:16:03 pm »
Sorry I can't reproduce your results on lazarus 1.2.4 no matter what I set I can't seem to make the glyph transparent it always comes back as green, Probably me doing something stupid to be honest I always use transparent PNGs. Just to make sure we are on the same page here there is nothing you can set on the speed button to set the glyph transparency the transparent property makes the buttton transparent not the glyph and only if you set the flat property to true also.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

mrouse55

  • Newbie
  • Posts: 4
Re: Transparency on TSpeedButtons Not Working
« Reply #6 on: July 25, 2014, 10:55:36 pm »
Per the documentation that I found, the lower-left pixel on the image file used as a glyph determines the color that will be transparent.  There was no mention that the Flat property had to be set to True.  So basically, if the lower-left pixel is green, the following is how it works.

TransparencyFlatResult
FalseFalseGreen Background
FalseTrueGreen Background
TrueTrueTransparent Background
TrueFalseWhite Background

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Transparency on TSpeedButtons Not Working
« Reply #7 on: July 25, 2014, 11:16:40 pm »
Per the documentation that I found, the lower-left pixel on the image file used as a glyph determines the color that will be transparent.  There was no mention that the Flat property had to be set to True.  So basically, if the lower-left pixel is green, the following is how it works.

Sorry If  I crop the attached glyph to cut off everything outside the green background and save it as png and then open it in the speed button regardless of the property values its always drawn with the green background. The documentation you read is old and applies for 24bit bitmaps as far as I know since all the desktop machines support 32bit bitmaps saving a png with transparency instead of green background and importing that in the glyph will so the glyph transparent regardless the speed button's property values. Can you attach the glyph you are importing to do my tests?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

bylaardt

  • Sr. Member
  • ****
  • Posts: 309
Re: Transparency on TSpeedButtons Not Working
« Reply #8 on: July 28, 2014, 07:46:39 pm »
I use PNG and work fine.
in the right side (picture attachment) i have only PNGs files to illustrate my flat speed buttons.

in Background to.

note that speedbutton respect the background color.

 

TinyPortal © 2005-2018