Transparent area becomes black when use BUTTON...ADJUST

Transparent area becomes black when use BUTTON...ADJUST

Postby hua » Tue Dec 05, 2023 9:42 am

I created the button with this command
Code: Select all  Expand view
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

Image

How do I fix this? Using HArbour+FWH1912
The bar is repositioned before display using the command oBar:GoRight()

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1038
Joined: Fri Oct 28, 2005 2:27 am

Re: Transparent area becomes black when use BUTTON...ADJUST

Postby karinha » Tue Dec 05, 2023 12:05 pm

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#AQu8t1Ru2f6PrsWZ8a6OJkzk6LakRrBbvvMv9JnFhR0

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Transparent area becomes black when use BUTTON...ADJUST

Postby nageswaragunupudi » Tue Dec 05, 2023 1:59 pm

hua wrote:I created the button with this command
Code: Select all  Expand view
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

Image

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
Code: Select all  Expand view
WHATSNEW 10 "whatsnew.bmp"

but not
Code: Select all  Expand view
WHATSNEW BITMAP "whatsnew.bmp"
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Transparent area becomes black when use BUTTON...ADJUST

Postby nageswaragunupudi » Tue Dec 05, 2023 2:57 pm

This is working fine for me here with FWH1912

Code: Select all  Expand view
#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 view
ICHAT    10 "..\bitmaps\alphabmp\ichat.bmp"
FILES    10 "..\bitmaps\alphabmp\files.bmp"
POCKETPC 10 "..\bitmaps\alphabmp\pocketpc.bmp"
IMAGE8   10 "..\bitmaps\pngs\image8.png"
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Transparent area becomes black when use BUTTON...ADJUST

Postby hua » Wed Dec 06, 2023 3:29 am

Thanks for the sample João
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1038
Joined: Fri Oct 28, 2005 2:27 am

Re: Transparent area becomes black when use BUTTON...ADJUST

Postby hua » Wed Dec 06, 2023 3:31 am

nageswaragunupudi wrote:Can i see the rc file entries for whatsnew.bmp?

Suggested format
Code: Select all  Expand view
WHATSNEW 10 "whatsnew.bmp"

but not
Code: Select all  Expand view
WHATSNEW BITMAP "whatsnew.bmp"


I coded it this way
Code: Select all  Expand view
WHATSNEW RCDATA "whatsnew2.png"
WHATSNEWG RCDATA "whatsnew2g.png"
 
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1038
Joined: Fri Oct 28, 2005 2:27 am

Re: Transparent area becomes black when use BUTTON...ADJUST

Postby hua » Wed Dec 06, 2023 3:33 am

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
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1038
Joined: Fri Oct 28, 2005 2:27 am

Re: Transparent area becomes black when use BUTTON...ADJUST

Postby nageswaragunupudi » Wed Dec 06, 2023 7:53 am

This is your definition of the buttonbar
Code: Select all  Expand view
 DEFINE BUTTONBAR oBar OF oWnd 3D size 110,66


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:
Code: Select all  Expand view
 DEFINE BUTTONBAR oBar OF oWnd GDIP SIZE 110,66 RIGHT


Please make this small change in buttonbar definition and let us know.

Code: Select all  Expand view
#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
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Transparent area becomes black when use BUTTON...ADJUST

Postby hua » Wed Dec 06, 2023 9:37 am

Thanks Rao! That solves it
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1038
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests