Transparent bitmap on window

Transparent bitmap on window

Postby byte-one » Fri Feb 06, 2009 4: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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Transparent bitmap on window

Postby ukoenig » Fri Feb 06, 2009 5: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=3&t=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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Transparent bitmap on window

Postby James Bott » Fri Feb 06, 2009 6:30 pm

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

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Transparent bitmap on window

Postby ukoenig » Fri Feb 06, 2009 7: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Transparent bitmap on window

Postby byte-one » Tue Feb 10, 2009 2: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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Transparent bitmap on window

Postby Antonio Linares » Tue Feb 10, 2009 2:54 pm

Günther,

Are you using TransBmp() to paint the bitmap ?

i.e.:
Code: Select all  Expand view
            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
User avatar
Antonio Linares
Site Admin
 
Posts: 41405
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Transparent bitmap on window

Postby byte-one » Tue Feb 10, 2009 3: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:
Image
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Transparent bitmap on window

Postby Antonio Linares » Tue Feb 10, 2009 7:37 pm

Günther,

is it a MDI window or a non MDI window ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41405
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Transparent bitmap on window

Postby Antonio Linares » Tue Feb 10, 2009 7:43 pm

Günther,

A working example:
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41405
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Transparent bitmap on window

Postby byte-one » 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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Transparent bitmap on window

Postby byte-one » 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!?

Image
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Transparent bitmap on window

Postby ukoenig » Thu Feb 12, 2009 1: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.

Image

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

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Transparent bitmap on window

Postby ukoenig » Thu Feb 12, 2009 9: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 )

Image

You can add a shadow
Image

Creating a RED Shadow
Image

Code: Select all  Expand view
...
...

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 :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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Transparent bitmap on window

Postby byte-one » 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
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Transparent bitmap on window

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41405
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 31 guests