GDIPLUSDRAWIMAGE

GDIPLUSDRAWIMAGE

Postby Silvio.Falconi » Mon Jan 11, 2016 1:08 pm

I use to show an png file with GDIPLUS

oGraphics:DrawImage( )

How set the image (png) transparent with this function ?
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: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDIPLUSDRAWIMAGE

Postby ukoenig » Mon Jan 11, 2016 5:29 pm

Silvio,

be sure the PNG is ALPHABLENDED-image
Transparent is auto-detected.

tested with sample Gdiplus3.prg

Image

function DrawImage(ownd)
local hdc:= oWnd:getdc()
local oGraphics := Graphics():New( ownd:hDC )
local oImage:= GDIBmp():new("C:\fwh\bitmaps\pngs\Logo.png" ) // added image logo.png

oGraphics:DrawImage( oImage , 60 ,60 )

oGraphics:destroy()
oWnd:releasedc()

Return nil


best 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: GDIPLUSDRAWIMAGE

Postby Silvio.Falconi » Mon Jan 11, 2016 8:00 pm

please
here not run !!!
my code
Code: Select all  Expand view

#include "FiveWin.ch"
#include "constant.ch"

static oWnd,oBmp



Function Main()



  DEFINE BITMAP oBmp FILENAME ".\bitmaps\cucina.bmp"
  DEFINE WINDOW oWnd  FROM 10, 10 TO 48,110 TITLE "SLOT 5 REELS"  STYLE WS_POPUP

  DrawImage(oBmp)


  ACTIVATE WINDOW oWnd ;
    on init DrawImage(oWnd)  
return nil

 function DrawImage(ownd)
local hdc:= oWnd:getdc()
local oGraphics := Graphics():New( ownd:hDC )
local oImage:= GDIBmp():new(,"cuoco" ) // added image logo.png

oGraphics:DrawImage( oImage , 60 ,60 )

oGraphics:destroy()
oWnd:releasedc()

Return nil
   







2 problem
can I use a png to create a button transparent round ( on another bitmaps ) ?

Image

the image of button is a png and the background is a bmp
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: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDIPLUSDRAWIMAGE

Postby Silvio.Falconi » Mon Jan 11, 2016 8:57 pm

THERE IS A BUG
IF i WRITE
local oImage:= GDIBmp():new(".\BITMAPS\WIN.PNG" ) RUN AND THE PNG IS TRANSPARENT

IF i WRITE

local oImage:= GDIBmp():new(,"WIN") // RESOURCE RUN BUT THE PNG IS NOT TRANSPARENT
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: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDIPLUSDRAWIMAGE

Postby ukoenig » Mon Jan 11, 2016 9:18 pm

Silvio,

the test => IMAGE on IMAGE

CLOSE with right mouseclick on window

Image

Download

http://www.pflegeplus.com/DOWNLOADS/Gdiplus1.zip

I will have a look at using resources

best 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: GDIPLUSDRAWIMAGE

Postby Silvio.Falconi » Mon Jan 11, 2016 9:52 pm

Dear Uwe,
can you sen dme an sample for a button round file png transparent ?
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: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDIPLUSDRAWIMAGE

Postby ukoenig » Mon Jan 11, 2016 11:11 pm

Silvio,

there is no difference to any other buttons
Do You need some templates to show / create Your own 3D-buttons ?

Image

best regards
Uwe :?:
Last edited by ukoenig on Tue Jan 12, 2016 1:37 pm, edited 1 time in total.
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: GDIPLUSDRAWIMAGE

Postby Silvio.Falconi » Tue Jan 12, 2016 8:02 am

Uwe,
I sent you the button file png
I insert a bmp into a window Main and I wish create button with Png transparent
but it show button not transparent I not Know Why
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: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDIPLUSDRAWIMAGE

Postby ukoenig » Tue Jan 12, 2016 1:37 pm

Silvio,

have a look at Your Emails

Extended :

Image

best 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: GDIPLUSDRAWIMAGE

Postby Silvio.Falconi » Wed Jan 13, 2016 11:58 am

