Transparent area becomes black when use BUTTON...ADJUST

Post Reply
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Transparent area becomes black when use BUTTON...ADJUST

Post 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

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
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

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

Post 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.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post 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

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

WHATSNEW 10 "whatsnew.bmp"
but not

Code: Select all | Expand

WHATSNEW BITMAP "whatsnew.bmp"
Regards

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

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

Post 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"
 
Image
Regards

G. N. Rao.
Hyderabad, India
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

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

Post by hua »

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

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

Post by hua »

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

Suggested format

Code: Select all | Expand

WHATSNEW 10 "whatsnew.bmp"
but not

Code: Select all | Expand

WHATSNEW BITMAP "whatsnew.bmp"
I coded it this way

Code: Select all | Expand

WHATSNEW RCDATA "whatsnew2.png"
WHATSNEWG RCDATA "whatsnew2g.png"
 
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

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

Post 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
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post by nageswaragunupudi »

This is your definition of the buttonbar

Code: Select all | Expand

  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

  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

#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
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

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

Post by hua »

Thanks Rao! That solves it
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
Post Reply