2007-04-14 13:36 UTC+0200 Francesco Saverio Giudice (info/at/fsgiudice.com)

* harbour/bin/bld.bat
     * added HB_USER_LIB var to bcc link line to make usable bldtest.bat
       Question: Is there a way to build from bcc adding contrib libs ?

   - harbour/contrib/gd/hbgd.txt
   + harbour/contrib/gd/doc/hbgd.txt
     * moved in doc dir

   + harbour/contrib/gd/doc/COPYING
     + gd copyright text (it's free for any use, but this file has to be
                          reported)

   + harbour/contrib/gd/include/entities.h
   + harbour/contrib/gd/include/gd.h
   + harbour/contrib/gd/include/gd_io.h
   + harbour/contrib/gd/include/gdcache.h
   + harbour/contrib/gd/include/gdfontg.h
   + harbour/contrib/gd/include/gdfontl.h
   + harbour/contrib/gd/include/gdfontmb.h
   + harbour/contrib/gd/include/gdfonts.h
   + harbour/contrib/gd/include/gdfontt.h
   + harbour/contrib/gd/include/gdfx.h
   + harbour/contrib/gd/include/gdhelpers.h
   + harbour/contrib/gd/include/jisx0208.h
   + harbour/contrib/gd/include/wbmp.h
     + include files for compiling in windows environment

   + harbour/contrib/gd/tests/digits/57chevy.gif
   + harbour/contrib/gd/tests/digits/7seg.gif
   + harbour/contrib/gd/tests/digits/brsd.gif
   + harbour/contrib/gd/tests/digits/digib.gif
   + harbour/contrib/gd/tests/digits/fdb.gif
   + harbour/contrib/gd/tests/digits/jelly.gif
   + harbour/contrib/gd/tests/digits/odb.gif
   + harbour/contrib/gd/tests/digits/odw.gif
   + harbour/contrib/gd/tests/digits/pdg.gif
   + harbour/contrib/gd/tests/digits/pdw.gif
     + digits images for counter.prg sample

   + harbour/contrib/gd/gdexternal.ch
     + external declarations for use with linker

   + harbour/contrib/gd/make_b32.bat
   + harbour/contrib/gd/makefile.bc
   + harbour/contrib/gd/tests/bldtest.bat
   + harbour/contrib/gd/tests/bldtest.sh
     + make files

   * harbour/contrib/gd/tests/images_in/conv_test.jpeg
   * harbour/contrib/gd/tests/images_in/gdlogobig.png
   * harbour/contrib/gd/tests/images_in/theclipper.gif
     * updated images (I got them corrupted, probably is CVS ?)

   * harbour/contrib/gd/README
   * harbour/contrib/gd/gd.prg
   * harbour/contrib/gd/gdbar.prg
   * harbour/contrib/gd/gdbarcod.prg
   * harbour/contrib/gd/gdchart.prg
   * harbour/contrib/gd/gdimage.prg
   * harbour/contrib/gd/gdwrp.c
   * harbour/contrib/gd/tests/animgif.prg
   * harbour/contrib/gd/tests/antialiased.prg
   * harbour/contrib/gd/tests/barms.prg
   * harbour/contrib/gd/tests/bartest.prg
   * harbour/contrib/gd/tests/counter.prg
   * harbour/contrib/gd/tests/gdtestcls.prg
   * harbour/contrib/gd/tests/test_out.prg
   * harbour/contrib/gd/tests/testdpi.prg
   * harbour/contrib/gd/tests/tostring.prg
     * fixed hbgd files

     ! Please test in other environment.
       I have built harbour as downloaded from CVS,
       no HB_COMPAT_XHB defined
This commit is contained in:
Francesco Saverio Giudice
2007-04-14 11:37:18 +00:00
parent 56267f28dd
commit 2373b7f087
51 changed files with 3899 additions and 130 deletions

View File

