Show an gdi trasparency

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Show an gdi trasparency

Post by Silvio.Falconi »

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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Show an gdi trasparency

Post by ukoenig »

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
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Show an gdi trasparency

Post by Silvio.Falconi »

wich command you use to show an image on another image with gdi commands ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Show an gdi trasparency

Post by ukoenig »

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
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Show an gdi trasparency

Post by Silvio.Falconi »

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

for trasparency ???
???
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Show an gdi trasparency

Post by ukoenig »

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.
Post Reply