Page 1 of 1
Show an gdi trasparency
Posted: Thu Oct 17, 2019 11:02 am
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
Re: Show an gdi trasparency
Posted: Thu Oct 17, 2019 2:13 pm
by ukoenig
Silvio,
images on any background color, gradient, brush or image
I think sample 1 You are looking for ( with border =
)
regards
Uwe
Re: Show an gdi trasparency
Posted: Thu Oct 17, 2019 2:22 pm
by Silvio.Falconi
wich command you use to show an image on another image with gdi commands ?
Re: Show an gdi trasparency
Posted: Thu Oct 17, 2019 2:32 pm
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
Re: Show an gdi trasparency
Posted: Thu Oct 17, 2019 3:06 pm
by Silvio.Falconi
not use
LOCAL oPen := Pen():New( 255, 0, 0, 255 )
oPen:SetInset( )
for trasparency ???
???
Re: Show an gdi trasparency
Posted: Thu Oct 17, 2019 3:12 pm
by ukoenig
Silvio,
pen is only used for border-drawing.
regards
Uwe