@@ -8,6 +8,83 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-04-14 13:36 UTC+0200 Francesco Saverio Giudice (info/at/fsgiudice.com)
* harbour/bin/bld.bat
* added HB_USER_LIB var to bcc link line to make usable bldtest.bat
Question: Is there a way to build from bcc adding contrib libs ?
- harbour/contrib/gd/hbgd.txt
+ harbour/contrib/gd/doc/hbgd.txt
* moved in doc dir
+ harbour/contrib/gd/doc/COPYING
+ gd copyright text (it's free for any use, but this file has to be
reported)
+ harbour/contrib/gd/include/entities.h
+ harbour/contrib/gd/include/gd.h
+ harbour/contrib/gd/include/gd_io.h
+ harbour/contrib/gd/include/gdcache.h
+ harbour/contrib/gd/include/gdfontg.h
+ harbour/contrib/gd/include/gdfontl.h
+ harbour/contrib/gd/include/gdfontmb.h
+ harbour/contrib/gd/include/gdfonts.h
+ harbour/contrib/gd/include/gdfontt.h
+ harbour/contrib/gd/include/gdfx.h
+ harbour/contrib/gd/include/gdhelpers.h
+ harbour/contrib/gd/include/jisx0208.h
+ harbour/contrib/gd/include/wbmp.h
+ include files for compiling in windows environment
+ harbour/contrib/gd/tests/digits/57chevy.gif
+ harbour/contrib/gd/tests/digits/7seg.gif
+ harbour/contrib/gd/tests/digits/brsd.gif
+ harbour/contrib/gd/tests/digits/digib.gif
+ harbour/contrib/gd/tests/digits/fdb.gif
+ harbour/contrib/gd/tests/digits/jelly.gif
+ harbour/contrib/gd/tests/digits/odb.gif
+ harbour/contrib/gd/tests/digits/odw.gif
+ harbour/contrib/gd/tests/digits/pdg.gif
+ harbour/contrib/gd/tests/digits/pdw.gif
+ digits images for counter.prg sample
+ harbour/contrib/gd/gdexternal.ch
+ external declarations for use with linker
+ harbour/contrib/gd/make_b32.bat
+ harbour/contrib/gd/makefile.bc
+ harbour/contrib/gd/tests/bldtest.bat
+ harbour/contrib/gd/tests/bldtest.sh
+ make files
* harbour/contrib/gd/tests/images_in/conv_test.jpeg
* harbour/contrib/gd/tests/images_in/gdlogobig.png
* harbour/contrib/gd/tests/images_in/theclipper.gif
* updated images (I got them corrupted, probably is CVS ?)
* harbour/contrib/gd/README
* harbour/contrib/gd/gd.prg
* harbour/contrib/gd/gdbar.prg
* harbour/contrib/gd/gdbarcod.prg
* harbour/contrib/gd/gdchart.prg
* harbour/contrib/gd/gdimage.prg
* harbour/contrib/gd/gdwrp.c
* harbour/contrib/gd/tests/animgif.prg
* harbour/contrib/gd/tests/antialiased.prg
* harbour/contrib/gd/tests/barms.prg
* harbour/contrib/gd/tests/bartest.prg
* harbour/contrib/gd/tests/counter.prg
* harbour/contrib/gd/tests/gdtestcls.prg
* harbour/contrib/gd/tests/test_out.prg
* harbour/contrib/gd/tests/testdpi.prg
* harbour/contrib/gd/tests/tostring.prg
* fixed hbgd files
! Please test in other environment.
I have built harbour as downloaded from CVS,
no HB_COMPAT_XHB defined
2007-04-14 12:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* harbour/include/hbstdgen.ch
* harbour/include/box.ch
@@ -49,9 +126,9 @@
* harbour/source/vm/harbinit.prg
* harbour/utils/hbrun/external.prg
* harbour/utils/hbtest/rt_main.ch
+ Following #defines are now available by default without
the need to #include "hbsetup.ch". These are of course
also available for applications as defined at Harbour
+ Following #defines are now available by default without
the need to #include "hbsetup.ch". These are of course
also available for applications as defined at Harbour
build time:
HB_EXTENSION
HB_C52_UNDOC
@@ -76,15 +153,15 @@
Question: What does HB_NO_READDBG do?
* harbour/source/rtl/tget.prg
! Removed :Assign() call from :UpdateBuffer() to close
! Removed :Assign() call from :UpdateBuffer() to close
the functionality to CA-Cl*pper.
2007-04-13 19:05 UTC+0200 Lorenzo Fiorini (lorenzo.fiorini/at/gmail.com)
* harbour/include/Makefile
! added install of hbcompat.ch
* harbour/source/debug/dbgtarr.prg
* harbour/source/debug/dbgtobj.prg
* harbour/source/debug/dbgthsh.prg
* harbour/source/debug/dbgtobj.prg
* harbour/source/debug/dbgthsh.prg
* added missed #ifndef HB_NO_READDBG
2007-04-13 18:43 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
@@ -105,14 +182,14 @@
2007-04-13 17:38 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* harbour/source/rtl/tget.prg
! Get method UpdateBuffer() fixed to be effective only
when the object has focus (as per the C52 docs and
! Get method UpdateBuffer() fixed to be effective only
when the object has focus (as per the C52 docs and
Lorenzo's report).
2007-04-13 12:18 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* harbour/source/debug/debugger.prg
! Fixed a few compile errors.
! Reapplied (and extended) a former fix regarding
! Reapplied (and extended) a former fix regarding
the proper handling of the filenames.
* harbour/source/rtl/tbrowse.prg
@@ -128,12 +205,12 @@
* harbour/source/debug/dbgtarr.prg
* harbour/source/debug/dbgtmenu.prg
* harbour/source/debug/dbgtmitm.prg
* harbour/source/debug/dbgtobj.prg
* harbour/source/debug/dbgtwin.prg
* harbour/source/debug/dbgwa.prg
* harbour/source/debug/debugger.prg
+ harbour/source/debug/dbgaltd.prg
+ harbour/source/debug/dbgthsh.prg
* harbour/source/debug/dbgtobj.prg
* harbour/source/debug/dbgtwin.prg
* harbour/source/debug/dbgwa.prg
* harbour/source/debug/debugger.prg
+ harbour/source/debug/dbgaltd.prg
+ harbour/source/debug/dbgthsh.prg
* debugger code borrowed from xHarbour
+ harbour/include/hbcompat.ch
* xHarbour compatibility defines
@@ -310,12 +387,12 @@
* harbour/source/codepage/Makefile
* harbour/source/codepage/cphu852.c
+ harbour/source/codepage/cphu852s.c
! Default Hungarian 852 codepage made 100% compatible with
! Default Hungarian 852 codepage made 100% compatible with
ntxhu852.obj for CA-Cl*pper 5.x.
+ Added Hungarian 852 codepage 100% compatible with
+ Added Hungarian 852 codepage 100% compatible with
sixhu852.obj for S*ccessWare SIx Driver.
(this was formerly used as the default Hungarian 852
codepage for Harbour, the only change now is the ID and
(this was formerly used as the default Hungarian 852
codepage for Harbour, the only change now is the ID and
comment cleanup.)
2007-04-10 11:20 UTC+0200 Lorenzo Fiorini (lorenzo.fiorini/at/gmail.com)
@@ -328,9 +405,9 @@
* harbour/source/rtl/persist.prg
* harbour/source/rtl/tbrowse.prg
* harbour/source/rtl/teditor.prg
% Replaced __StrT*() internal functions with native Harbour
% Replaced __StrT*() internal functions with native Harbour
extensions hb_Token*().
% Removed workarounds for problems with the previous implementation
% Removed workarounds for problems with the previous implementation
of the __StrT*() functions.
Please test TEditor (all) and TBrowse class (header/footer line splitting).
@@ -515,13 +592,13 @@
2007-04-01 16:56 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* harbour/source/rtl/tgetlist.prg
! Fixed bug #1692268. The fix simply removes two strange lines
! Fixed bug #1692268. The fix simply removes two strange lines
of code which tried to modify the internal TGet() var "Type",
after it read the value contained in the TGet(). Since this would
be the job of TGet() alone, and Type() is not an assignable
var in CA-Cl*pper, it very much looks like a workaround
for something (maybe a shortcoming of an earlier version of
TGet()). If anyone knows what was to be achieved with that,
after it read the value contained in the TGet(). Since this would
be the job of TGet() alone, and Type() is not an assignable
var in CA-Cl*pper, it very much looks like a workaround
for something (maybe a shortcoming of an earlier version of
TGet()). If anyone knows what was to be achieved with that,
pls shout.
2007-04-01 13:47 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
@@ -544,7 +621,7 @@
+ harbour/contrib/samples/make_b32.bat
+ harbour/contrib/samples/make_vc.bat
- harbour/contrib/samples/makevc.bat
+ -w default Harbour build switch changed to -w2,
+ -w default Harbour build switch changed to -w2,
to further maintain code quality.
; Notice that CONTRIB might need some fixing here.
+ Added proper BC/VC make batch files for "samples".
@@ -566,7 +643,7 @@
* harbour/utils/hbtest/rt_misc.prg
+ Added HB_SYMBOL_UNUSED() inside codeblocks.
! Removed a few uneeded codeblock parameters.
+ Added HB_SYMBOL_UNUSED() to some class syntax generated
+ Added HB_SYMBOL_UNUSED() to some class syntax generated
code to avoid unused "Self" var warnings.
* harbour/ChangeLog.017
@@ -1181,8 +1258,8 @@
#endif
2007-02-22 13:38 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* harbour/contrib/libct/makefile.bc
* harbour/contrib/libct/makefile.vc
* harbour/contrib/libct/makefile.bc
* harbour/contrib/libct/makefile.vc
! Synced with GNU makefile changes.
2007-02-22 08:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
@@ -1483,9 +1560,9 @@
2007-01-24 23:10 UTC+0200 Tomaz Zupan <tomaz.zupan@orpo.si>
* harbour.spec
* Aded Mandriva One distro to platforms
* Aded Mandriva One distro to platforms
* bin/hb-func.sh
* Aded Mandriva and Mandriva One distro to platforms
* Aded Mandriva and Mandriva One distro to platforms
2007-01-24 10:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/config/w32/bcc32.cf
@@ -1689,7 +1766,7 @@
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
+ added support for passing base value to FOR EACH by reference.
* harbour/source/vm/arrays.c
* use hb_itemMoveRef() in AINS()/ADEL() to avoid creation of cyclic
reference chains

View File

@@ -4,10 +4,10 @@ rem $Id$
rem
rem ---------------------------------------------------------------
rem This is a generic template file, if it doesn't fit your own needs
rem This is a generic template file, if it doesn't fit your own needs
rem please DON'T MODIFY IT.
rem
rem Instead, make a local copy and modify that one, or make a call to
rem Instead, make a local copy and modify that one, or make a call to
rem this batch file from your customized one. [vszakats]
rem ---------------------------------------------------------------
@@ -208,7 +208,7 @@ if not "%HB_ARCHITECTURE%" == "w32" goto A_OS2
if "%HB_GT_LIB%" == "" set _HB_GT_LIB=gtwin
if "%HB_COMPILER%" == "bcc32" bcc32 -O2 -d %CFLAGS% -I%HB_INC_INSTALL% -L%HB_LIB_INSTALL% %1.c codepage.lib debug.lib vm.lib rtl.lib %_HB_GT_LIB%.lib lang.lib rdd.lib macro.lib pp.lib dbffpt.lib dbfntx.lib dbfcdx.lib hbsix.lib common.lib
if "%HB_COMPILER%" == "bcc32" bcc32 -O2 -d %CFLAGS% -I%HB_INC_INSTALL% -L%HB_LIB_INSTALL% %1.c codepage.lib debug.lib vm.lib rtl.lib %_HB_GT_LIB%.lib lang.lib rdd.lib macro.lib pp.lib dbffpt.lib dbfntx.lib dbfcdx.lib hbsix.lib common.lib %HB_USER_LIBS%
if "%HB_COMPILER%" == "gcc" gcc %1.c -o%1.exe %CFLAGS% -I%HB_INC_INSTALL% -L%HB_LIB_INSTALL% -lcodepage -ldebug -lvm -lrtl -l%_HB_GT_LIB% -llang -lrdd -lrtl -lvm -lmacro -lpp -ldbffpt -ldbfntx -ldbfcdx -lhbsix -lcommon
if "%HB_COMPILER%" == "mingw32" gcc %1.c -o%1.exe %CFLAGS% -mno-cygwin -I%HB_INC_INSTALL% %HB_INC_TEMP% -L%HB_LIB_INSTALL% -lcodepage -ldebug -lvm -lrtl -l%_HB_GT_LIB% -llang -lrdd -lrtl -lvm -lmacro -lpp -ldbffpt -ldbfntx -ldbfcdx -lhbsix -lcommon

View File

@@ -15,9 +15,39 @@
hbgd library is a wrapper around www.libgd.org graphic library
FOLDERS
=======
Folder structure:
/
+- doc : help & license files
+- include : gd c include files
+- samples : samples folder
| |
| +- counter : a sample counter
|
+- tests : test files
|
+- digits : some digits images from
| http://www.digitmania.holowww.com/all.html
| for counter.prg test sample
+- images_in : sample images
+- images_out : output of test images
COMPILING
=========
Actually platforms supported are:
- Win32 / BCC32
- GNU systems / GCC
to build library on Win32 with BCC use:
Download bgd.dll from this link:
http://www.libgd.org/Downloads (Windows.DLL)
and put a copy of it in this folder and in tests folder
then
make_b32.bat
on GNU system use:
make install
@@ -39,4 +69,9 @@ test_out.prg is a sample of a cgi application for windows (I have to complete
antialiased.prg shows how apply anti-alias to lines.
animgif.prg is a sample to create an animated gif.
bartest.prg is a sample to create barcodes with GD Library.
counter.prg is sample applications of a graphic web counter.
to compile:
in Windows/BCC : bldtest.bat <app_without_prg_ext> (for full static)
in Linux : . bldtest.sh <app_without_prg_ext>

View File

@@ -0,0 +1,53 @@
Portions copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002 by Cold Spring Harbor Laboratory. Funded under Grant
P41-RR02188 by the National Institutes of Health.
Portions copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 by
Boutell.Com, Inc.
Portions relating to GD2 format copyright 1999, 2000, 2001, 2002
Philip Warner.
Portions relating to PNG copyright 1999, 2000, 2001, 2002 Greg
Roelofs.
Portions relating to gdttf.c copyright 1999, 2000, 2001, 2002 John
Ellson (ellson@lucent.com).
Portions relating to gdft.c copyright 2001, 2002 John Ellson
(ellson@lucent.com).
Portions copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Pierre-Alain Joye (pierre@libgd.org).
Portions relating to JPEG and to color quantization copyright 2000,
2001, 2002, Doug Becker and copyright (C) 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, Thomas G. Lane. This software is
based in part on the work of the Independent JPEG Group. See the
file README-JPEG.TXT for more information.
Portions relating to WBMP copyright 2000, 2001, 2002 Maurice
Szmurlo and Johan Van den Brande.
Permission has been granted to copy, distribute and modify gd in
any context without fee, including a commercial application,
provided that this notice is present in user-accessible supporting
documentation.
This does not affect your ownership of the derived work itself, and
the intent is to assure proper credit for the authors of gd, not to
interfere with your productive use of gd. If you have questions,
ask. "Derived works" includes all programs that utilize the
library. Credit must be given in user-accessible documentation.
This software is provided "AS IS." The copyright holders disclaim
all warranties, either express or implied, including but not
limited to implied warranties of merchantability and fitness for a
particular purpose, with respect to this code and accompanying
documentation.
Although their code does not appear in gd, the authors wish to thank
David Koblas, David Rowley, and Hutchison Avenue Software Corporation
for their prior contributions.

View File

@@ -139,6 +139,10 @@ FUNCTION gdImageFromFile( cFile )
LOCAL hFile := {=>}
LOCAL oImage
#if ( defined( __HARBOUR__ ) .and. !defined( HB_COMPAT_XHB ) )
HB_HAUTOADD( hFile, .T.)
#endif
IF File( cFile )
HB_FNameSplit( cFile, @cPath, @cName, @cExt, @cDrive )
//TraceLog( cFile, cPath, cName, cExt, cDrive )
@@ -234,6 +238,31 @@ PROCEDURE gdImageToFile( oImage, cFile )
RETURN
PROCEDURE gdImageToHandle( oImage, nHandle )
LOCAL cString, cExt
DEFAULT nHandle TO 1
//Tracelog( "oImage, oImage:ClassName, oImage:IsDerivedFrom( 'GDIMAGE' )", ;
// oImage, oImage:ClassName, oImage:IsDerivedFrom( 'GDIMAGE' ) )
IF ValType( oImage ) == "O" .AND. ( oImage:ClassName == "GDIMAGE" .OR. oImage:IsDerivedFrom( "GDIMAGE" ) )
WITH OBJECT oImage
IF :cType <> NIL
DO CASE
CASE :cType == "jpeg"
:OutputJpeg( nHandle )
CASE :cType == "gif"
:OutputGif( nHandle )
CASE :cType == "png"
:OutputPng( nHandle )
ENDCASE
ENDIF
END
ENDIF
RETURN
/*
////aRect := { 10, 40, 100, 40, 100, 20, 10, 20 } //Array(8)

View File

@@ -300,8 +300,13 @@ METHOD CheckCode() CLASS TBarCode
LOCAL i
For i := 1 To Len( ::text )
#if defined( __HARBOUR__ ) .and. !defined( HB_COMPAT_XHB )
If( !IsInt( ::CheckValInArray( SubStr( ::text, i, 1 ) ) ) )
::DrawError("Character "+SubStr( ::text, i, 1 )+" not allowed .")
#else
If( !IsInt( ::CheckValInArray( ::text[i] ) ) )
::DrawError("Character "+::text[i]+" not allowed .")
#endif
lRet := .F.
EndIf
Next
@@ -313,7 +318,11 @@ METHOD CheckValInArray(cchar) CLASS TBarCode
LOCAL npos
LOCAL uret
#if defined( __HARBOUR__ ) .and. !defined( HB_COMPAT_XHB )
npos := ASCAN( ::keys, { |x| SubStr( x, 1, 1 ) == cchar } )
#else
npos := ASCAN( ::keys, { |x| x[1]== cchar } )
#endif
If npos > 0
uret := npos
@@ -330,24 +339,47 @@ METHOD Finish( image_style, quality, nFG ) CLASS TBarCode
DEFAULT nFG TO {255,255,255}
If Empty( ::filename ) .OR. ::filename = NIL
::filename := ::text
EndIf
If image_style == IMG_FORMAT_PNG
// Output std handle == 1
::SavePng( ::filename )
//::filename := ::text
If image_style == IMG_FORMAT_PNG
Elseif image_style == IMG_FORMAT_JPEG
::OutputPng()
::Savejpeg( ::filename, quality )
Elseif image_style == IMG_FORMAT_JPEG
ElseIf image_style == IMG_FORMAT_WBMP
::OutputJpeg( , quality )
::SaveWBmp( ::filename, nFG )
ElseIf image_style == IMG_FORMAT_WBMP
ElseIf image_style == IMG_FORMAT_GIF
::OutputWBmp( , nFG )
::SaveGif( ::filename )
ElseIf image_style == IMG_FORMAT_GIF
::OutputGif()
EndIf
else
If image_style == IMG_FORMAT_PNG
::SavePng( ::filename )
Elseif image_style == IMG_FORMAT_JPEG
::Savejpeg( ::filename, quality )
ElseIf image_style == IMG_FORMAT_WBMP
::SaveWBmp( ::filename, nFG )
ElseIf image_style == IMG_FORMAT_GIF
::SaveGif( ::filename )
EndIf
EndIf

View File

@@ -175,7 +175,7 @@ METHOD Draw( cText ) CLASS TCode
::DrawI25( cText )
endif
Return NIL
Return NIL
METHOD Draw13(cText) CLASS TCode
@@ -215,7 +215,11 @@ METHOD Draw13(cText) CLASS TCode
// If we have to write text, we moved the barcode to the right to have space to put digit
::positionX = If( ::textfont == 0 , 0, 10 )
#if defined( __HARBOUR__ ) .and. !defined( HB_COMPAT_XHB )
xParity := ::Parity[ Val( SubStr( ::text, 1, 1 ) ) ]
#else
xParity := ::Parity[ Val( ::text[1] ) ]
#endif
// First Bar
::positionX := 10
@@ -405,7 +409,7 @@ METHOD DrawText8() CLASS TCode
Return NIL
METHOD FIndCharCode( cstring, cchar ) CLASS TCode
METHOD FindCharCode( cstring, cchar ) CLASS TCode
LOCAL i
LOCAL nC := 0
@@ -457,24 +461,42 @@ METHOD Draw128( cText, cModeCode ) CLASS TCode
If cModeCode == "C"
#if defined( __HARBOUR__ ) .and. !defined( HB_COMPAT_XHB )
npos := AsCAn( ::KeysmodeC, { |x| x == SubStr( ::Text, i, 1 ) + SubStr( ::Text, i+1, 1 ) } )
#else
npos := AsCAn( ::KeysmodeC, { |x| x ==::Text[i]+::Text[i+1] } )
#endif
If npos == 0
::DrawError("With Code C, you must provide always pair of two integers. Char "+::text[i]+::text[i+1]+" not allowed." )
lerror := .T.
EndIf
#if defined( __HARBOUR__ ) .and. !defined( HB_COMPAT_XHB )
::DrawError("With Code C, you must provide always pair of two integers. Char "+SubStr( ::text, i, 1 )+SubStr( ::text, i+1, 1 )+" not allowed." )
#else
::DrawError("With Code C, you must provide always pair of two integers. Char "+::text[i]+::text[i+1]+" not allowed." )
#endif
lerror := .T.
EndIf
ElseIf cModeCode == "B"
If ::FIndCharCode( ::KeysmodeB, ::Text[i] ) == 0
#if defined( __HARBOUR__ ) .and. !defined( HB_COMPAT_XHB )
If ::FindCharCode( ::KeysmodeB, SubStr( ::Text, i, 1 ) ) == 0
::DrawError('Char '+ SubStr( ::text, i, 1 )+" not allowed.")
#else
If ::FindCharCode( ::KeysmodeB, ::Text[i] ) == 0
::DrawError('Char '+::text[i]+" not allowed.")
#endif
lerror = .T.
EndIf
ElseiF cModeCode == "A"
If ::FIndCharCode( ::KeysmodeA, ::text[i] ) == 0
#if defined( __HARBOUR__ ) .and. !defined( HB_COMPAT_XHB )
If ::FindCharCode( ::KeysmodeA, SubStr( ::text, i, 1 ) ) == 0
::DrawError('Char '+ SubStr( ::text, i, 1 ) +" not allowed.")
#else
If ::FindCharCode( ::KeysmodeA, ::text[i] ) == 0
::DrawError('Char '+::text[i]+" not allowed.")
#endif
lerror := .T.
EndIf
@@ -577,7 +599,7 @@ METHOD Draw128( cText, cModeCode ) CLASS TCode
next
nSum := nSum%103 +1
cconc := cconc + ::aCode[ nSum ] +::aCode[107]
cconc := cconc + ::aCode[ nSum ] +::aCode[107]
For n:=1 To Len(cconc) STEP 2
cBarCode +=Replicate('1', Val( Substr( cconc, n,1 ) ) )
@@ -647,7 +669,7 @@ Return NIL
*/
METHOD MixCode(value) CLASS TCode
LOCAL l,i,k
LOCAL l,i,k
LOCAL s
LOCAL bar_string := ""
LOCAL cfirst

View File

@@ -89,6 +89,12 @@ CLASS GDChart FROM GDImage
METHOD HorizontalBarChart()
METHOD LineChart()
// clone method for gdchart
METHOD Clone()
PROTECTED:
METHOD CloneDataFrom()
ENDCLASS
METHOD New( sx, sy ) CLASS GDChart
@@ -98,7 +104,7 @@ METHOD New( sx, sy ) CLASS GDChart
::cTitle := "Chart"
::aSeries := {}
::hDefs := Hash()
::hDefs := {=>}
::aDataOfHashes := {}
::Create( sx, sy )
@@ -118,7 +124,11 @@ RETURN Self
METHOD AddDef( cDefKey, xDefVal ) CLASS GDChart
IF ValType( cDefKey ) == "C"
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
hSet( ::hDefs, Upper( cDefKey ), xDefVal )
#else
HB_hSet( ::hDefs, Upper( cDefKey ), xDefVal )
#endif
ENDIF
RETURN Self
@@ -332,7 +342,11 @@ METHOD VerticalBarChart() CLASS GDChart
nMaxLabel := 0
nMax := 0
FOR EACH hElement IN aDataOfHash
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
IF HB_EnumIndex() == 1
#else
IF hElement:__enumIndex() == 1
#endif
nMax := hElement["VALUE"]
ELSE
nMax := Max( nMax, hElement["VALUE"] )
@@ -425,7 +439,11 @@ METHOD VerticalBarChart() CLASS GDChart
DEFAULT nExtrude TO 0
DEFAULT colorp TO ::SetColor( 0, 0, 0 )
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
nPosX := x + ( nSize * ( HB_EnumIndex() - 1 ) )
#else
nPosX := x + ( nSize * ( hElement:__enumIndex() - 1 ) )
#endif
nPosY := y
IF pTile <> NIL
::SetTile( pTile )
@@ -519,7 +537,11 @@ METHOD HorizontalBarChart() CLASS GDChart
nMaxLabel := 0
nMax := 0
FOR EACH hElement IN aDataOfHash
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
IF HB_EnumIndex() == 1
#else
IF hElement:__enumIndex() == 1
#endif
nMax := hElement["VALUE"]
ELSE
nMax := Max( nMax, hElement["VALUE"] )
@@ -610,7 +632,11 @@ METHOD HorizontalBarChart() CLASS GDChart
DEFAULT colorp TO ::SetColor( 0, 0, 0 )
nPosX := x
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
nPosY := y + ( nSize * ( HB_EnumIndex() - 1 ) )
#else
nPosY := y + ( nSize * ( hElement:__enumIndex() - 1 ) )
#endif
IF pTile <> NIL
::SetTile( pTile )
@@ -706,7 +732,11 @@ METHOD LineChart() CLASS GDChart
nMaxLabel := 0
nMax := 0
FOR EACH hElement IN aDataOfHash
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
IF HB_EnumIndex() == 1
#else
IF hElement:__enumIndex() == 1
#endif
nMax := hElement["VALUE"]
ELSE
nMax := Max( nMax, hElement["VALUE"] )
@@ -719,7 +749,11 @@ METHOD LineChart() CLASS GDChart
nMinLabel := 0
nMin := 0
FOR EACH hElement IN aDataOfHash
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
IF HB_EnumIndex() == 1
#else
IF hElement:__enumIndex() == 1
#endif
nMin := hElement["VALUE"]
ELSE
nMin := Min( nMin, hElement["VALUE"] )
@@ -729,7 +763,7 @@ METHOD LineChart() CLASS GDChart
NEXT
DEFAULT nLeftLabelSpace TO nBorder + Max( Len( LTrim( Transform( nMax, cAxisPict ) ) ), Len( LTrim( Transform( nMin, cAxisPict ) ) ) ) * ::GetFontWidth() + nBorder
DEFAULT nRightLabelSpace TO nLeftLabelSpace
DEFAULT nRightLabelSpace TO nLeftLabelSpace
DEFAULT nBottomLabelSpace TO nBorder + nMaxLabel * ::GetFontWidth() + nBorder
DEFAULT nMaxValue TO nMax
DEFAULT nMinValue TO nMin
@@ -770,7 +804,7 @@ METHOD LineChart() CLASS GDChart
nCeiling := 10 ^ nCeiling
nMaxValue := ceiling( nMaxValue / nCeiling ) * nCeiling
nMinValue := iif( nMinValue < 0, -ceiling( abs( nMinValue ) / nCeiling ) * nCeiling, ceiling( nMinValue / nCeiling ) * nCeiling )
nMinValue := iif( nMinValue < 0, -ceiling( abs( nMinValue ) / nCeiling ) * nCeiling, ceiling( nMinValue / nCeiling ) * nCeiling )
nTotRange := nMaxValue + iif( nMinValue < 0, abs( nMinValue ), 0 )
@@ -796,7 +830,11 @@ METHOD LineChart() CLASS GDChart
::Line( x, ::Height() - ( y + nPosY), x + nWidth, ::Height() - ( y + nPosY ), gdStyled )
NEXT
FOR EACH hElement IN aDataOfHash
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
nPosX := x + ( nSize * ( HB_EnumIndex() - 1 ) )
#else
nPosX := x + ( nSize * ( hElement:__enumIndex() - 1 ) )
#endif
::Line( nPosX, ::Height() - y, nPosX, ::Height() - ( y + nHeight ), gdStyled )
NEXT
::SetThickness( nThick )
@@ -837,7 +875,11 @@ METHOD LineChart() CLASS GDChart
DEFAULT nExtrude TO 0
DEFAULT colorp TO ::SetColor( 0, 0, 0 )
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
nPosX := x + ( nSize * ( HB_EnumIndex() - 1 ) )
#else
nPosX := x + ( nSize * ( hElement:__enumIndex() - 1 ) )
#endif
nPosY := y
IF pTile <> NIL
::SetTile( pTile )
@@ -879,11 +921,67 @@ METHOD LineChart() CLASS GDChart
RETURN Self
METHOD Clone() CLASS GDChart
LOCAL oDestImage
LOCAL pImage
IF ::IsTrueColor()
oDestImage := GDChart():CreateTrueColor( ::Width, ::Height )
ELSE
oDestImage := GDChart():Create( ::Width, ::Height )
ENDIF
pImage := oDestImage:pImage
oDestImage := oDestImage:CloneDataFrom( Self )
//oDestImage := __objClone( Self )
oDestImage:pImage := pImage
::Copy( 0, 0, ::Width, ::Height, 0, 0, oDestImage )
//pImage := oDestImage:pImage
//// Signal that this image must not be destroyed
//oDestImage:lDestroy := FALSE
//oDestImage := NIL
//oDestImage:pImage := pImage
RETURN oDestImage
METHOD CloneDataFrom( oSrc )
// copy values from Source to Dest
// please update in case of new datas
::Super:CloneDataFrom( oSrc )
::cTitle := oSrc:cTitle
::cAxisX := oSrc:cAxisX
::cAxisY := oSrc:cAxisY
::nWidth := oSrc:nWidth
::nHeight := oSrc:nHeight
::nScaleX := oSrc:nScaleX
::nScaleY := oSrc:nScaleY
::aSeries := AClone( oSrc:aSeries )
::aDataOfHashes := AClone( oSrc:aDataOfHashes )
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
::hDefs := HClone( oSrc:hDefs )
#else
::hDefs := HB_HClone( oSrc:hDefs )
#endif
RETURN Self
STATIC FUNCTION HGetValue( hHash, cKey )
LOCAL nPos
LOCAL xVal
IF hHash <> NIL
#if defined( __XHARBOUR ) .or. ( defined( __HARBOUR__ ) .and. defined( HB_COMPAT_XHB ) )
xVal := IIF( ( nPos := HGetPos( hHash, cKey )) == 0, NIL, HGetValueAt( hHash, nPos) )
#else
xVal := IIF( ( nPos := HB_HPos( hHash, cKey )) == 0, NIL, HB_HValueAt( hHash, nPos) )
#endif
ENDIF
//RETURN IIF( cKey IN hHash:Keys, hHash[ cKey ], NIL )
RETURN xVal

View File

@@ -0,0 +1,181 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* GD graphic library exported functions header file.
*
* Copyright 2004-2006 Francesco Saverio Giudice <info@fsgiudice.com>
* www - http://www.xharbour.org http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*
*
* See doc/license files for licensing terms.
*
*/
#ifndef GDEXTERNAL_CH
#define GDEXTERNAL_CH
// C wrapper functions
EXTERNAL GDVERSION
EXTERNAL GDIMAGECREATE
EXTERNAL GDIMAGECREATEPALETTE
EXTERNAL GDIMAGECREATETRUECOLOR
EXTERNAL GDIMAGECREATEFROMJPEG
EXTERNAL GDIMAGECREATEFROMGIF
EXTERNAL GDIMAGECREATEFROMPNG
EXTERNAL GDIMAGECREATEFROMWBMP
EXTERNAL GDIMAGECREATEFROMGD
EXTERNAL GDIMAGEJPEG
EXTERNAL GDIMAGEGIF
EXTERNAL GDIMAGEPNG
EXTERNAL GDIMAGEWBMP
EXTERNAL GDIMAGEGD
EXTERNAL GDIMAGEDESTROY
EXTERNAL GDIMAGESETPIXEL
EXTERNAL GDIMAGELINE
EXTERNAL GDIMAGEDASHEDLINE
EXTERNAL GDIMAGEPOLYGON
EXTERNAL GDIMAGEOPENPOLYGON
EXTERNAL GDIMAGERECTANGLE
EXTERNAL GDIMAGEFILLEDPOLYGON
EXTERNAL GDIMAGEFILLEDRECTANGLE
EXTERNAL GDIMAGEARC
EXTERNAL GDIMAGEFILLEDARC
EXTERNAL GDIMAGEFILLEDELLIPSE
EXTERNAL GDIMAGEFILLTOBORDER
EXTERNAL GDIMAGEFILL
EXTERNAL GDIMAGESETANTIALIASED
EXTERNAL GDIMAGESETANTIALIASEDDONTBLEND
EXTERNAL GDIMAGESETBRUSH
EXTERNAL GDIMAGESETTILE
EXTERNAL GDIMAGESETSTYLE
EXTERNAL GDIMAGESETTHICKNESS
EXTERNAL GDIMAGEALPHABLENDING
EXTERNAL GDIMAGESAVEALPHA
EXTERNAL GDIMAGESETCLIP
EXTERNAL GDIMAGEGETCLIP
EXTERNAL GDIMAGECOLORSTOTAL
EXTERNAL GDIMAGEALPHA
EXTERNAL GDIMAGERED
EXTERNAL GDIMAGEGREEN
EXTERNAL GDIMAGEBLUE
EXTERNAL GDIMAGESX
EXTERNAL GDIMAGESY
EXTERNAL GDIMAGEGETPIXEL
EXTERNAL GDIMAGEBOUNDSSAFE
EXTERNAL GDIMAGEGETINTERLACED
EXTERNAL GDIMAGEGETTRANSPARENT
EXTERNAL GDIMAGETRUECOLOR
EXTERNAL GDIMAGETRUECOLORTOPALETTE
EXTERNAL GDIMAGECREATEPALETTEFROMTRUECOLOR
EXTERNAL GDIMAGEPALETTEPIXEL
EXTERNAL GDIMAGETRUECOLORPIXEL
EXTERNAL GDIMAGEGETTHICKNESS
EXTERNAL GDFONTGETSMALL
EXTERNAL GDFONTGETLARGE
EXTERNAL GDFONTGETMEDIUMBOLD
EXTERNAL GDFONTGETGIANT
EXTERNAL GDFONTGETTINY
EXTERNAL GDIMAGESTRING
EXTERNAL GDIMAGESTRINGUP
EXTERNAL GDIMAGESTRINGFTEX
EXTERNAL GDIMAGESTRINGFTCIRCLE
EXTERNAL GDFONTCACHESETUP
EXTERNAL GDFONTCACHESHUTDOWN
EXTERNAL GDFONTGETWIDTH
EXTERNAL GDFONTGETHEIGHT
EXTERNAL GDIMAGECOLORALLOCATE
EXTERNAL GDIMAGECOLORDEALLOCATE
EXTERNAL GDIMAGECOLORALLOCATEALPHA
EXTERNAL GDIMAGECOLORCLOSEST
EXTERNAL GDIMAGECOLORCLOSESTALPHA
EXTERNAL GDIMAGECOLORCLOSESTHWB
EXTERNAL GDIMAGECOLOREXACT
EXTERNAL GDIMAGECOLORRESOLVE
EXTERNAL GDIMAGECOLORRESOLVEALPHA
EXTERNAL GDIMAGECOLORTRANSPARENT
EXTERNAL GDTRUECOLOR
EXTERNAL GDTRUECOLORALPHA
EXTERNAL GDIMAGECOPY
EXTERNAL GDIMAGECOPYRESIZED
EXTERNAL GDIMAGECOPYRESAMPLED
EXTERNAL GDIMAGECOPYROTATED
EXTERNAL GDIMAGECOPYMERGE
EXTERNAL GDIMAGECOPYMERGEGRAY
EXTERNAL GDIMAGEPALETTECOPY
EXTERNAL GDIMAGESQUARETOCIRCLE
EXTERNAL GDIMAGESHARPEN
EXTERNAL GDIMAGECOMPARE
EXTERNAL GDIMAGEINTERLACE
EXTERNAL GDIMAGEGIFANIMBEGIN
EXTERNAL GDIMAGEGIFANIMADD
EXTERNAL GDIMAGEGIFANIMEND
// PRG level functions
EXTERNAL GDIMAGECHAR
EXTERNAL GDIMAGECHARUP
EXTERNAL GDIMAGECIRCLE
EXTERNAL GDIMAGEFILLEDCIRCLE
EXTERNAL GDIMAGEELLIPSE
EXTERNAL GDIMAGEFTWIDTH
EXTERNAL GDIMAGEFTHEIGHT
EXTERNAL GDIMAGEFTSIZE
EXTERNAL GDIMAGESTRINGFT
EXTERNAL GDIMAGEFROMFILE
EXTERNAL GDIMAGETOSTRING
EXTERNAL GDIMAGETOFILE
// CLASS functions
EXTERNAL GDIMAGE
EXTERNAL GDCHART
EXTERNAL TBARCODE
EXTERNAL TCODE
#endif // GDEXTERAL_CH

View File

@@ -64,7 +64,7 @@
CLASS GDImage
HIDDEN:
PROTECTED:
DATA pImage
DATA pBrush
DATA pTile
@@ -93,25 +93,25 @@ CLASS GDImage
METHOD CreateTrueColor( sx, sy ) INLINE ::pImage := gdImageCreateTrueColor( sx, sy ), Self
// Load From File
METHOD LoadFromPng( cFile ) INLINE ::pImage := gdImageCreateFromPng( cFile ), Self
METHOD LoadFromJpeg( cFile ) INLINE ::pImage := gdImageCreateFromJpeg( cFile ), Self
METHOD LoadFromWBmp( cFile ) INLINE ::pImage := gdImageCreateFromWBMP( cFile ), Self
METHOD LoadFromGd( cFile ) INLINE ::pImage := gdImageCreateFromGD( cFile ), Self
METHOD LoadFromGif( cFile ) INLINE ::pImage := gdImageCreateFromGif( cFile ), Self
METHOD LoadFromPng( cFile ) INLINE ::pImage := gdImageCreateFromPng( cFile ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD LoadFromJpeg( cFile ) INLINE ::pImage := gdImageCreateFromJpeg( cFile ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD LoadFromWBmp( cFile ) INLINE ::pImage := gdImageCreateFromWBMP( cFile ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD LoadFromGd( cFile ) INLINE ::pImage := gdImageCreateFromGD( cFile ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD LoadFromGif( cFile ) INLINE ::pImage := gdImageCreateFromGif( cFile ) , IIF( ::pImage <> NIL, Self, NIL )
// Load From a specific File handle
METHOD InputPng( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromPng( nHandle, nSize ), Self
METHOD InputJpeg( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromJpeg( nHandle, nSize ), Self
METHOD InputWBmp( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromWBMP( nHandle, nSize ), Self
METHOD InputGd( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromGD( nHandle, nSize ), Self
METHOD InputGif( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromGif( nHandle, nSize ), Self
METHOD InputPng( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromPng( nHandle, nSize ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD InputJpeg( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromJpeg( nHandle, nSize ), IIF( ::pImage <> NIL, Self, NIL )
METHOD InputWBmp( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromWBMP( nHandle, nSize ), IIF( ::pImage <> NIL, Self, NIL )
METHOD InputGd( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromGD( nHandle, nSize ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD InputGif( nHandle, nSize ) INLINE ::pImage := gdImageCreateFromGif( nHandle, nSize ) , IIF( ::pImage <> NIL, Self, NIL )
// Create from an image pointer in memory
METHOD CreateFromPng( pImage, nSize ) INLINE ::pImage := gdImageCreateFromPng( pImage, nSize ), Self
METHOD CreateFromJpeg( pImage, nSize ) INLINE ::pImage := gdImageCreateFromJpeg( pImage, nSize ), Self
METHOD CreateFromWBmp( pImage, nSize ) INLINE ::pImage := gdImageCreateFromWBMP( pImage, nSize ), Self
METHOD CreateFromGd( pImage, nSize ) INLINE ::pImage := gdImageCreateFromGD( pImage, nSize ), Self
METHOD CreateFromGif( pImage, nSize ) INLINE ::pImage := gdImageCreateFromGif( pImage, nSize ), Self
METHOD CreateFromPng( pImage, nSize ) INLINE ::pImage := gdImageCreateFromPng( pImage, nSize ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD CreateFromJpeg( pImage, nSize ) INLINE ::pImage := gdImageCreateFromJpeg( pImage, nSize ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD CreateFromWBmp( pImage, nSize ) INLINE ::pImage := gdImageCreateFromWBMP( pImage, nSize ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD CreateFromGd( pImage, nSize ) INLINE ::pImage := gdImageCreateFromGD( pImage, nSize ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD CreateFromGif( pImage, nSize ) INLINE ::pImage := gdImageCreateFromGif( pImage, nSize ) , IIF( ::pImage <> NIL, Self, NIL )
METHOD LoadFromFile( cFile )
@@ -131,6 +131,8 @@ CLASS GDImage
METHOD OutputGd( nHandle ) INLINE IIF( nHandle == NIL, nHandle := 1, ), gdImageGd( ::pImage, nHandle )
METHOD OutputGif( nHandle ) INLINE IIF( nHandle == NIL, nHandle := 1, ), gdImageGif( ::pImage, nHandle )
METHOD Output( nHandle ) INLINE gdImageToHandle( ::pImage, nHandle )
// Output To a string
METHOD ToStringPng( nLevel ) INLINE gdImagePng( ::pImage, NIL, nLevel )
METHOD ToStringJpeg( nLevel ) INLINE gdImageJpeg( ::pImage, NIL, nLevel )
@@ -296,6 +298,9 @@ CLASS GDImage
METHOD Version() INLINE gdVersion()
PROTECTED:
METHOD CloneDataFrom()
ENDCLASS
METHOD New( sx, sy ) CLASS GDImage
@@ -362,8 +367,10 @@ RETURN Self
METHOD LoadFromFile( cFile ) CLASS GDImage
LOCAL aLoad
aLoad := gdImageFromFile( cFile )
Self := aLoad[1]:Clone()
//Self := aLoad[1]:Clone()
::Destroy()
Self := ::CloneDataFrom( aLoad[1] )
//Self := __objClone( aLoad[1] )
aLoad[1]:lDestroy := FALSE
aLoad[1] := NIL
@@ -545,7 +552,8 @@ METHOD Rotate( nAngle, lInside ) CLASS GDImage
::CopyRotated( ,,,,,, nAngle, oDestImage )
ENDIF
::Destroy()
Self := __ObjCLone( oDestImage )
Self := ::CloneDataFrom( oDestImage )
//Self := __ObjClone( oDestImage ) // non funziona
// Move new image to existing one
// Signal that this image must not be destroyed
@@ -559,7 +567,8 @@ METHOD Crop( nX, nY, nWidth, nHeight ) CLASS GDImage
oDestImage := ::CopyResized( nX, nY, nWidth, nHeight, 0, 0, nWidth, nHeight )
::Destroy()
Self := __ObjClone( oDestImage )
Self := ::CloneDataFrom( oDestImage )
//Self := __ObjClone( oDestImage ) // non funziona
// Move new image to existing one
// Signal that this image must not be destroyed
@@ -573,7 +582,8 @@ METHOD Resize( nWidth, nHeight ) CLASS GDImage
oDestImage := ::CopyResampled( 0, 0, NIL, NIL, 0, 0, nWidth, nHeight )
::Destroy()
Self := __ObjClone( oDestImage )
Self := ::CloneDataFrom( oDestImage )
//Self := __ObjClone( oDestImage ) // non funziona
// Move new image to existing one
// Signal that this image must not be destroyed
@@ -587,7 +597,8 @@ METHOD Zoom( nPerc ) CLASS GDImage
oDestImage := ::CopyZoomed( nPerc )
::Destroy()
Self := __ObjClone( oDestImage )
Self := ::CloneDataFrom( oDestImage )
//Self := __ObjClone( oDestImage ) // non funziona
// Move new image to existing one
// Signal that this image must not be destroyed
@@ -598,6 +609,7 @@ RETURN Self
METHOD Clone() CLASS GDImage
LOCAL oDestImage
LOCAL pImage
IF ::IsTrueColor()
oDestImage := GDImage():CreateTrueColor( ::Width, ::Height )
@@ -605,9 +617,18 @@ METHOD Clone() CLASS GDImage
oDestImage := GDImage():Create( ::Width, ::Height )
ENDIF
pImage := oDestImage:pImage
oDestImage := oDestImage:CloneDataFrom( Self )
//oDestImage := __objClone( Self )
oDestImage:pImage := pImage
::Copy( 0, 0, ::Width, ::Height, 0, 0, oDestImage )
// ::Destroy()
// Self := __ObjClone( oDestImage )
//pImage := oDestImage:pImage
//// Signal that this image must not be destroyed
//oDestImage:lDestroy := FALSE
//oDestImage := NIL
//oDestImage:pImage := pImage
RETURN oDestImage
@@ -662,3 +683,27 @@ METHOD SayFreeType( x, y, cString, cFontName, nPitch, nAngle, color, nAlign, ;
RETURN Self
METHOD CloneDataFrom( oSrc )
// copy values from Source to Dest
// please update in case of new datas
::pImage := oSrc:pImage
::pBrush := oSrc:pBrush
::pTile := oSrc:pTile
::pFont := oSrc:pFont
::pColor := oSrc:pColor
::cFontName := oSrc:cFontName
::nFontPitch := oSrc:nFontPitch
::nFontAngle := oSrc:nFontAngle
::aPoints := AClone( oSrc:aPoints )
::aStyles := AClone( oSrc:aStyles )
::lDestroy := oSrc:lDestroy
::hFile := oSrc:hFile
::cType := oSrc:cType
::cMime := oSrc:cMime
RETURN Self

View File

@@ -175,6 +175,23 @@ static void SaveImageToFile( char *szFile, void *iptr, int sz )
/* ---------------------------------------------------------------------------*/
static void AddImageToFile( char *szFile, void *iptr, int sz )
{
FHANDLE fhandle;
if ( ( fhandle = hb_fsOpen( ( BYTE * ) szFile, FO_READWRITE ) ) != FS_ERROR )
{
/* move to end of file */
hb_fsSeek(fhandle, 0, FS_END);
/* Write Image */
SaveImageToHandle( fhandle, ( BYTE *) iptr, (ULONG) sz );
/* Close file */
hb_fsClose( fhandle );
}
}
static void GDImageCreateFrom( int nType )
{
gdImagePtr im;
@@ -413,13 +430,28 @@ static void GDImageSaveTo( int nType )
/* ************************* WRAPPED FUNCTIONS ****************************** */
HB_FUNC( GDVERSION ) // gdImagePtr gdImageCreate(sx, sy)
HB_FUNC( GDVERSION )
{
#if ( GD_VERS >= 2033 )
#if ( GD_VERS >= 2034 )
char szVer[ 30 ];
sprintf( szVer, "GD Version %s", GD_VERSION_STRING );
hb_retc( szVer );
#elif ( GD_VERS >= 2033 )
hb_retc( "GD Version 2.0.33" );
#else
hb_retc( "GD Version 2.0.28" );
#endif
#endif
}
HB_FUNC( GDVERSIONNUMBER )
{
#if ( GD_VERS >= 2034 )
hb_retni( GD_MAJOR_VERSION * 1000 + GD_MINOR_VERSION * 100 + GD_RELEASE_VERSION );
#elif ( GD_VERS >= 2033 )
hb_retni( 2033 );
#else
hb_retni( 2028 );
#endif
}
/* ---------------------------------------------------------------------------*/
@@ -443,7 +475,7 @@ HB_FUNC( GDIMAGECREATE ) // gdImagePtr gdImageCreate(sx, sy)
/* Create the image */
im = gdImageCreate( sx, sy );
/* Return image pointer */
hb_retptr( im );
}
@@ -1247,6 +1279,52 @@ HB_FUNC( GDIMAGEFILLTOBORDER ) // void gdImageFillToBorder(gdImagePtr im, int x,
}
}
/* ---------------------------------------------------------------------------*/
#if ( GD_VERS >= 2035 )
HB_FUNC( GDIMAGEELLIPSE ) // void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color)
{
if ( hb_pcount() == 6 &&
hb_parinfo( 1 ) & HB_IT_POINTER &&
hb_parinfo( 2 ) & HB_IT_NUMERIC &&
hb_parinfo( 3 ) & HB_IT_NUMERIC &&
hb_parinfo( 4 ) & HB_IT_NUMERIC &&
hb_parinfo( 5 ) & HB_IT_NUMERIC &&
hb_parinfo( 6 ) & HB_IT_NUMERIC
)
{
gdImagePtr im;
int cx, cy, w, h, color;
/* Retrieve image pointer */
im = (gdImagePtr)hb_parptr( 1 );
/* Retrieve point values */
cx = hb_parni( 2 );
cy = hb_parni( 3 );
/* Retrieve width and height values */
w = hb_parni( 4 );
h = hb_parni( 5 );
/* Retrieve color value */
color = hb_parni( 6 );
/* Draw a filled ellipse */
gdImageEllipse(im, cx, cy, w, h, color);
}
else
{
// Parameter error
{
hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
"GDIMAGEELLIPSE", 6,
hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
hb_paramError( 5 ), hb_paramError( 6 ) );
return;
}
}
}
#endif // ( GD_VERS >= 2035 )
/* ---------------------------------------------------------------------------*/
HB_FUNC( GDIMAGEFILL ) // void gdImageFill(gdImagePtr im, int x, int y, int color)
@@ -2534,11 +2612,14 @@ HB_FUNC( GDIMAGESTRINGFTEX )
if ( !( err ) )
{
/* Save in array the correct text rectangle dimensions */
PHB_ITEM pRect;
PHB_ITEM pArray;
pArray = hb_itemArrayNew( 8 );
for( i = 0; i < 8; i ++ )
{
hb_itemPutNI( hb_arrayGetItemPtr( pRect, i+1 ), aRect[i] );
hb_itemPutNI( hb_arrayGetItemPtr( pArray, i+1 ), aRect[i] );
}
hb_itemCopy( pRect, pArray );
hb_itemRelease( pArray );
}
hb_retc( err );
@@ -3929,22 +4010,4 @@ HB_FUNC( GDIMAGEGIFANIMEND )
/* ---------------------------------------------------------------------------*/
static void AddImageToFile( char *szFile, void *iptr, int sz )
{
FHANDLE fhandle;
if ( ( fhandle = hb_fsOpen( ( BYTE * ) szFile, FO_READWRITE ) ) != FS_ERROR )
{
/* move to end of file */
hb_fsSeek(fhandle, 0, FS_END);
/* Write Image */
SaveImageToHandle( fhandle, ( BYTE *) iptr, (ULONG) sz );
/* Close file */
hb_fsClose( fhandle );
}
}
#endif // ( GD_VERS >= 2033 )

View File

@@ -0,0 +1,277 @@
/*
* Generated file - do not edit directly.
*
* This file was generated from:
* http://www.w3.org/TR/REC-html40/sgml/entities.html
* by means of the script:
* entities.tcl
*/
#ifdef __cplusplus
extern "C" {
#endif
struct entities_s {
char *name;
int value;
} entities[] = {
{"AElig", 198},
{"Aacute", 193},
{"Acirc", 194},
{"Agrave", 192},
{"Alpha", 913},
{"Aring", 197},
{"Atilde", 195},
{"Auml", 196},
{"Beta", 914},
{"Ccedil", 199},
{"Chi", 935},
{"Dagger", 8225},
{"Delta", 916},
{"ETH", 208},
{"Eacute", 201},
{"Ecirc", 202},
{"Egrave", 200},
{"Epsilon", 917},
{"Eta", 919},
{"Euml", 203},
{"Gamma", 915},
{"Iacute", 205},
{"Icirc", 206},
{"Igrave", 204},
{"Iota", 921},
{"Iuml", 207},
{"Kappa", 922},
{"Lambda", 923},
{"Mu", 924},
{"Ntilde", 209},
{"Nu", 925},
{"OElig", 338},
{"Oacute", 211},
{"Ocirc", 212},
{"Ograve", 210},
{"Omega", 937},
{"Omicron", 927},
{"Oslash", 216},
{"Otilde", 213},
{"Ouml", 214},
{"Phi", 934},
{"Pi", 928},
{"Prime", 8243},
{"Psi", 936},
{"Rho", 929},
{"Scaron", 352},
{"Sigma", 931},
{"THORN", 222},
{"Tau", 932},
{"Theta", 920},
{"Uacute", 218},
{"Ucirc", 219},
{"Ugrave", 217},
{"Upsilon", 933},
{"Uuml", 220},
{"Xi", 926},
{"Yacute", 221},
{"Yuml", 376},
{"Zeta", 918},
{"aacute", 225},
{"acirc", 226},
{"acute", 180},
{"aelig", 230},
{"agrave", 224},
{"alefsym", 8501},
{"alpha", 945},
{"amp", 38},
{"and", 8743},
{"ang", 8736},
{"aring", 229},
{"asymp", 8776},
{"atilde", 227},
{"auml", 228},
{"bdquo", 8222},
{"beta", 946},
{"brvbar", 166},
{"bull", 8226},
{"cap", 8745},
{"ccedil", 231},
{"cedil", 184},
{"cent", 162},
{"chi", 967},
{"circ", 710},
{"clubs", 9827},
{"cong", 8773},
{"copy", 169},
{"crarr", 8629},
{"cup", 8746},
{"curren", 164},
{"dArr", 8659},
{"dagger", 8224},
{"darr", 8595},
{"deg", 176},
{"delta", 948},
{"diams", 9830},
{"divide", 247},
{"eacute", 233},
{"ecirc", 234},
{"egrave", 232},
{"empty", 8709},
{"emsp", 8195},
{"ensp", 8194},
{"epsilon", 949},
{"equiv", 8801},
{"eta", 951},
{"eth", 240},
{"euml", 235},
{"euro", 8364},
{"exist", 8707},
{"fnof", 402},
{"forall", 8704},
{"frac12", 189},
{"frac14", 188},
{"frac34", 190},
{"frasl", 8260},
{"gamma", 947},
{"ge", 8805},
{"gt", 62},
{"hArr", 8660},
{"harr", 8596},
{"hearts", 9829},
{"hellip", 8230},
{"iacute", 237},
{"icirc", 238},
{"iexcl", 161},
{"igrave", 236},
{"image", 8465},
{"infin", 8734},
{"int", 8747},
{"iota", 953},
{"iquest", 191},
{"isin", 8712},
{"iuml", 239},
{"kappa", 954},
{"lArr", 8656},
{"lambda", 955},
{"lang", 9001},
{"laquo", 171},
{"larr", 8592},
{"lceil", 8968},
{"ldquo", 8220},
{"le", 8804},
{"lfloor", 8970},
{"lowast", 8727},
{"loz", 9674},
{"lrm", 8206},
{"lsaquo", 8249},
{"lsquo", 8216},
{"lt", 60},
{"macr", 175},
{"mdash", 8212},
{"micro", 181},
{"middot", 183},
{"minus", 8722},
{"mu", 956},
{"nabla", 8711},
{"nbsp", 160},
{"ndash", 8211},
{"ne", 8800},
{"ni", 8715},
{"not", 172},
{"notin", 8713},
{"nsub", 8836},
{"ntilde", 241},
{"nu", 957},
{"oacute", 243},
{"ocirc", 244},
{"oelig", 339},
{"ograve", 242},
{"oline", 8254},
{"omega", 969},
{"omicron", 959},
{"oplus", 8853},
{"or", 8744},
{"ordf", 170},
{"ordm", 186},
{"oslash", 248},
{"otilde", 245},
{"otimes", 8855},
{"ouml", 246},
{"para", 182},
{"part", 8706},
{"permil", 8240},
{"perp", 8869},
{"phi", 966},
{"pi", 960},
{"piv", 982},
{"plusmn", 177},
{"pound", 163},
{"prime", 8242},
{"prod", 8719},
{"prop", 8733},
{"psi", 968},
{"quot", 34},
{"rArr", 8658},
{"radic", 8730},
{"rang", 9002},
{"raquo", 187},
{"rarr", 8594},
{"rceil", 8969},
{"rdquo", 8221},
{"real", 8476},
{"reg", 174},
{"rfloor", 8971},
{"rho", 961},
{"rlm", 8207},
{"rsaquo", 8250},
{"rsquo", 8217},
{"sbquo", 8218},
{"scaron", 353},
{"sdot", 8901},
{"sect", 167},
{"shy", 173},
{"sigma", 963},
{"sigmaf", 962},
{"sim", 8764},
{"spades", 9824},
{"sub", 8834},
{"sube", 8838},
{"sum", 8721},
{"sup", 8835},
{"sup1", 185},
{"sup2", 178},
{"sup3", 179},
{"supe", 8839},
{"szlig", 223},
{"tau", 964},
{"there4", 8756},
{"theta", 952},
{"thetasym", 977},
{"thinsp", 8201},
{"thorn", 254},
{"tilde", 732},
{"times", 215},
{"trade", 8482},
{"uArr", 8657},
{"uacute", 250},
{"uarr", 8593},
{"ucirc", 251},
{"ugrave", 249},
{"uml", 168},
{"upsih", 978},
{"upsilon", 965},
{"uuml", 252},
{"weierp", 8472},
{"xi", 958},
{"yacute", 253},
{"yen", 165},
{"yuml", 255},
{"zeta", 950},
{"zwj", 8205},
{"zwnj", 8204},
};
#define ENTITY_NAME_LENGTH_MAX 8
#define NR_OF_ENTITIES 252
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,811 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef GD_H
#define GD_H 1
#if ( defined(HB_OS_WIN_32) || defined(__WIN32__) )
#define GD_VERS 2034
#else
#define GD_VERS 2028
#endif
#define GD_MAJOR_VERSION 2
#define GD_MINOR_VERSION 0
#define GD_RELEASE_VERSION 34
#define GD_EXTRA_VERSION ""
#define GD_VERSION_STRING "2.0.34"
/* Do the DLL dance: dllexport when building the DLL,
dllimport when importing from it, nothing when
not on Silly Silly Windows (tm Aardman Productions). */
/* 2.0.20: for headers */
/* 2.0.24: __stdcall also needed for Visual BASIC
and other languages. This breaks ABI compatibility
with previous DLL revs, but it's necessary. */
/* 2.0.29: WIN32 programmers can declare the NONDLL macro if they
wish to build gd as a static library or by directly including
the gd sources in a project. */
#ifndef WIN32
#define NONDLL 1
#endif /* WIN32 */
#ifdef NONDLL
#define BGD_DECLARE(rt) extern rt
#else
#ifdef BGDWIN32
#define BGD_DECLARE(rt) __declspec(dllexport) rt __stdcall
#else
#define BGD_DECLARE(rt) __declspec(dllimport) rt _stdcall
#endif /* BGDWIN32 */
#endif /* NONDLL */
/* 2.0.20: for actual storage of exported data, functions don't need this,
currently needed only for font pointers */
#ifdef NONDLL
/* 2.0.25: bring back extern */
#define BGD_EXPORT_DATA_PROT extern
#define BGD_EXPORT_DATA_IMPL
#else
#ifdef BGDWIN32
#define BGD_EXPORT_DATA_PROT __declspec(dllexport) extern
#define BGD_EXPORT_DATA_IMPL __declspec(dllexport)
#else
#define BGD_EXPORT_DATA_PROT __declspec(dllimport) extern
#define BGD_EXPORT_DATA_IMPL __declspec(dllimport)
#endif /* BGDWIN32 */
#endif /* NONDLL */
#ifdef __cplusplus
extern "C"
{
#endif
/* some might want to set DEFAULT_FONTPATH from configure in config.h */
/* 2.0.23: more Type 1 fonts */
#ifndef DEFAULT_FONTPATH
/* default fontpath for unix systems - whatever happened to standards ! */
#define DEFAULT_FONTPATH "/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1:/usr/lib/X11/fonts/Type1:/usr/openwin/lib/X11/fonts/Type1"
#endif
#ifndef PATHSEPARATOR
#define PATHSEPARATOR ":"
#endif
/* gd.h: declarations file for the graphic-draw module.
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. This software is provided "AS IS." Thomas Boutell and
* Boutell.Com, Inc. disclaim all warranties, either express or implied,
* including but not limited to implied warranties of merchantability and
* fitness for a particular purpose, with respect to this code and accompanying
* documentation. */
/* stdio is needed for file I/O. */
#include <stdio.h>
#include "gd_io.h"
/* The maximum number of palette entries in palette-based images.
In the wonderful new world of gd 2.0, you can of course have
many more colors when using truecolor mode. */
#define gdMaxColors 256
/* Image type. See functions below; you will not need to change
the elements directly. Use the provided macros to
access sx, sy, the color table, and colorsTotal for
read-only purposes. */
/* If 'truecolor' is set true, the image is truecolor;
pixels are represented by integers, which
must be 32 bits wide or more.
True colors are repsented as follows:
ARGB
Where 'A' (alpha channel) occupies only the
LOWER 7 BITS of the MSB. This very small
loss of alpha channel resolution allows gd 2.x
to keep backwards compatibility by allowing
signed integers to be used to represent colors,
and negative numbers to represent special cases,
just as in gd 1.x. */
#define gdAlphaMax 127
#define gdAlphaOpaque 0
#define gdAlphaTransparent 127
#define gdRedMax 255
#define gdGreenMax 255
#define gdBlueMax 255
#define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24)
#define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16)
#define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8)
#define gdTrueColorGetBlue(c) ((c) & 0x0000FF)
/* This function accepts truecolor pixel values only. The
source color is composited with the destination color
based on the alpha channel value of the source color.
The resulting color is opaque. */
BGD_DECLARE(int) gdAlphaBlend (int dest, int src);
typedef struct gdImageStruct
{
/* Palette-based image pixels */
unsigned char **pixels;
int sx;
int sy;
/* These are valid in palette images only. See also
'alpha', which appears later in the structure to
preserve binary backwards compatibility */
int colorsTotal;
int red[gdMaxColors];
int green[gdMaxColors];
int blue[gdMaxColors];
int open[gdMaxColors];
/* For backwards compatibility, this is set to the
first palette entry with 100% transparency,
and is also set and reset by the
gdImageColorTransparent function. Newer
applications can allocate palette entries
with any desired level of transparency; however,
bear in mind that many viewers, notably
many web browsers, fail to implement
full alpha channel for PNG and provide
support for full opacity or transparency only. */
int transparent;
int *polyInts;
int polyAllocated;
struct gdImageStruct *brush;
struct gdImageStruct *tile;
int brushColorMap[gdMaxColors];
int tileColorMap[gdMaxColors];
int styleLength;
int stylePos;
int *style;
int interlace;
/* New in 2.0: thickness of line. Initialized to 1. */
int thick;
/* New in 2.0: alpha channel for palettes. Note that only
Macintosh Internet Explorer and (possibly) Netscape 6
really support multiple levels of transparency in
palettes, to my knowledge, as of 2/15/01. Most
common browsers will display 100% opaque and
100% transparent correctly, and do something
unpredictable and/or undesirable for levels
in between. TBB */
int alpha[gdMaxColors];
/* Truecolor flag and pixels. New 2.0 fields appear here at the
end to minimize breakage of existing object code. */
int trueColor;
int **tpixels;
/* Should alpha channel be copied, or applied, each time a
pixel is drawn? This applies to truecolor images only.
No attempt is made to alpha-blend in palette images,
even if semitransparent palette entries exist.
To do that, build your image as a truecolor image,
then quantize down to 8 bits. */
int alphaBlendingFlag;
/* Should the alpha channel of the image be saved? This affects
PNG at the moment; other future formats may also
have that capability. JPEG doesn't. */
int saveAlphaFlag;
/* There should NEVER BE ACCESSOR MACROS FOR ITEMS BELOW HERE, so this
part of the structure can be safely changed in new releases. */
/* 2.0.12: anti-aliased globals. 2.0.26: just a few vestiges after
switching to the fast, memory-cheap implementation from PHP-gd. */
int AA;
int AA_color;
int AA_dont_blend;
/* 2.0.12: simple clipping rectangle. These values
must be checked for safety when set; please use
gdImageSetClip */
int cx1;
int cy1;
int cx2;
int cy2;
}
gdImage;
typedef gdImage *gdImagePtr;
typedef struct
{
/* # of characters in font */
int nchars;
/* First character is numbered... (usually 32 = space) */
int offset;
/* Character width and height */
int w;
int h;
/* Font data; array of characters, one row after another.
Easily included in code, also easily loaded from
data files. */
char *data;
}
gdFont;
/* Text functions take these. */
typedef gdFont *gdFontPtr;
/* For backwards compatibility only. Use gdImageSetStyle()
for MUCH more flexible line drawing. Also see
gdImageSetBrush(). */
#define gdDashSize 4
/* Special colors. */
#define gdStyled (-2)
#define gdBrushed (-3)
#define gdStyledBrushed (-4)
#define gdTiled (-5)
/* NOT the same as the transparent color index.
This is used in line styles only. */
#define gdTransparent (-6)
#define gdAntiAliased (-7)
/* Functions to manipulate images. */
/* Creates a palette-based image (up to 256 colors). */
BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy);
/* An alternate name for the above (2.0). */
#define gdImageCreatePalette gdImageCreate
/* Creates a truecolor image (millions of colors). */
BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor (int sx, int sy);
/* Creates an image from various file types. These functions
return a palette or truecolor image based on the
nature of the file being loaded. Truecolor PNG
stays truecolor; palette PNG stays palette-based;
JPEG is always truecolor. */
BGD_DECLARE(gdImagePtr) gdImageCreateFromPng (FILE * fd);
BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx (gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromPngPtr (int size, void *data);
/* These read the first frame only */
BGD_DECLARE(gdImagePtr) gdImageCreateFromGif (FILE * fd);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx (gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGifPtr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMP (FILE * inFile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPCtx (gdIOCtx * infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPPtr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpeg (FILE * infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtx (gdIOCtx * infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtr (int size, void *data);
/* A custom data source. */
/* The source function must return -1 on error, otherwise the number
of bytes fetched. 0 is EOF, not an error! */
/* context will be passed to your source function. */
typedef struct
{
int (*source) (void *context, char *buffer, int len);
void *context;
}
gdSource, *gdSourcePtr;
/* Deprecated in favor of gdImageCreateFromPngCtx */
BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd (FILE * in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGdCtx (gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGdPtr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * in, int srcx, int srcy, int w,
int h);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtxPtr in, int srcx, int srcy,
int w, int h);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy,
int w, int h);
/* 2.0.10: prototype was missing */
BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm (FILE * in);
/* NOTE: filename, not FILE */
BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm (char *filename);
BGD_DECLARE(void) gdImageDestroy (gdImagePtr im);
/* Replaces or blends with the background depending on the
most recent call to gdImageAlphaBlending and the
alpha channel value of 'color'; default is to overwrite.
Tiling and line styling are also implemented
here. All other gd drawing functions pass through this call,
allowing for many useful effects. */
BGD_DECLARE(void) gdImageSetPixel (gdImagePtr im, int x, int y, int color);
/* FreeType 2 text output with hook to extra flags */
BGD_DECLARE(int) gdImageGetPixel (gdImagePtr im, int x, int y);
BGD_DECLARE(int) gdImageGetTrueColorPixel (gdImagePtr im, int x, int y);
BGD_DECLARE(void) gdImageAABlend (gdImagePtr im);
BGD_DECLARE(void) gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
/* For backwards compatibility only. Use gdImageSetStyle()
for much more flexible line drawing. */
BGD_DECLARE(void) gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2,
int color);
/* Corners specified (not width and height). Upper left first, lower right
second. */
BGD_DECLARE(void) gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
int color);
/* Solid bar. Upper left corner first, lower right corner second. */
BGD_DECLARE(void) gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
int color);
BGD_DECLARE(void) gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2);
BGD_DECLARE(void) gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P);
BGD_DECLARE(int) gdImageBoundsSafe (gdImagePtr im, int x, int y);
BGD_DECLARE(void) gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c,
int color);
BGD_DECLARE(void) gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c,
int color);
BGD_DECLARE(void) gdImageString (gdImagePtr im, gdFontPtr f, int x, int y,
unsigned char *s, int color);
BGD_DECLARE(void) gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y,
unsigned char *s, int color);
BGD_DECLARE(void) gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y,
unsigned short *s, int color);
BGD_DECLARE(void) gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y,
unsigned short *s, int color);
/* 2.0.16: for thread-safe use of gdImageStringFT and friends,
call this before allowing any thread to call gdImageStringFT.
Otherwise it is invoked by the first thread to invoke
gdImageStringFT, with a very small but real risk of a race condition.
Return 0 on success, nonzero on failure to initialize freetype. */
BGD_DECLARE(int) gdFontCacheSetup (void);
/* Optional: clean up after application is done using fonts in
BGD_DECLARE( ) gdImageStringFT(). */
BGD_DECLARE(void) gdFontCacheShutdown (void);
/* 2.0.20: for backwards compatibility. A few applications did start calling
this function when it first appeared although it was never documented.
Simply invokes gdFontCacheShutdown. */
BGD_DECLARE(void) gdFreeFontCache (void);
/* Calls gdImageStringFT. Provided for backwards compatibility only. */
BGD_DECLARE(char *) gdImageStringTTF (gdImage * im, int *brect, int fg, char *fontlist,
double ptsize, double angle, int x, int y,
char *string);
/* FreeType 2 text output */
BGD_DECLARE(char *) gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
double ptsize, double angle, int x, int y,
char *string);
/* 2.0.5: provides an extensible way to pass additional parameters.
Thanks to Wez Furlong, sorry for the delay. */
typedef struct
{
int flags; /* Logical OR of gdFTEX_ values */
double linespacing; /* fine tune line spacing for '\n' */
int charmap; /* TBB: 2.0.12: may be gdFTEX_Unicode,
gdFTEX_Shift_JIS, gdFTEX_Big5,
or gdFTEX_Adobe_Custom;
when not specified, maps are searched
for in the above order. */
int hdpi; /* if (flags & gdFTEX_RESOLUTION) */
int vdpi; /* if (flags & gdFTEX_RESOLUTION) */
char *xshow; /* if (flags & gdFTEX_XSHOW)
then, on return, xshow is a malloc'ed
string contining xshow position data for
the last string.
NB. The caller is responsible for gdFree'ing
the xshow string.
*/
char *fontpath; /* if (flags & gdFTEX_RETURNFONTPATHNAME)
then, on return, fontpath is a malloc'ed
string containing the actual font file path name
used, which can be interesting when fontconfig
is in use.
The caller is responsible for gdFree'ing the
fontpath string.
*/
}
gdFTStringExtra, *gdFTStringExtraPtr;
#define gdFTEX_LINESPACE 1
#define gdFTEX_CHARMAP 2
#define gdFTEX_RESOLUTION 4
#define gdFTEX_DISABLE_KERNING 8
#define gdFTEX_XSHOW 16
/* The default unless gdFTUseFontConfig(1); has been called:
fontlist is a full or partial font file pathname or list thereof
(i.e. just like before 2.0.29) */
#define gdFTEX_FONTPATHNAME 32
/* Necessary to use fontconfig patterns instead of font pathnames
as the fontlist argument, unless gdFTUseFontConfig(1); has
been called. New in 2.0.29 */
#define gdFTEX_FONTCONFIG 64
/* Sometimes interesting when fontconfig is used: the fontpath
element of the structure above will contain a gdMalloc'd string
copy of the actual font file pathname used, if this flag is set
when the call is made */
#define gdFTEX_RETURNFONTPATHNAME 128
/* If flag is nonzero, the fontlist parameter to gdImageStringFT
and gdImageStringFTEx shall be assumed to be a fontconfig font pattern
if fontconfig was compiled into gd. This function returns zero
if fontconfig is not available, nonzero otherwise. */
BGD_DECLARE(int) gdFTUseFontConfig(int flag);
/* These are NOT flags; set one in 'charmap' if you set the
gdFTEX_CHARMAP bit in 'flags'. */
#define gdFTEX_Unicode 0
#define gdFTEX_Shift_JIS 1
#define gdFTEX_Big5 2
#define gdFTEX_Adobe_Custom 3
BGD_DECLARE(char *) gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
double ptsize, double angle, int x, int y,
char *string, gdFTStringExtraPtr strex);
/* Point type for use in polygon drawing. */
typedef struct
{
int x, y;
}
gdPoint, *gdPointPtr;
BGD_DECLARE(void) gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c);
BGD_DECLARE(void) gdImageOpenPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
BGD_DECLARE(void) gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
/* These functions still work with truecolor images,
for which they never return error. */
BGD_DECLARE(int) gdImageColorAllocate (gdImagePtr im, int r, int g, int b);
/* gd 2.0: palette entries with non-opaque transparency are permitted. */
BGD_DECLARE(int) gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a);
/* Assumes opaque is the preferred alpha channel value */
BGD_DECLARE(int) gdImageColorClosest (gdImagePtr im, int r, int g, int b);
/* Closest match taking all four parameters into account.
A slightly different color with the same transparency
beats the exact same color with radically different
transparency */
BGD_DECLARE(int) gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a);
/* An alternate method */
BGD_DECLARE(int) gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b);
/* Returns exact, 100% opaque matches only */
BGD_DECLARE(int) gdImageColorExact (gdImagePtr im, int r, int g, int b);
/* Returns an exact match only, including alpha */
BGD_DECLARE(int) gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a);
/* Opaque only */
BGD_DECLARE(int) gdImageColorResolve (gdImagePtr im, int r, int g, int b);
/* Based on gdImageColorExactAlpha and gdImageColorClosestAlpha */
BGD_DECLARE(int) gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a);
/* A simpler way to obtain an opaque truecolor value for drawing on a
truecolor image. Not for use with palette images! */
#define gdTrueColor(r, g, b) (((r) << 16) + \
((g) << 8) + \
(b))
/* Returns a truecolor value with an alpha channel component.
gdAlphaMax (127, **NOT 255**) is transparent, 0 is completely
opaque. */
#define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \
((r) << 16) + \
((g) << 8) + \
(b))
BGD_DECLARE(void) gdImageColorDeallocate (gdImagePtr im, int color);
/* Converts a truecolor image to a palette-based image,
using a high-quality two-pass quantization routine
which attempts to preserve alpha channel information
as well as R/G/B color information when creating
a palette. If ditherFlag is set, the image will be
dithered to approximate colors better, at the expense
of some obvious "speckling." colorsWanted can be
anything up to 256. If the original source image
includes photographic information or anything that
came out of a JPEG, 256 is strongly recommended.
Better yet, don't use these function -- write real
truecolor PNGs and JPEGs. The disk space gain of
conversion to palette is not great (for small images
it can be negative) and the quality loss is ugly.
DIFFERENCES: gdImageCreatePaletteFromTrueColor creates and
returns a new image. gdImageTrueColorToPalette modifies
an existing image, and the truecolor pixels are discarded. */
BGD_DECLARE(gdImagePtr) gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag,
int colorsWanted);
BGD_DECLARE(void) gdImageTrueColorToPalette (gdImagePtr im, int ditherFlag,
int colorsWanted);
/* Specifies a color index (if a palette image) or an
RGB color (if a truecolor image) which should be
considered 100% transparent. FOR TRUECOLOR IMAGES,
THIS IS IGNORED IF AN ALPHA CHANNEL IS BEING
SAVED. Use gdImageSaveAlpha(im, 0); to
turn off the saving of a full alpha channel in
a truecolor image. Note that gdImageColorTransparent
is usually compatible with older browsers that
do not understand full alpha channels well. TBB */
BGD_DECLARE(void) gdImageColorTransparent (gdImagePtr im, int color);
BGD_DECLARE(void) gdImagePaletteCopy (gdImagePtr dst, gdImagePtr src);
BGD_DECLARE(void) gdImageGif (gdImagePtr im, FILE * out);
BGD_DECLARE(void) gdImagePng (gdImagePtr im, FILE * out);
BGD_DECLARE(void) gdImagePngCtx (gdImagePtr im, gdIOCtx * out);
BGD_DECLARE(void) gdImageGifCtx (gdImagePtr im, gdIOCtx * out);
/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
1 is FASTEST but produces larger files, 9 provides the best
compression (smallest files) but takes a long time to compress, and
-1 selects the default compiled into the zlib library. */
BGD_DECLARE(void) gdImagePngEx (gdImagePtr im, FILE * out, int level);
BGD_DECLARE(void) gdImagePngCtxEx (gdImagePtr im, gdIOCtx * out, int level);
BGD_DECLARE(void) gdImageWBMP (gdImagePtr image, int fg, FILE * out);
BGD_DECLARE(void) gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out);
/* Guaranteed to correctly free memory returned
by the gdImage*Ptr functions */
BGD_DECLARE(void) gdFree (void *m);
/* Best to free this memory with gdFree(), not free() */
BGD_DECLARE(void *) gdImageWBMPPtr (gdImagePtr im, int *size, int fg);
/* 100 is highest quality (there is always a little loss with JPEG).
0 is lowest. 10 is about the lowest useful setting. */
BGD_DECLARE(void) gdImageJpeg (gdImagePtr im, FILE * out, int quality);
BGD_DECLARE(void) gdImageJpegCtx (gdImagePtr im, gdIOCtx * out, int quality);
/* Best to free this memory with gdFree(), not free() */
BGD_DECLARE(void *) gdImageJpegPtr (gdImagePtr im, int *size, int quality);
/* Legal values for Disposal. gdDisposalNone is always used by
the built-in optimizer if previm is passed. */
enum {
gdDisposalUnknown,
gdDisposalNone,
gdDisposalRestoreBackground,
gdDisposalRestorePrevious
};
BGD_DECLARE(void) gdImageGifAnimBegin(gdImagePtr im, FILE *outFile, int GlobalCM, int Loops);
BGD_DECLARE(void) gdImageGifAnimAdd(gdImagePtr im, FILE *outFile, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
BGD_DECLARE(void) gdImageGifAnimEnd(FILE *outFile);
BGD_DECLARE(void) gdImageGifAnimBeginCtx(gdImagePtr im, gdIOCtx *out, int GlobalCM, int Loops);
BGD_DECLARE(void) gdImageGifAnimAddCtx(gdImagePtr im, gdIOCtx *out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
BGD_DECLARE(void) gdImageGifAnimEndCtx(gdIOCtx *out);
BGD_DECLARE(void *) gdImageGifAnimBeginPtr(gdImagePtr im, int *size, int GlobalCM, int Loops);
BGD_DECLARE(void *) gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
BGD_DECLARE(void *) gdImageGifAnimEndPtr(int *size);
/* A custom data sink. For backwards compatibility. Use
gdIOCtx instead. */
/* The sink function must return -1 on error, otherwise the number
of bytes written, which must be equal to len. */
/* context will be passed to your sink function. */
typedef struct
{
int (*sink) (void *context, const char *buffer, int len);
void *context;
}
gdSink, *gdSinkPtr;
BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr out);
BGD_DECLARE(void) gdImageGd (gdImagePtr im, FILE * out);
BGD_DECLARE(void) gdImageGd2 (gdImagePtr im, FILE * out, int cs, int fmt);
/* Best to free this memory with gdFree(), not free() */
BGD_DECLARE(void *) gdImageGifPtr (gdImagePtr im, int *size);
/* Best to free this memory with gdFree(), not free() */
BGD_DECLARE(void *) gdImagePngPtr (gdImagePtr im, int *size);
BGD_DECLARE(void *) gdImagePngPtrEx (gdImagePtr im, int *size, int level);
/* Best to free this memory with gdFree(), not free() */
BGD_DECLARE(void *) gdImageGdPtr (gdImagePtr im, int *size);
/* Best to free this memory with gdFree(), not free() */
BGD_DECLARE(void *) gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size);
BGD_DECLARE(void) gdImageEllipse (gdImagePtr im, int cx, int cy, int w, int h,
int color);
/* Style is a bitwise OR ( | operator ) of these.
gdArc and gdChord are mutually exclusive;
gdChord just connects the starting and ending
angles with a straight line, while gdArc produces
a rounded edge. gdPie is a synonym for gdArc.
gdNoFill indicates that the arc or chord should be
outlined, not filled. gdEdged, used together with
gdNoFill, indicates that the beginning and ending
angles should be connected to the center; this is
a good way to outline (rather than fill) a
'pie slice'. */
#define gdArc 0
#define gdPie gdArc
#define gdChord 1
#define gdNoFill 2
#define gdEdged 4
BGD_DECLARE(void) gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s,
int e, int color, int style);
BGD_DECLARE(void) gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e,
int color);
BGD_DECLARE(void) gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color);
BGD_DECLARE(void) gdImageFilledEllipse (gdImagePtr im, int cx, int cy, int w, int h,
int color);
BGD_DECLARE(void) gdImageFillToBorder (gdImagePtr im, int x, int y, int border,
int color);
BGD_DECLARE(void) gdImageFill (gdImagePtr im, int x, int y, int color);
BGD_DECLARE(void) gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
int srcX, int srcY, int w, int h);
BGD_DECLARE(void) gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
int srcX, int srcY, int w, int h, int pct);
BGD_DECLARE(void) gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX,
int dstY, int srcX, int srcY, int w, int h,
int pct);
/* Stretches or shrinks to fit, as needed. Does NOT attempt
to average the entire set of source pixels that scale down onto the
destination pixel. */
BGD_DECLARE(void) gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
int srcX, int srcY, int dstW, int dstH, int srcW,
int srcH);
/* gd 2.0: stretches or shrinks to fit, as needed. When called with a
truecolor destination image, this function averages the
entire set of source pixels that scale down onto the
destination pixel, taking into account what portion of the
destination pixel each source pixel represents. This is a
floating point operation, but this is not a performance issue
on modern hardware, except for some embedded devices. If the
destination is a palette image, gdImageCopyResized is
substituted automatically. */
BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX,
int dstY, int srcX, int srcY, int dstW, int dstH,
int srcW, int srcH);
/* gd 2.0.8: gdImageCopyRotated is added. Source
is a rectangle, with its upper left corner at
srcX and srcY. Destination is the *center* of
the rotated copy. Angle is in degrees, same as
gdImageArc. Floating point destination center
coordinates allow accurate rotation of
objects of odd-numbered width or height. */
BGD_DECLARE(void) gdImageCopyRotated (gdImagePtr dst,
gdImagePtr src,
double dstX, double dstY,
int srcX, int srcY,
int srcWidth, int srcHeight, int angle);
BGD_DECLARE(void) gdImageSetBrush (gdImagePtr im, gdImagePtr brush);
BGD_DECLARE(void) gdImageSetTile (gdImagePtr im, gdImagePtr tile);
BGD_DECLARE(void) gdImageSetAntiAliased (gdImagePtr im, int c);
BGD_DECLARE(void) gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend);
BGD_DECLARE(void) gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels);
/* Line thickness (defaults to 1). Affects lines, ellipses,
rectangles, polygons and so forth. */
BGD_DECLARE(void) gdImageSetThickness (gdImagePtr im, int thickness);
/* On or off (1 or 0) for all three of these. */
BGD_DECLARE(void) gdImageInterlace (gdImagePtr im, int interlaceArg);
BGD_DECLARE(void) gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg);
BGD_DECLARE(void) gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg);
/* Macros to access information about images. */
/* Returns nonzero if the image is a truecolor image,
zero for a palette image. */
#define gdImageTrueColor(im) ((im)->trueColor)
#define gdImageSX(im) ((im)->sx)
#define gdImageSY(im) ((im)->sy)
#define gdImageColorsTotal(im) ((im)->colorsTotal)
#define gdImageRed(im, c) ((im)->trueColor ? gdTrueColorGetRed(c) : \
(im)->red[(c)])
#define gdImageGreen(im, c) ((im)->trueColor ? gdTrueColorGetGreen(c) : \
(im)->green[(c)])
#define gdImageBlue(im, c) ((im)->trueColor ? gdTrueColorGetBlue(c) : \
(im)->blue[(c)])
#define gdImageAlpha(im, c) ((im)->trueColor ? gdTrueColorGetAlpha(c) : \
(im)->alpha[(c)])
#define gdImageGetTransparent(im) ((im)->transparent)
#define gdImageGetInterlaced(im) ((im)->interlace)
/* These macros provide direct access to pixels in
palette-based and truecolor images, respectively.
If you use these macros, you must perform your own
bounds checking. Use of the macro for the correct type
of image is also your responsibility. */
#define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)]
#define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)]
/* I/O Support routines. */
BGD_DECLARE(gdIOCtx *) gdNewFileCtx (FILE *);
/* If data is null, size is ignored and an initial data buffer is
allocated automatically. NOTE: this function assumes gd has the right
to free or reallocate "data" at will! Also note that gd will free
"data" when the IO context is freed. If data is not null, it must point
to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr.
If not, see gdNewDynamicCtxEx for an alternative. */
BGD_DECLARE(gdIOCtx *) gdNewDynamicCtx (int size, void *data);
/* 2.0.21: if freeFlag is nonzero, gd will free and/or reallocate "data" as
needed as described above. If freeFlag is zero, gd will never free
or reallocate "data," which means that the context should only be used
for *reading* an image from a memory buffer, or writing an image to a
memory buffer which is already large enough. If the memory buffer is
not large enough and an image write is attempted, the write operation
will fail. Those wishing to write an image to a buffer in memory have
a much simpler alternative in the gdImage[something]Ptr functions. */
BGD_DECLARE(gdIOCtx *) gdNewDynamicCtxEx (int size, void *data, int freeFlag);
BGD_DECLARE(gdIOCtx *) gdNewSSCtx (gdSourcePtr in, gdSinkPtr out);
BGD_DECLARE(void *) gdDPExtractData (struct gdIOCtx *ctx, int *size);
#define GD2_CHUNKSIZE 128
#define GD2_CHUNKSIZE_MIN 64
#define GD2_CHUNKSIZE_MAX 4096
#define GD2_VERS 2
#define GD2_ID "gd2"
#define GD2_FMT_RAW 1
#define GD2_FMT_COMPRESSED 2
/* Image comparison definitions */
BGD_DECLARE(int) gdImageCompare (gdImagePtr im1, gdImagePtr im2);
#define GD_CMP_IMAGE 1 /* Actual image IS different */
#define GD_CMP_NUM_COLORS 2 /* Number of Colours in pallette differ */
#define GD_CMP_COLOR 4 /* Image colours differ */
#define GD_CMP_SIZE_X 8 /* Image width differs */
#define GD_CMP_SIZE_Y 16 /* Image heights differ */
#define GD_CMP_TRANSPARENT 32 /* Transparent colour */
#define GD_CMP_BACKGROUND 64 /* Background colour */
#define GD_CMP_INTERLACE 128 /* Interlaced setting */
#define GD_CMP_TRUECOLOR 256 /* Truecolor vs palette differs */
/* resolution affects ttf font rendering, particularly hinting */
#define GD_RESOLUTION 96 /* pixels per inch */
#ifdef __cplusplus
}
#endif
/* newfangled special effects */
#include "gdfx.h"
#endif /* GD_H */
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,55 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef GD_IO_H
#define GD_IO_H 1
#include <stdio.h>
#ifdef VMS
#define Putchar gdPutchar
#endif
typedef struct gdIOCtx
{
int (*getC) (struct gdIOCtx *);
int (*getBuf) (struct gdIOCtx *, void *, int);
void (*putC) (struct gdIOCtx *, int);
int (*putBuf) (struct gdIOCtx *, const void *, int);
/* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
int (*seek) (struct gdIOCtx *, const int);
long (*tell) (struct gdIOCtx *);
void (*gd_free) (struct gdIOCtx *);
}
gdIOCtx;
typedef struct gdIOCtx *gdIOCtxPtr;
void Putword (int w, gdIOCtx * ctx);
void Putchar (int c, gdIOCtx * ctx);
void gdPutC (const unsigned char c, gdIOCtx * ctx);
int gdPutBuf (const void *, int, gdIOCtx *);
void gdPutWord (int w, gdIOCtx * ctx);
void gdPutInt (int w, gdIOCtx * ctx);
int gdGetC (gdIOCtx * ctx);
int gdGetBuf (void *, int, gdIOCtx *);
int gdGetByte (int *result, gdIOCtx * ctx);
int gdGetWord (int *result, gdIOCtx * ctx);
int gdGetInt (int *result, gdIOCtx * ctx);
int gdSeek (gdIOCtx * ctx, const int offset);
long gdTell (gdIOCtx * ctx);
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,93 @@
#ifdef __cplusplus
extern "C" {
#endif
/*
* gdcache.h
*
* Caches of pointers to user structs in which the least-recently-used
* element is replaced in the event of a cache miss after the cache has
* reached a given size.
*
* John Ellson (ellson@graphviz.org) Oct 31, 1997
*
* Test this with:
* gcc -o gdcache -g -Wall -DTEST gdcache.c
*
* The cache is implemented by a singly-linked list of elements
* each containing a pointer to a user struct that is being managed by
* the cache.
*
* The head structure has a pointer to the most-recently-used
* element, and elements are moved to this position in the list each
* time they are used. The head also contains pointers to three
* user defined functions:
* - a function to test if a cached userdata matches some keydata
* - a function to provide a new userdata struct to the cache
* if there has been a cache miss.
* - a function to release a userdata struct when it is
* no longer being managed by the cache
*
* In the event of a cache miss the cache is allowed to grow up to
* a specified maximum size. After the maximum size is reached then
* the least-recently-used element is discarded to make room for the
* new. The most-recently-returned value is always left at the
* beginning of the list after retrieval.
*
* In the current implementation the cache is traversed by a linear
* search from most-recent to least-recent. This linear search
* probably limits the usefulness of this implementation to cache
* sizes of a few tens of elements.
*/
/*********************************************************/
/* header */
/*********************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#ifndef NULL
#define NULL (void *)0
#endif
/* user defined function templates */
typedef int (*gdCacheTestFn_t) (void *userdata, void *keydata);
typedef void *(*gdCacheFetchFn_t) (char **error, void *keydata);
typedef void (*gdCacheReleaseFn_t) (void *userdata);
/* element structure */
typedef struct gdCache_element_s gdCache_element_t;
struct gdCache_element_s
{
gdCache_element_t *next;
void *userdata;
};
/* head structure */
typedef struct gdCache_head_s gdCache_head_t;
struct gdCache_head_s
{
gdCache_element_t *mru;
int size;
char *error;
gdCacheTestFn_t gdCacheTest;
gdCacheFetchFn_t gdCacheFetch;
gdCacheReleaseFn_t gdCacheRelease;
};
/* function templates */
gdCache_head_t *gdCacheCreate (int size,
gdCacheTestFn_t gdCacheTest,
gdCacheFetchFn_t gdCacheFetch,
gdCacheReleaseFn_t gdCacheRelease);
void gdCacheDelete (gdCache_head_t * head);
void *gdCacheGet (gdCache_head_t * head, void *keydata);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,38 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _GDFONTG_H_
#define _GDFONTG_H_ 1
#ifdef __cplusplus
extern "C"
{
#endif
/*
This is a header file for gd font, generated using
bdftogd version 0.51 by Jan Pazdziora, adelton@fi.muni.cz
from bdf font
-Misc-Fixed-Bold-R-Normal-Sans-15-140-75-75-C-90-ISO8859-2
at Mon Jan 26 14:45:58 1998.
The original bdf was holding following copyright:
"Libor Skarvada, libor@informatics.muni.cz"
*/
#include "gd.h"
BGD_EXPORT_DATA_PROT gdFontPtr gdFontGiant;
BGD_DECLARE(gdFontPtr) gdFontGetGiant(void);
#ifdef __cplusplus
}
#endif
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,39 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _GDFONTL_H_
#define _GDFONTL_H_ 1
#ifdef __cplusplus
extern "C"
{
#endif
/*
This is a header file for gd font, generated using
bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
from bdf font
-misc-fixed-medium-r-normal--16-140-75-75-c-80-iso8859-2
at Tue Jan 6 19:39:27 1998.
The original bdf was holding following copyright:
"Libor Skarvada, libor@informatics.muni.cz"
*/
#include "gd.h"
BGD_EXPORT_DATA_PROT gdFontPtr gdFontLarge;
BGD_DECLARE(gdFontPtr) gdFontGetLarge(void);
#ifdef __cplusplus
}
#endif
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,37 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _GDFONTMB_H_
#define _GDFONTMB_H_ 1
#ifdef __cplusplus
extern "C"
{
#endif
/*
This is a header file for gd font, generated using
bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
from bdf font
-misc-fixed-bold-r-normal-sans-13-94-100-100-c-70-iso8859-2
at Thu Jan 8 13:54:57 1998.
No copyright info was found in the original bdf.
*/
#include "gd.h"
BGD_EXPORT_DATA_PROT gdFontPtr gdFontMediumBold;
BGD_DECLARE(gdFontPtr) gdFontGetMediumBold(void);
#ifdef __cplusplus
}
#endif
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,37 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _GDFONTS_H_
#define _GDFONTS_H_ 1
#ifdef __cplusplus
extern "C"
{
#endif
/*
This is a header file for gd font, generated using
bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
from bdf font
-misc-fixed-medium-r-semicondensed-sans-12-116-75-75-c-60-iso8859-2
at Thu Jan 8 14:13:20 1998.
No copyright info was found in the original bdf.
*/
#include "gd.h"
BGD_EXPORT_DATA_PROT gdFontPtr gdFontSmall;
BGD_DECLARE(gdFontPtr) gdFontGetSmall(void);
#ifdef __cplusplus
}
#endif
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,38 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _GDFONTT_H_
#define _GDFONTT_H_ 1
#ifdef __cplusplus
extern "C"
{
#endif
/*
This is a header file for gd font, generated using
bdftogd version 0.5 by Jan Pazdziora, adelton@fi.muni.cz
from bdf font
-Misc-Fixed-Medium-R-Normal--8-80-75-75-C-50-ISO8859-2
at Thu Jan 8 13:49:54 1998.
The original bdf was holding following copyright:
"Libor Skarvada, libor@informatics.muni.cz"
*/
#include "gd.h"
BGD_EXPORT_DATA_PROT gdFontPtr gdFontTiny;
BGD_DECLARE(gdFontPtr) gdFontGetTiny(void);
#ifdef __cplusplus
}
#endif
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,73 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef GDFX_H
#define GDFX_H 1
#include "gd.h"
/* im MUST be square, but can have any size. Returns a new image
of width and height radius * 2, in which the X axis of
the original has been remapped to theta (angle) and the Y axis
of the original has been remapped to rho (distance from center).
This is known as a "polar coordinate transform." */
BGD_DECLARE(gdImagePtr) gdImageSquareToCircle(gdImagePtr im, int radius);
/* Draws the text 'top' and 'bottom' on 'im', curved along the
edge of a circle of radius 'radius', with its
center at 'cx' and 'cy'. 'top' is written clockwise
along the top; 'bottom' is written counterclockwise
along the bottom. 'textRadius' determines the 'height'
of each character; if 'textRadius' is 1/2 of 'radius',
characters extend halfway from the edge to the center.
'fillPortion' varies from 0 to 1.0, with useful values
from about 0.4 to 0.9, and determines how much of the
180 degrees of arc assigned to each section of text
is actually occupied by text; 0.9 looks better than
1.0 which is rather crowded. 'font' is a freetype
font; see gdImageStringFT. 'points' is passed to the
freetype engine and has an effect on hinting; although
the size of the text is determined by radius, textRadius,
and fillPortion, you should pass a point size that
'hints' appropriately -- if you know the text will be
large, pass a large point size such as 24.0 to get the
best results. 'fgcolor' can be any color, and may have
an alpha component, do blending, etc.
Returns 0 on success, or an error string. */
BGD_DECLARE(char *) gdImageStringFTCircle(
gdImagePtr im,
int cx,
int cy,
double radius,
double textRadius,
double fillPortion,
char *font,
double points,
char *top,
char *bottom,
int fgcolor);
/* 2.0.16:
* Sharpen function added on 2003-11-19
* by Paul Troughton (paul<dot>troughton<at>ieee<dot>org)
* Simple 3x3 convolution kernel
* Makes use of seperability
* Faster, but less flexible, than full-blown unsharp masking
* pct is sharpening percentage, and can be greater than 100
* Silently does nothing to non-truecolor images
* Silently does nothing for pct<0, as not a useful blurring function
* Leaves transparency/alpha-channel untouched
*/
BGD_DECLARE(void) gdImageSharpen (gdImagePtr im, int pct);
#endif /* GDFX_H */
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,61 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef GDHELPERS_H
#define GDHELPERS_H 1
/* sys/types.h is needed for size_t on Sparc-SunOS-4.1 */
#include <sys/types.h>
/* TBB: strtok_r is not universal; provide an implementation of it. */
char * gd_strtok_r (char *s, char *sep, char **state);
/* These functions wrap memory management. gdFree is
in gd.h, where callers can utilize it to correctly
free memory allocated by these functions with the
right version of free(). */
void *gdCalloc (size_t nmemb, size_t size);
void *gdMalloc (size_t size);
void *gdRealloc (void *ptr, size_t size);
/* Returns nonzero if multiplying the two quantities will
result in integer overflow. Also returns nonzero if
either quantity is negative. By Phil Knirsch based on
netpbm fixes by Alan Cox. */
int overflow2(int a, int b);
/* 2.0.16: portable mutex support for thread safety. */
#ifdef WIN32
/* 2.0.18: must include windows.h to get CRITICAL_SECTION. */
#include <windows.h>
#define gdMutexDeclare(x) CRITICAL_SECTION x
#define gdMutexSetup(x) InitializeCriticalSection(&x)
#define gdMutexShutdown(x) DeleteCriticalSection(&x)
#define gdMutexLock(x) EnterCriticalSection(&x)
#define gdMutexUnlock(x) LeaveCriticalSection(&x)
#else
#ifdef HAVE_PTHREAD
#include <pthread.h>
#define gdMutexDeclare(x) pthread_mutex_t x
#define gdMutexSetup(x) pthread_mutex_init(&x, 0)
#define gdMutexShutdown(x) pthread_mutex_destroy(&x)
#define gdMutexLock(x) pthread_mutex_lock(&x)
#define gdMutexUnlock(x) pthread_mutex_unlock(&x)
#else
#define gdMutexDeclare(x)
#define gdMutexSetup(x)
#define gdMutexShutdown(x)
#define gdMutexLock(x)
#define gdMutexUnlock(x)
#endif /* HAVE_PTHREAD */
#endif /* WIN32 */
#endif /* GDHELPERS_H */
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
#ifdef __cplusplus
extern "C" {
#endif
/* WBMP
** ----
** WBMP Level 0: B/W, Uncompressed
** This implements the WBMP format as specified in WAPSpec 1.1 and 1.2.
** It does not support ExtHeaders as defined in the spec. The spec states
** that a WAP client does not need to implement ExtHeaders.
**
** (c) 2000 Johan Van den Brande <johan@vandenbrande.com>
**
** Header file
*/
#ifndef __WBMP_H
#define __WBMP_H 1
/* WBMP struct
** -----------
** A Wireless bitmap structure
**
*/
typedef struct Wbmp_
{
int type; /* type of the wbmp */
int width; /* width of the image */
int height; /* height of the image */
int *bitmap; /* pointer to data: 0 = WHITE , 1 = BLACK */
}
Wbmp;
#define WBMP_WHITE 1
#define WBMP_BLACK 0
/* Proto's
** -------
**
*/
void putmbi (int i, void (*putout) (int c, void *out), void *out);
int getmbi (int (*getin) (void *in), void *in);
int skipheader (int (*getin) (void *in), void *in);
Wbmp *createwbmp (int width, int height, int color);
int readwbmp (int (*getin) (void *in), void *in, Wbmp ** wbmp);
int writewbmp (Wbmp * wbmp, void (*putout) (int c, void *out), void *out);
void freewbmp (Wbmp * wbmp);
void printwbmp (Wbmp * wbmp);
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,60 @@
@echo off
if "%1" == "clean" goto CLEAN
if "%1" == "CLEAN" goto CLEAN
:BUILD
if not exist bgd.dll goto NODLL
make -fmakefile.bc %1 %2 %3 > make_b32.log
if errorlevel 1 goto BUILD_ERR
impdef -a ..\..\lib\b32\libbgd.def bgd.dll > make_b32.log
if errorlevel 1 goto BUILD_ERR
implib -a ..\..\lib\b32\libbgd.lib ..\..\lib\b32\libbgd.def > make_b32.log
if errorlevel 1 goto BUILD_ERR
:BUILD_OK
copy ..\..\lib\b32\libbgd.lib ..\..\lib > nul
copy ..\..\lib\b32\hbgd.lib ..\..\lib > nul
goto EXIT
:BUILD_ERR
notepad make_b32.log
goto EXIT
:CLEAN
if exist ..\..\lib\b32\hbgd.lib del ..\..\lib\b32\hbgd.lib
if exist ..\..\lib\b32\hbgd.bak del ..\..\lib\b32\hbgd.bak
if exist ..\..\obj\b32\gdwrp.obj del ..\..\obj\b32\gdwrp.obj
if exist ..\..\obj\b32\gd.c del ..\..\obj\b32\gd.c
if exist ..\..\obj\b32\gdimage.c del ..\..\obj\b32\gdimage.c
if exist ..\..\obj\b32\gdchart.c del ..\..\obj\b32\gdchart.c
if exist ..\..\obj\b32\gdbar.c del ..\..\obj\b32\gdbar.c
if exist ..\..\obj\b32\gdbarcod.c del ..\..\obj\b32\gdbarcod.c
if exist ..\..\obj\b32\gd.obj del ..\..\obj\b32\gd.obj
if exist ..\..\obj\b32\gdimage.obj del ..\..\obj\b32\gdimage.obj
if exist ..\..\obj\b32\gdchart.obj del ..\..\obj\b32\gdchart.obj
if exist ..\..\obj\b32\gdbar.obj del ..\..\obj\b32\gdbar.obj
if exist ..\..\obj\b32\gdbarcod.obj del ..\..\obj\b32\gdbarcod.obj
goto EXIT
:NODLL
echo.
echo.Missing bgd.dll, please download it from:
echo.http://www.libgd.org/Downloads (Windows.DLL)
echo.
echo.Make aborted.
echo.
:EXIT

View File

@@ -0,0 +1,45 @@
#
# $Id$
#
# makefile for Borland C/C++ 32 bits
# Building of mysql.lib - Harbour API to mySQL
INCLUDE_DIR = include;..\..\include
BIN_DIR = ..\..\bin\b32
OBJ_DIR = ..\..\obj\b32
LIB_DIR = ..\..\lib\b32
$(LIB_DIR)\hbgd.lib : \
$(OBJ_DIR)\gdwrp.obj \
$(OBJ_DIR)\gd.obj \
$(OBJ_DIR)\gdimage.obj \
$(OBJ_DIR)\gdchart.obj \
$(OBJ_DIR)\gdbar.obj \
$(OBJ_DIR)\gdbarcod.obj
$(OBJ_DIR)\gd.c : gd.prg
$(OBJ_DIR)\gd.obj : $(OBJ_DIR)\gd.c
$(OBJ_DIR)\gdimage.c : gdimage.prg
$(OBJ_DIR)\gdimage.obj : $(OBJ_DIR)\gdimage.c
$(OBJ_DIR)\gdchart.c : gdchart.prg
$(OBJ_DIR)\gdchart.obj : $(OBJ_DIR)\gdchart.c
$(OBJ_DIR)\gdbar.c : gdbar.prg
$(OBJ_DIR)\gdbar.obj : $(OBJ_DIR)\gdbar.c
$(OBJ_DIR)\gdbarcod.c : gdbarcod.prg
$(OBJ_DIR)\gdbarcod.obj : $(OBJ_DIR)\gdbarcod.c
$(OBJ_DIR)\gdwrp.obj : gdwrp.c
.c.obj:
bcc32 $(CLIBFLAGS) -c -O2 -I$(INCLUDE_DIR) -DHB_OS_WIN_32_USED -o$@ $<
tlib $(LIB_DIR)\hbgd.lib -+$@,,
.prg.c:
$(BIN_DIR)\harbour.exe $< -q0 -w -es2 -gc0 -n -i$(INCLUDE_DIR) -o$@

View File

@@ -22,10 +22,12 @@ PROCEDURE Main()
LOCAL black, white, trans
LOCAL hFile
/*
// Check output directory
IF !ISDirectory( IMAGES_OUT )
DirMake( IMAGES_OUT )
ENDIF
*/
/* Create the image */
im = gdImageCreate(100, 100)

View File

@@ -19,10 +19,12 @@ PROCEDURE Main()
LOCAL im
LOCAL white, blue, black
/*
// Check output directory
IF !ISDirectory( IMAGES_OUT )
DirMake( IMAGES_OUT )
ENDIF
*/
/*
This sample shows differences on use of antiliased command between a

View File

@@ -1,3 +1,6 @@
#define IMAGES_OUT "images_out/"
Function Main()
local bar
@@ -64,9 +67,9 @@ Function Main()
bar:Configure( 50 , black, white, 2 , 1 )
// output image
bar:out_img := "image/"
//bar:out_img := "image_out/"
bar:CreateBar( 559, 88,"Bar128",white)
bar:CreateBar( 559, 88, IMAGES_OUT + "Bar128",white)
// 1- code bar
// 2- barcode types A/B/C
@@ -83,8 +86,8 @@ Function Main()
bar:Configure( 25 , black, white, 1 , 1, , .T. )
// output image
bar:out_img := "febraban/"
bar:CreateBar( 560 ,60, "febraban", white )
//bar:out_img := "febraban/"
bar:CreateBar( 560 ,60, IMAGES_OUT + "febraban", white )
bar:DrawI25("P48WBQ7BX3M73X8V3WRT7F9JW")
bar:Finish(8)
RETURN NIL

View File

@@ -1,3 +1,6 @@
#define IMAGES_OUT "images_out/"
Function Main()
local bar
@@ -64,7 +67,7 @@ Function Main()
bar:Configure( 50 , black, white, 2 , 1 )
bar:CreateBar( 300, 400,"Bar128",white)
bar:CreateBar( 300, 400, IMAGES_OUT + "Bar128",white)
// 1- code bar
// 2- barcode types A/B/C
@@ -80,7 +83,7 @@ Function Main()
bar:Configure( 25 , black, white, 1 , 1, , .T. )
bar:CreateBar( 560 ,60, "febraban", white )
bar:CreateBar( 560 ,60, IMAGES_OUT + "febraban", white )
bar:DrawI25("104995628545723070285700000008218000")
bar:Finish(8)

View File

@@ -0,0 +1,159 @@
@echo off
rem ***********************************************************
rem * bldtest.bat
rem *
rem * $Id$
rem *
rem * Batch file to build test programs in ST or MT environment
rem *
rem * (C) 2003 Francesco Saverio Giudice <info@fsgiudice.com>
rem *
rem ***********************************************************
rem *
rem * This is a generic batch file, if it doesn't fit your own needs
rem * please DON'T MODIFY IT.
rem *
rem * Instead, make a local copy and modify that one, or make a call to
rem * this batch file from your customized one.
rem *
rem ***********************************************************
rem Saving current HB_MT state
set OLDENVMT=%HB_MT%
set OLDENVGT=%HB_GT_LIB%
set OLDENVC=%CFLAGS%
set OLD_HB_ARCHITECTURE=%HB_ARCHITECTURE%
set OLD_HB_COMPILER=%HB_COMPILER%
set OLD_HB_USER_LIBS=%HB_USER_LIBS%
set HB_INSTALL=..\..\..
if %HB_ARCHITECTURE%.==. set HB_ARCHITECTURE=w32
if %HB_COMPILER%.==. set HB_COMPILER=bcc32
SET HB_BIN_INSTALL=%HB_INSTALL%\bin
set HB_INC_INSTALL=..;%HB_INSTALL%\include
set HB_LIB_INSTALL=%HB_INSTALL%\lib
set HB_USER_LIBS=%HB_LIB_INSTALL%\hbgd.lib %HB_LIB_INSTALL%\libbgd.lib %HB_LIB_INSTALL%\libct.lib
echo.
echo.BldTest.bat - /? or /h to display options
echo.
:ARGUMENTS
rem Check parameters
IF %1.==. GOTO SHOWHELP
IF %1.==/?. GOTO SHOWHELP
IF %1.==/H. GOTO SHOWHELP
IF %1.==/h. GOTO SHOWHELP
IF %1.==/MT. GOTO SETMT
IF %1.==/mt. GOTO SETMT
IF %1.==/cgi. GOTO SETCGI
IF %1.==/CGI. GOTO SETCGI
IF %1.==/WVT. GOTO SETWVT
IF %1.==/wvt. GOTO SETWVT
IF %BLDDEFAULT%.==N. GOTO CALLBLD
GOTO SETDEFAULT
:SETMT
echo.Setting MultiThread (MT) mode
echo.
SET HB_MT=mt
SHIFT
SET BLDDEFAULT=N
GOTO ARGUMENTS
:SETWVT
echo.Setting Windows Virtual Terminal (WVT) mode
echo.
SET HB_GT_LIB=gtwvt
SET CFLAGS=-W
SHIFT
SET BLDDEFAULT=N
GOTO ARGUMENTS
:SETCGI
echo.Setting CGI Terminal (CGI) mode
echo.
SET HB_GT_LIB=gtcgi
SET CFLAGS=
SHIFT
SET BLDDEFAULT=N
GOTO ARGUMENTS
:SETDEFAULT
echo.Setting Default Settings (ST/GTWIN) mode
echo.
SET HB_MT=
SET HB_GT_LIB=gtwin
:CALLBLD
echo.Running %HB_BIN_INSTALL%\bld.bat %1 %2 %3 %4 %5
echo.
echo.please wait ...
echo.
call %HB_BIN_INSTALL%\bld.bat %1 %2 %3 %4 %5 > bldtest.log
IF ERRORLEVEL 1 GOTO SHOWERROR
if exist %1.c del %1.c
if exist %1.obj del %1.obj
if exist %1.tds del %1.tds
if exist %2.c del %2.c
if exist %2.obj del %2.obj
if exist %2.tds del %2.tds
if exist %3.c del %3.c
if exist %3.obj del %3.obj
if exist %3.tds del %3.tds
GOTO COMPILEOK
:SHOWERROR
echo.
echo.Error on compiling ...
echo.
echo.Running notepad, please close to end this batch file ...
echo.
notepad bldtest.log
echo.
echo.Notepad closed, exiting ...
echo.
GOTO ENDSET
:COMPILEOK
echo.
echo.Compiled successfully
echo.
if exist bldtest.log del bldtest.log
GOTO ENDSET
:SHOWHELP
echo.
echo."bldtest [/MT|/mt|/CGI|/cgi|WVT|/wvt|/?|/H|/h] prgname"
echo.
echo. /MT = Set MT envinronment to build test program in MultiThread mode
echo. otherwise program will be compiled in SingleThread mode
echo. /CGI = Uses GTCGI instead of GTWIN to build test program.
echo. /WVT = Uses GTWVT instead of GTWIN to build test program.
echo. /? or /H = Show this help
echo. prgname = Name of prg file to compile without extension [.prg]
echo.
:ENDSET
rem Restore Old Settings
set HB_MT=%OLDENVMT%
set HB_GT_LIB=%OLDENVGT%
set CFLAGS=%OLDENVC%
set HB_ARCHITECTURE=%OLD_HB_ARCHITECTURE%
set HB_COMPILER=%OLD_HB_COMPILER%
set HB_USER_LIBS=%OLD_HB_USER_LIBS%
set OLDENVGT=
set OLDENVC=
set OLDENVMT=
set BLDDEFAULT=
set OLD_HB_ARCHITECTURE=
set OLD_HB_COMPILER=
set OLD_HB_USER_LIBS=
:END

View File

@@ -0,0 +1,22 @@
#!/bin/sh
INC_DIR="-I../../include:/usr/include"
MY_EXE=$1
shift
MY_FILES="$*"
MY_LIBS="-L../../lib -lgdlib -L/usr/lib -lgd -lpng -lz -ljpeg -lfreetype -lm -lct"
MY_GTLIB="-gtstd"
if [ -z ${MY_FILES} ]; then
MY_FILES=${MY_EXE};
fi
echo "Exe = ${MY_EXE}, Files = ${MY_FILES}"
echo "xhbcmp -n -w -es2 -go ${INC_DIR} ${MY_FILES}"
xhbcmp -n -w -es2 -go -I${INC_DIR} ${MY_FILES}
echo "xhblnk ${MY_GTLIB} *.o ${MY_LIBS} -o${MY_EXE}"
xhblnk ${MY_GTLIB} *.o ${MY_LIBS} -o${MY_EXE}
rm -f *.o

View File

@@ -46,7 +46,7 @@ PROCEDURE Main( cValue, cBaseImage )
cValue := StrZero( nValue, DISPLAY_NUM )
Tracelog( "Value", cValue )
? "Value = ", cValue
// To set fonts run this command:
// for windows: SET GDFONTPATH=c:\windows\fonts
@@ -61,9 +61,11 @@ PROCEDURE Main( cValue, cBaseImage )
//ENDIF
// Check output directory
/*
IF !ISDirectory( IMAGES_OUT )
DirMake( IMAGES_OUT )
ENDIF
*/
/* Load a digits image in memory from file */
oIDigits := GDImage():LoadFromGif( IMAGES_IN + cBaseImage )
@@ -87,7 +89,7 @@ PROCEDURE Main( cValue, cBaseImage )
ENDCASE
nNumWidth := nWidth / nDigits
Tracelog( "nNumWidth, nWidth, nHeight, nDigits", nNumWidth, nWidth, nHeight, nDigits )
? "nNumWidth, nWidth, nHeight, nDigits = ", nNumWidth, nWidth, nHeight, nDigits
/* extracts single digits */
FOR n := 1 TO nDigits
@@ -99,8 +101,8 @@ PROCEDURE Main( cValue, cBaseImage )
NEXT
/* Create counter image in memory */
oI := GDImage( nNumWidth * DISPLAY_NUM, nHeight ) // the counter
Tracelog( "Image dimensions: ", oI:Width(), oI:Height() )
oI := GDImage():New( nNumWidth * DISPLAY_NUM, nHeight ) // the counter
? "Image dimensions: ", oI:Width(), oI:Height()
/* Allocate background */
white := oI:SetColor( 255, 255, 255 )
@@ -118,7 +120,11 @@ PROCEDURE Main( cValue, cBaseImage )
/* Draw Digits */
FOR n := 1 TO Len( cValue )
// Retrieve the number from array in memory
#if ( defined( __HARBOUR__ ) .and. !defined( __COMP_FLAG_HB_COMPAT_XHB__ ) )
oTemp := aNumberImages[ Val( SubStr( cValue, n, 1 ) ) + 1 ]:Clone()
#else
oTemp := aNumberImages[ Val( cValue[ n ] ) + 1 ]:Clone()
#endif
// Save it to show the number for a position
oTemp:SaveGif( IMAGES_OUT + "Pos_" + StrZero( n, 2 ) + ".gif" )
// Set the digit as tile that I have to use to fill position in counter

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

View File

@@ -197,8 +197,8 @@ PROCEDURE Main()
NEXT
? "end", Seconds() - nSecs
oI4:SetTransparent( blue )
oI4:SayFreeType( oI4:CenterWidth()-4, oI4:CenterHeight()+4, "xHarbour", "verdana", 70, n, gray )
oI4:SayFreeType( oI4:CenterWidth(), oI4:CenterHeight(), "xHarbour", "verdana", 70, n, blue )
oI4:SayFreeType( oI4:CenterWidth()-4, oI4:CenterHeight()+4, "GD", "verdana", 70, n, gray )
oI4:SayFreeType( oI4:CenterWidth(), oI4:CenterHeight(), "GD", "verdana", 70, n, blue )
ENDIF
oI4:SaveJpeg( IMAGES_OUT + "writing.jpg" )
@@ -223,11 +223,11 @@ PROCEDURE Main()
oI5:Zoom( 40 )
//oI5:Rotate( 90 )
blue := oI5:SetColor(0, 0, 200)
oI5:SayFreeType( oI5:CenterWidth(), oI5:CenterHeight(), "xHarbour", "verdana", 20, 0, blue )
oI5:SaveJpeg( IMAGES_OUT + "xh_zoom.jpg" )
oI5:SayFreeType( oI5:CenterWidth(), oI5:CenterHeight(), "GD", "verdana", 20, 0, blue )
oI5:SaveJpeg( IMAGES_OUT + "gd_zoom.jpg" )
oI5 := GDChart( 400, 400 )
oI5 := GDChart():New( 400, 400 )
// Set background
white := oI5:SetColor(255, 255, 255)
// Define piece colors
@@ -237,7 +237,7 @@ PROCEDURE Main()
red := oI5:SetColor(250, 0, 0)
// Load an image as brush
oB := GDImage():LoadFromGif( IMAGES_IN + "italia.gif" )
oB := GDImage():LoadFromGif( IMAGES_IN + "theclipper.gif" )
oB:Zoom(15)
//oI5:Circle( 200, 200, oI5:Width() )
@@ -261,7 +261,7 @@ PROCEDURE Main()
oI5:SaveJpeg( IMAGES_OUT + "pie.jpg" )
oI5 := GDChart( 640, 480 )
oI5 := GDChart():New( 640, 480 )
// Set background
white := oI5:SetColor(255, 255, 255)
// Define piece colors
@@ -271,7 +271,7 @@ PROCEDURE Main()
red := oI5:SetColor(250, 0, 0)
// Load an image as brush
oB := GDImage():LoadFromJpeg( IMAGES_IN + "fsg.jpg" )
oB := GDImage():LoadFromJpeg( IMAGES_IN + "conv_test.jpeg" )
oB:Zoom(15)
// oI5:AddDef( "MAXVALUE", 150 )
@@ -311,12 +311,12 @@ PROCEDURE Main()
} )
//oI5:VerticalBarChart()
//oI5:HorizontalBarChart()
oI5:Clone():VerticalBarChart():SaveJpeg( IMAGES_OUT + "vertbars.jpg" )
oI5:Clone():HorizontalBarChart():SaveJpeg( IMAGES_OUT + "horzbars.jpg" )
oI5:LineChart()
oI5:SaveJpeg( IMAGES_OUT + "hystogram1.jpg" )
//oI5:LineChart()
//oI5:SaveJpeg( IMAGES_OUT + "hystogram.jpg" )
//oI4 := GDImage():CreateTrueColor( oI2:Width * 2, oI2:Height * 2 )
//oI2:CopyResampled( 0, 0, oI2:Width, oI2:Height, 0, 0, oI2:Width, oI2:Height, oI4 )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 5 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 230 B

View File

@@ -10,6 +10,7 @@
#include "gd.ch"
#include "common.ch"
#include "hbcompat.ch"
#command WRITE <c> => FWrite( 1, <c> + CHR(13)+CHR(10) )
#command OutHTML <c> => WRITE <c>

View File

@@ -13,7 +13,7 @@
PROCEDURE Main()
oI := GDImage:Create( 600, 300 )
oI := GDImage():Create( 600, 300 )
white := oI:SetColor( 255, 255, 255 )
black := oI:SetColor( 0, 0, 0 )

View File

@@ -24,13 +24,15 @@ PROCEDURE Main()
LOCAL oI5
LOCAL oB
/*
// Check output directory
IF !ISDirectory( IMAGES_OUT )
DirMake( IMAGES_OUT )
ENDIF
*/
/* Load an image from file */
oI := GDImage():LoadFromFile( IMAGES_IN + "xharbour.jpg" )
oI := GDImage():LoadFromFile( IMAGES_IN + "conv_test.jpeg" )
oI:SaveJpeg( IMAGES_OUT + "testfile.jpg" )