Show an gdi trasparency

Show an gdi trasparency

Postby Silvio.Falconi » Thu Oct 17, 2019 11:02 am

I wish use GDI
how I can make to show and image Png trasparent on a Bitmap or Jpg ?
can Have a sample please
type

@ 10,072 BITMAP oBmp File "" size 50, 100 pixel // NOBORDER

oPen := Pen():New( 255, 0, 0, 255 ) // nTransparency, nRed, nGreen, nBlue
oImage1:= GDIBmp():new("sample.png" )
hDC[1]:= oBmp:GetDc()
oGraphics[1] := Graphics():New( hDC[1] )
n9:= -73
oGraphics[1]:DrawImage( oImage1 , 1, n9 )

if I use a sample.png with trasparency then I saw bad on the screen
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7074
Joined: Thu Oct 18, 2012 7:17 pm

Re: Show an gdi trasparency

Postby ukoenig » Thu Oct 17, 2019 2:13 pm

Silvio,

images on any background color, gradient, brush or image
I think sample 1 You are looking for ( with border = :?: )

Image

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

Re: Show an gdi trasparency

Postby Silvio.Falconi » Thu Oct 17, 2019 2:22 pm

wich command you use to show an image on another image with gdi commands ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7074
Joined: Thu Oct 18, 2012 7:17 pm

Re: Show an gdi trasparency

Postby ukoenig » Thu Oct 17, 2019 2:32 pm

Try this ( NO border )

c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_Path + "IMAGES\"

FUNCTION DRAWIMAGE( oWnd )
LOCAL oGraphics1 := Graphics():New( oWnd:hDC )
LOCAL oGraphics2 := Graphics():New( oWnd:hDC )
LOCAL oImage1 := GDIBmp():new( c_path1 + "Logo.png" )
LOCAL oImage2 := GDIBmp():new( c_path1 + "Olga.jpg" )

//nTop := aRect[ 1 ]
//nLeft := aRect[ 2 ]
//nBottom := aRect[ 3 ]
//nRight := aRect[ 4 ]

// calculate or define the position from the calling window or dialog :!:

// Olga -> top, left, img-width ( resized with factor ), img-height ( resized with factor )
oGraphics1:DrawImage( oImage2, aRect[1] + 150, aRect[2] + 470, oImage2:GetWidth() * 0.5, oImage2:GetHeight() * 0.5 )
// Logo oImage1 draw on top of oImage2
oGraphics2:DrawImage( oImage1, aRect[1] + 250, aRect[2] + 520, oImage1:GetWidth() * 0.3, oImage1:GetHeight() * 0.3 )

oGraphics1:Destroy()
oGraphics2:Destroy()

oImage1:End()
oImage2:End()

RETURN NIL


regards
Uwe :D
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: Show an gdi trasparency

Postby Silvio.Falconi » Thu Oct 17, 2019 3:06 pm

not use
LOCAL oPen := Pen():New( 255, 0, 0, 255 )
oPen:SetInset( )

for trasparency ???
???
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7074
Joined: Thu Oct 18, 2012 7:17 pm

Re: Show an gdi trasparency

Postby ukoenig » Thu Oct 17, 2019 3:12 pm

Silvio,

pen is only used for border-drawing.

regards
Uwe :D
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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 34 guests