Page 1 of 1
Transparent area becomes black when use BUTTON...ADJUST
Posted: Tue Dec 05, 2023 9:42 am
by hua
I created the button with this command
Code: Select all | Expand
DEFINE BUTTON oBtnWhatsnew RESOURCE "whatsnewg","","","whatsnew" OF oBar ADJUST
The image is alpha-blend image.
If I don't use ADJUST clause, the image is not resized but transparent area displays ok.
If I use ADJUST clause, the image's size is nice but the transparent area of the image becomes black like below
How do I fix this? Using HArbour+FWH1912
The bar is repositioned before display using the command oBar:GoRight()
TIA
Re: Transparent area becomes black when use BUTTON...ADJUST
Posted: Tue Dec 05, 2023 12:05 pm
by karinha
see if it helps. calls to resources are in SILVBMP.RC. Doubts? Ask.
mira si ayuda. las llamadas a recursos están en SILVBMP.RC. ¿Dudas?, pregunta.
Look,
Download complete:
https://mega.nz/file/ZZsUBZoK#AQu8t1Ru2 ... vMv9JnFhR0
Regards, saludos.
Re: Transparent area becomes black when use BUTTON...ADJUST
Posted: Tue Dec 05, 2023 1:59 pm
by nageswaragunupudi
hua wrote:I created the button with this command
Code: Select all | Expand
DEFINE BUTTON oBtnWhatsnew RESOURCE "whatsnewg","","","whatsnew" OF oBar ADJUST
The image is alpha-blend image.
If I don't use ADJUST clause, the image is not resized but transparent area displays ok.
If I use ADJUST clause, the image's size is nice but the transparent area of the image becomes black like below
How do I fix this? Using HArbour+FWH1912
The bar is repositioned before display using the command oBar:GoRight()
TIA
Can i see the rc file entries for whatsnew.bmp?
Suggested format
but not
Re: Transparent area becomes black when use BUTTON...ADJUST
Posted: Tue Dec 05, 2023 2:57 pm
by nageswaragunupudi
This is working fine for me here with FWH1912
Code: Select all | Expand
#include "fivewin.ch"
function btnbar()
local oWnd, oBar
DEFINE WINDOW oWnd TITLE FWVERSION
DEFINE BUTTONBAR oBar OF oWnd SIZE 80,80 RIGHT //2007
DEFINE BUTTON OF oBar RESOURCE "ICHAT" ADJUST
DEFINE BUTTON OF oBar RESOURCE "FILES" ADJUST
DEFINE BUTTON OF oBar RESOURCE "POCKETPC" ADJUST
DEFINE BUTTON OF oBar RESOURCE "IMAGE8" ADJUST
ACTIVATE WINDOW oWnd CENTERED
return nil
rc file
Code: Select all | Expand
ICHAT 10 "..\bitmaps\alphabmp\ichat.bmp"
FILES 10 "..\bitmaps\alphabmp\files.bmp"
POCKETPC 10 "..\bitmaps\alphabmp\pocketpc.bmp"
IMAGE8 10 "..\bitmaps\pngs\image8.png"
Re: Transparent area becomes black when use BUTTON...ADJUST
Posted: Wed Dec 06, 2023 3:29 am
by hua
Thanks for the sample João
Re: Transparent area becomes black when use BUTTON...ADJUST
Posted: Wed Dec 06, 2023 3:31 am
by hua
nageswaragunupudi wrote:
Can i see the rc file entries for whatsnew.bmp?
Suggested format
but not
I coded it this way
Code: Select all | Expand
WHATSNEW RCDATA "whatsnew2.png"
WHATSNEWG RCDATA "whatsnew2g.png"
Re: Transparent area becomes black when use BUTTON...ADJUST
Posted: Wed Dec 06, 2023 3:33 am
by hua
nageswaragunupudi wrote:This is working fine for me here with FWH1912
Thank you for taking your time to create the sample.
I managed to create a reduced self-contained example that still shows the bug on my pc. Can you see whether that is the case or not on yours?
https://drive.google.com/file/d/1704KUU ... drive_link
Thank you
Re: Transparent area becomes black when use BUTTON...ADJUST
Posted: Wed Dec 06, 2023 7:53 am
by nageswaragunupudi
This is your definition of the buttonbar
1) Remove "3D" clause. This is creating problem of transparency. If you remove this clause, the images will be transparent.
But
resizing makes the image ragged.
2) Add "GDIP" clause. This makes the resized image smooth.
Recommended code:
Please make this small change in buttonbar definition and let us know.
Code: Select all | Expand
#include "fivewin.ch"
PROCEDURE main()
local oBar, oBtnWhatsNew
local oWnd
DEFINE WINDOW oWnd TITLE "Test png in bar " + FWVERSION
DEFINE BUTTONBAR oBar OF oWnd /*3D*/ GDIP RIGHT SIZE 110,66
DEFINE BUTTON oBtnWhatsnew RESOURCE "WHATSNEWG","","","WHATSNEW" OF oBar ;
ADJUST FLAT
// oBar:GoRight()
ACTIVATE WINDOW oWnd CENTERED //MAXIMIZED
return
Re: Transparent area becomes black when use BUTTON...ADJUST
Posted: Wed Dec 06, 2023 9:37 am
by hua
Thanks Rao! That solves it