Incredible...
On win xp I not see any background png file ...Why ?

and the buttons png are bad showed (paytable red buttin and spin green button)

I see only the my reels obiects good

Image


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

DEFINE FONT ofont NAME "arial" SIZE 0,-80 BOLD

DEFINE BITMAP oBackground FILENAME c_path1 + "Background.png"

DEFINE WINDOW oWnd FROM 10, 10 TO 48,110


ACTIVATE WINDOW oWnd ;
ON PAINT ( ABPaint( hDC, 50, 10, oBackground:hBitmap, 255 ) )
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: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDIPLUSDRAWIMAGE

Postby ukoenig » Wed Jan 13, 2016 1:29 pm

Silvio

DEFINE BITMAP oBackground FILENAME c_path1 + "Background.png"

use :

DEFINE IMAGE oBackground FILENAME c_path1 + "Background.png"

NOT BITMAP !

best 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: GDIPLUSDRAWIMAGE

Postby Silvio.Falconi » Wed Jan 13, 2016 4:32 pm

Uwe,
I tried also on win 7 64 bit
and with
DEFINE IMAGE oBackground FILENAME c_path1 + "Background.png"
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: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDIPLUSDRAWIMAGE

Postby Silvio.Falconi » Wed Jan 13, 2016 5:19 pm

I tried to recompile your test but I have some errors

Code: Select all  Expand view
G:\Gdiplus_2>if not exist obj md obj

G:\Gdiplus_2>c:\work\bcc582\bin\make -f TESTGDI.rmk
MAKE Version 5.2  Copyright (c) 1987, 2000 Borland
    echo off
    echo c:\work\bcc582\bin\c0w32.obj + > b32.bc
    echo obj\TESTGDI.obj, + >> b32.bc
    echo TESTGDI.exe, + >> b32.bc
    echo TESTGDI.map, + >> b32.bc
    echo c:\work\fwh\lib\Fivehx.lib + >> b32.bc
    echo c:\work\fwh\lib\FiveHC.lib + >> b32.bc
    echo c:\work\xharbour\lib\rtl.lib + >> b32.bc
    echo c:\work\xharbour\lib\vm.lib + >> b32.bc
    echo c:\work\xharbour\lib\GTcgi.lib + >> b32.bc
    echo c:\work\xharbour\lib\GTgui.lib + >> b32.bc
    echo c:\work\xharbour\lib\GTpca.lib + >> b32.bc
    echo c:\work\xharbour\lib\GTstd.lib + >> b32.bc
    echo c:\work\xharbour\lib\GTwin.lib + >> b32.bc
    echo c:\work\xharbour\lib\GTwvt.lib + >> b32.bc
    echo c:\work\xharbour\lib\gtgui.lib + >> b32.bc
    echo c:\work\xharbour\lib\lang.lib + >> b32.bc
    echo c:\work\xharbour\lib\macro.lib + >> b32.bc
    echo c:\work\xharbour\lib\rdd.lib + >> b32.bc
    echo c:\work\xharbour\lib\dbfntx.lib + >> b32.bc
    echo c:\work\xharbour\lib\dbfcdx.lib + >> b32.bc
    echo c:\work\xharbour\lib\dbffpt.lib + >> b32.bc
    echo c:\work\xharbour\lib\hbsix.lib + >> b32.bc
    echo c:\work\xharbour\lib\debug.lib + >> b32.bc
    echo c:\work\xharbour\lib\common.lib + >> b32.bc
    echo c:\work\xharbour\lib\pp.lib + >> b32.bc
    echo c:\work\xharbour\lib\codepage.lib + >> b32.bc
    echo c:\work\xharbour\lib\pcrepos.lib + >> b32.bc
    echo c:\work\xharbour\lib\ct.lib + >> b32.bc
    echo c:\work\xharbour\lib\hbzip.lib + >> b32.bc
    echo c:\work\xharbour\lib\zlib.lib + >> b32.bc
    echo c:\work\xharbour\lib\libmisc.lib + >> b32.bc
    echo c:\work\xharbour\lib\tip.lib + >> b32.bc
    echo c:\work\xharbour\lib\png.lib + >> b32.bc
    echo c:\work\bcc582\lib\cw32.lib + >> b32.bc
    echo c:\work\bcc582\lib\import32.lib + >> b32.bc
    echo c:\work\bcc582\lib\uuid.lib + >> b32.bc
    echo c:\work\bcc582\lib\psdk\odbc32.lib + >> b32.bc
    echo c:\work\bcc582\lib\psdk\rasapi32.lib + >> b32.bc
    echo c:\work\bcc582\lib\psdk\nddeapi.lib + >> b32.bc
    echo c:\work\bcc582\lib\psdk\msimg32.lib + >> b32.bc
    echo c:\work\bcc582\lib\psdk\iphlpapi.lib + >> b32.bc
    echo c:\work\bcc582\lib\psdk\gdiplus.lib + >> b32.bc
    echo c:\work\bcc582\lib\psdk\psapi.lib, >> b32.bc
    echo c:\work\bcc582\lib\PSDK\shell32.lib + >> b32.bc
    IF EXIST TESTGDI.res echo TESTGDI.res >> b32.bc
    c:\work\bcc582\bin\ilink32 -Gn -aa -Tpe -s -v @b32.bc
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external 'SHCreateDirectoryExA' referenced from C:\WORK\FWH\LIB\FIVEHC.LIB|MKDIR
Error: Unresolved external '_HB_FUN_HB_NUMTOHEX' referenced from C:\WORK\FWH\LIB\FIVEHX.LIB|TGDIPLUS
RLINK32: Unsupported 16bit resource in file "C:\WORK\BCC582\LIB\PSDK\SHELL32.LIB"
Error: Unknown RLINK32 error

** error 2 ** deleting TESTGDI.exe





I allready use borland 582 perhaps I need the 63 version ?

I have a error on shell32 it found resources 16 bit

then I have these errors
Error: Unresolved external 'SHCreateDirectoryExA' referenced from C:\WORK\FWH\LIB\FIVEHC.LIB|MKDIR
Error: Unresolved external '_HB_FUN_HB_NUMTOHEX' referenced from C:\WORK\FWH\LIB\FIVEHX.LIB|TGDIPLUS
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: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDIPLUSDRAWIMAGE

Postby ukoenig » Wed Jan 13, 2016 11:38 pm

Silvio,

I compared the rmk-file with the FWH -rmk-samples

It works now with all tested borland-versions
bcc63, bcc65 and bcc82

the 16 bit error belongs to a wrong icon-file ( favorite.ico with 8 bpp )
converted to 24 bpp it is working

Code: Select all  Expand view

#Borland make sample, (c) FiveTech Software 2005

HBDIR=i:\xharbour

#BCDIR=i:\bcc63
#BCDIR=i:\bcc65
BCDIR=i:\bcc82

FWDIR=i:\fwh

.path.OBJ = .\obj
.path.PRG = .\
.path.CH  = $(FWDIR)\include;$(HBDIR)\include
.path.C   = .\
.path.rc  = .\

PRG = \
TESTGDI.PRG

# C =          \
# two.C                

PROJECT    : TESTGDI.exe

TESTGDI.exe  : $(PRG:.PRG=.OBJ)   $(C:.C=.OBJ) TESTGDI.res
    echo off
    echo $(BCDIR)\bin\c0w32.obj + > b32.bc

# OBJ-Liste
# -------------
   echo obj\TESTGDI.obj, + >> b32.bc

  echo TESTGDI.exe, + >> b32.bc
  echo TESTGDI.map, + >> b32.bc

# Fivewin Lib`s für xHARBOUR
# --------------------------------------

  echo $(FWDIR)\lib\Fivehx.lib + >> b32.bc
  echo $(FWDIR)\lib\FiveHC.lib + >> b32.bc
   
# xHARBOUR-Lib`s
# -----------------------

  echo $(HBDIR)\lib\rtl.lib + >> b32.bc
  echo $(HBDIR)\lib\vm.lib + >> b32.bc
  echo $(HBDIR)\lib\GTcgi.lib + >> b32.bc
  echo $(HBDIR)\lib\GTgui.lib + >> b32.bc
  echo $(HBDIR)\lib\GTpca.lib + >> b32.bc
  echo $(HBDIR)\lib\GTstd.lib + >> b32.bc
  echo $(HBDIR)\lib\GTwin.lib + >> b32.bc
  echo $(HBDIR)\lib\GTwvt.lib + >> b32.bc
  echo $(HBDIR)\lib\gtgui.lib + >> b32.bc
  echo $(HBDIR)\lib\lang.lib + >> b32.bc
  echo $(HBDIR)\lib\macro.lib + >> b32.bc
  echo $(HBDIR)\lib\rdd.lib + >> b32.bc
  echo $(HBDIR)\lib\dbfntx.lib + >> b32.bc
  echo $(HBDIR)\lib\dbfcdx.lib + >> b32.bc
  echo $(HBDIR)\lib\dbffpt.lib + >> b32.bc
  echo $(HBDIR)\lib\hbsix.lib + >> b32.bc
  echo $(HBDIR)\lib\debug.lib + >> b32.bc
  echo $(HBDIR)\lib\common.lib + >> b32.bc
  echo $(HBDIR)\lib\pp.lib + >> b32.bc
  echo $(HBDIR)\lib\codepage.lib + >> b32.bc
  echo $(HBDIR)\lib\pcrepos.lib + >> b32.bc
  echo $(HBDIR)\lib\ct.lib + >> b32.bc
  echo $(HBDIR)\lib\hbzip.lib + >> b32.bc
  echo $(HBDIR)\lib\zlib.lib + >> b32.bc
  echo $(HBDIR)\lib\libmisc.lib + >> b32.bc
  echo $(HBDIR)\lib\tip.lib + >> b32.bc
  echo $(HBDIR)\lib\png.lib + >> b32.bc

# Uncomment these two TESTGDI to use Advantage RDD
# echo $(HBDIR)\lib\rddads.lib + >> b32.bc
# echo $(HBDIR)\lib\Ace32.lib + >> b32.bc

  echo $(BCDIR)\lib\cw32.lib + >> b32.bc
  echo $(BCDIR)\lib\import32.lib + >> b32.bc
  echo $(BCDIR)\lib\uuid.lib + >> b32.bc
  echo $(BCDIR)\lib\psdk\odbc32.lib + >> b32.bc
  echo $(BCDIR)\lib\psdk\rasapi32.lib + >> b32.bc
  echo $(BCDIR)\lib\psdk\nddeapi.lib + >> b32.bc
  echo $(BCDIR)\lib\psdk\msimg32.lib + >> b32.bc
  echo $(BCDIR)\lib\psdk\iphlpapi.lib + >> b32.bc
  echo $(BCDIR)\lib\psdk\gdiplus.lib + >> b32.bc
  echo $(BCDIR)\lib\psdk\psapi.lib + >> b32.bc
  echo $(BCDIR)\lib\psdk\iphlpapi.lib + >> b32.bc
  echo $(BCDIR)\lib\psdk\shell32.lib, >> b32.bc

  IF EXIST TESTGDI.res echo TESTGDI.res >> b32.bc
     $(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s -v @b32.bc
  #   $(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s @b32.bc
  del b32.bc

.PRG.OBJ:
  $(HBDIR)\bin\harbour $< /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include > clip.log
  $(BCDIR)\bin\bcc32 -c -tWM -I$(HBDIR)\include -oobj\$& obj\$&.c

.C.OBJ:
  echo -c -tWM -D__HARBOUR__ -DHB_API_MACROS > tmp
  echo -I$(HBDIR)\include;$(FWDIR)\include >> tmp
  $(BCDIR)\bin\bcc32 -oobj\$& @tmp $&.c
  del tmp

TESTGDI.res : TESTGDI.rc
  $(BCDIR)\bin\brc32.exe -r TESTGDI.rc
 
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: Google [Bot] and 81 guests