FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Transparent bitmap on window
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Transparent bitmap on window
Posted: Fri Feb 06, 2009 04:16 PM

I use a bitmap with a white pixel in 0,0. But when i use oBitmap:ltransparent := .T. all the white pixels are black and not transparent! Any solution?

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Transparent bitmap on window
Posted: Fri Feb 06, 2009 05:56 PM

Hello Günther,

have a look at my new post for a solution.

Create Alpha-Bl.-BMP with different Applications

viewtopic.php?f=3t=14508

Regards
Uwe :lol:

&

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Transparent bitmap on window
Posted: Fri Feb 06, 2009 06:30 PM

I think bitmaps are transparent according to the first pixel without using lTransparent. Have you tried this?

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Transparent bitmap on window
Posted: Fri Feb 06, 2009 07:01 PM

Hello James,

Günther said, he wants to use the BMP inside a WINDOW !!! .
The solution with a frame works inside a Object like a xBrowse-cell.
For a Window it is => ABPaint( hDC, 20, 20, oBmp:hBitmap, 220 ).
If he wants to use just a normal BMP, he has to convert it at first ( define transparent areas ).
I'm not shure, how and where he wants to use the Bitmap.

Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Transparent bitmap on window
Posted: Tue Feb 10, 2009 02:45 PM

Ulli, only to paint a BMP on the main-window with a colored background. In the BMP there are a white region with a logo in blue. The left-top-pixel are also white. But no transparence are reachable.

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Transparent bitmap on window
Posted: Tue Feb 10, 2009 02:54 PM
Günther,

Are you using TransBmp() to paint the bitmap ?

i.e.:
            nOldClr = SetBkColor( ::hDC, nRGB( 255, 255, 255 ) )
            TransBmp( ::hBitmap, ::nWidth(), ::nHeight(), nZeroZeroClr, ::hDC,;
                      ::nX, ::nY, Super:nWidth(), Super:nHeight() )
            SetBkColor( ::hDC, nOldClr )

nZeroZeroClr is the color at pixel 0,0 of the bitmap

Search for TransBmp() in FWH\source\classes, there you will find some examples of use
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Transparent bitmap on window
Posted: Tue Feb 10, 2009 03:30 PM
No, i use the standard "@ 5,5 BITMAP..... and oBitmap:ltransparent := .T. " and i see in source, that transbmp() is used in this class.
This is the picture to show:
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Transparent bitmap on window
Posted: Tue Feb 10, 2009 07:37 PM

Günther,

is it a MDI window or a non MDI window ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Transparent bitmap on window
Posted: Tue Feb 10, 2009 07:43 PM
Günther,

A working example:
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Transparent bitmap on window
Posted: Wed Feb 11, 2009 12:25 AM

Antonio, thanks, i will try tomorrow. I see, that i use no the call refresh().
Can the clausula TRANSPARENT to better handling not include in the @ 5,5 BITMAP/IMAGE and in REDEFINE BITMAP/IMAGE?

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Transparent bitmap on window
Posted: Wed Feb 11, 2009 11:03 AM
Antonio, its a normal window as in your example. But in the "@ 5,5 BITMAP" i MUST define "OF oWindow". If not, no picture is to see.
But all my tests come to same result. The picture is NOT transparent!?

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Transparent bitmap on window
Posted: Thu Feb 12, 2009 01:14 AM
Hello Günther,

Your Bitmap has no < ALPHACHANNEL > !!!
it was the same problem with Silvio's BMP. I solved his problem and it works.
I tested Your Logo with the same result.
I captured Your image and saved it as < PNG > !!!.
After that, replaced the background with transparent ( erase background ).
For that, You choose < TRANSPARENT > from the color-picker, after that You can use the FILL-Container.
The result of the TRANSPARENT-painting is shown in the preview-window as Black color.
The PNG-Image is saved as Alphablended BMP ( like the preview-/test-window with black background ).
You can use the result as SPLASH-Logo as well.

I used < IcoFX >

viewtopic.php?f=3&t=14484&p=75182#p75182

The problem with a background : it is not allways a clear color.



The result
The Transparent-background-painting is not finished ( some background-parts are still white ),
to show what I mean !!!!
-----------------------------


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Transparent bitmap on window
Posted: Thu Feb 12, 2009 09:51 PM
download : http://www.pflegeplus.com/fw_downloads/volksbank.zip

Volksbank.png ( With completed transparent-background. Here You can still change something )
Volksbank.bmp ( Alpha-Blended-BMP )
Volksbank.jpg ( how to do it )



You can add a shadow


Creating a RED Shadow


...
...

DEFINE BITMAP oBmp1 FILENAME "Volksbank.bmp"

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT ( gradpaint( hDC, oWnd ), ;
ABPaint( hDC, 50, 50, oBmp:hBitmap, 220 ) )

RETURN NIL

// -----------------------------------------------

STATIC FUNTION gradpaint( hDC, oWnd )

local aGrad := { { 0.50, 16054371, 11892819 } }

GradientFill( hDC,  0, 0, oWnd:nHeight, oWnd:nWidth, aGrad, .F. )

RETURN NIL


Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Transparent bitmap on window
Posted: Tue Feb 17, 2009 12:25 AM

Uwe, thanks for your help. Its functioning perfect! But regardless the normal way to display transparent bitmaps on windows should be possible -> ANTONIO :)

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Transparent bitmap on window
Posted: Tue Feb 17, 2009 11:18 PM

Günther,

I posted a working example, maybe it was not working on your side as you use white for the windows background color (?)

You could try to change the background of your bitmap from white to another color and test my code again :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion