* contrib/gtalleg/tests/hbmk.hbm
* contrib/hbmysql/utils/hbmk.hbm
* contrib/hbmysql/utils/dbf2mysq.prg
* contrib/hbmysql/tests/test.prg
* contrib/hbmysql/tests/hbmk.hbm
* contrib/hbct/tests/tab.prg
* contrib/hbct/tests/tokensep.prg
* contrib/hbct/tests/datetime.prg
* contrib/hbct/tests/hbmk.hbm
* contrib/hbct/tests/token2.prg
* contrib/hbct/tests/charhist.prg
* contrib/xhb/tests/hbmk.hbm
* contrib/hbodbc/tests/hbmk.hbm
* contrib/hbtpathy/tests/hbmk.hbm
* contrib/hbmzip/tests/hbmk.hbm
* contrib/hbsqlit3/tests/hbmk.hbm
* contrib/hbsqlit3/tests/authoriz.prg
* contrib/hbblat/tests/hbmk.hbm
* contrib/hbqt/tests/hbmk.hbm
* contrib/hbfbird/tests/simple.prg
* contrib/hbfbird/tests/test.prg
* contrib/hbfbird/tests/hbmk.hbm
* contrib/hbziparc/tests/hbmk.hbm
* contrib/hbxbp/tests/hbmk.hbm
* contrib/hbnf/tests/ftgete.prg
* contrib/hbnf/tests/hbmk.hbm
* contrib/hbcurl/tests/ftp_uldl.prg
* contrib/hbcurl/tests/hbmk.hbm
* contrib/hbmemio/tests/hbmk.hbm
* contrib/gtqtc/tests/demoqtc.prg
* contrib/gtqtc/tests/hbmk.hbm
* contrib/hbnetio/utils/hbmk.hbm
* contrib/hbnetio/tests/hbmk.hbm
* contrib/rddsql/tests/hbmk.hbm
* contrib/hbhpdf/tests/harupdf.prg
* contrib/hbhpdf/tests/hbmk.hbm
* contrib/rddado/tests/hbmk.hbm
* contrib/gtwvg/tests/hbmk.hbm
* contrib/hbpgsql/tests/async.prg
* contrib/hbpgsql/tests/test.prg
* contrib/hbpgsql/tests/hbmk.hbm
* contrib/hbpgsql/tests/cache.prg
* contrib/hbpgsql/tests/stress.prg
* contrib/hbpgsql/tests/dbf2pg.prg
* contrib/hbclipsm/tests/hbmk.hbm
* contrib/rddads/tests/datad.prg
* contrib/rddads/tests/hbmk.hbm
* contrib/rddads/tests/testmg.prg
* contrib/hbfimage/tests/fitest.prg
* contrib/hbfimage/tests/hbmk.hbm
* contrib/hbgd/tests/tostring.prg
* contrib/hbgd/tests/gdtestcl.prg
* contrib/hbgd/tests/gdtest.prg
* contrib/hbgd/tests/animgif.prg
* contrib/hbgd/tests/testdpi.prg
* contrib/hbgd/tests/hbmk.hbm
* contrib/hbgd/tests/counter.prg
* contrib/hbgd/tests/antialia.prg
* contrib/hbgd/tests/bartest.prg
* contrib/hbgd/tests/barms.prg
* contrib/hbgd/tests/test_out.prg
* contrib/hbmisc/tests/testhbf.prg
* contrib/hbmisc/tests/hbmk.hbm
* contrib/hbmisc/tests/twirl.prg
* contrib/hbtip/tests/dnldftp.prg
* contrib/hbtip/tests/upld_ftp.prg
* contrib/hbtip/tests/dbtohtml.prg
* contrib/hbtip/tests/hbmk.hbm
* contrib/hbwin/hbwin.h
* contrib/hbwin/hbwin.ch
* contrib/hbwin/tests/testsim.prg
* contrib/hbwin/tests/testole.prg
* contrib/hbwin/tests/testcom2.prg
* contrib/hbwin/win_com.c
* contrib/hbssl/tests/hbmk.hbm
* contrib/hbbtree/tests/hbmk.hbm
! Fixed warnings and errors in test apps.
+ Added -es2 option to test/util default options.
* Renamed few macros in hbwin / win_com implementation:
FCN* -> WIN_COM_FUN_*
WPDBG* -> WIN_COM_DBG_*
; TOFIX: Some errors are left in hbgd/test_out.prg and
gtwvg to be fixed, now the can't be built.
Please do it.
121 lines
3.1 KiB
Plaintext
121 lines
3.1 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Copyright 2004-2005 Francesco Saverio Giudice <info@fsgiudice.com>
|
|
*
|
|
* GD API test file
|
|
*/
|
|
|
|
#include "gd.ch"
|
|
#include "common.ch"
|
|
|
|
#define IMAGES_IN "imgs_in/"
|
|
#define IMAGES_OUT "imgs_out/"
|
|
|
|
PROCEDURE Main()
|
|
|
|
LOCAL im, im2
|
|
LOCAL black, blue, red, green, cyan
|
|
LOCAL color, font
|
|
// LOCAL aClip
|
|
|
|
// SET GDFONTPATH=C:\windows\fonts
|
|
IF GetEnv( "GDFONTPATH" ) == ""
|
|
? "Please set GDFONTPATH"
|
|
? "On Windows: SET GDFONTPATH=C:\windows\fonts"
|
|
? "On Linux : export GDFONTPATH=/usr/share/fonts/default/TrueType"
|
|
?
|
|
ENDIF
|
|
/*
|
|
// Check output directory
|
|
IF !ISDirectory( IMAGES_OUT )
|
|
DirMake( IMAGES_OUT )
|
|
ENDIF
|
|
*/
|
|
|
|
? gdVersion()
|
|
|
|
/* Create an image in memory */
|
|
im := gdImageCreate(200, 200)
|
|
|
|
/* Load an image in memory from file */
|
|
im2 := gdImageCreateFromJpeg( IMAGES_IN + "conv_tst.jpg")
|
|
|
|
/* Now work on first empty image */
|
|
|
|
/* Allocate drawing color */
|
|
black := gdImageColorAllocate(im, 0, 0, 0)
|
|
blue := gdImageColorAllocate(im, 0, 0, 255)
|
|
red := gdImageColorAllocate(im, 255, 0, 0)
|
|
green := gdImageColorAllocate(im, 0, 255, 0)
|
|
cyan := gdImageColorAllocate(im, 0, 255, 255)
|
|
|
|
/* Draw rectangle */
|
|
gdImageFilledRectangle(im, 0, 0, 199, 199, cyan)
|
|
gdImageRectangle(im, 0, 0, 199, 199, black)
|
|
|
|
/* Draw pixel */
|
|
gdImageSetPixel(im, 50, 5, blue)
|
|
gdImageSetPixel(im, 50, 15, blue)
|
|
|
|
/* Draw lines */
|
|
gdImageLine(im, 0, 0, 199, 199, blue)
|
|
gdImageDashedLine(im, 0, 199, 199, 0, blue)
|
|
|
|
/* Draw polygons */
|
|
gdImagePolygon(im, { { 10, 10 }, { 70, 10 }, { 80, 60 } }, red)
|
|
gdImageFilledPolygon(im, { { 160, 180 }, { 170, 110 }, { 150, 160 } }, green)
|
|
|
|
/* Draw an arc */
|
|
gdImageArc(im, 50, 50, 40, 40, 30, 190, red )
|
|
gdImageFilledCircle(im, 50, 150, 45, green )
|
|
gdImageEllipse(im, 120, 120, 50, 20, blue )
|
|
|
|
/* Draw some characters */
|
|
font := gdFontGetLarge()
|
|
|
|
gdImageString(im, font, 0, 0, 'Test', black)
|
|
gdImageString(im, font, 0, 15, 'P', black)
|
|
gdImageChar(im, font, 0, 30, 'W', black)
|
|
|
|
gdImageStringUp(im, font, 70, 90, 'Test', black)
|
|
gdImageStringUp(im, font, 70, 15, 'P', black)
|
|
gdImageCharUp(im, font, 70, 30, 'W', black)
|
|
|
|
gdImageStringFt(im, blue, "arial", 20, 30, 20, 90, 'Test')
|
|
|
|
? gdImageStringFTCircle(im, 120, 120, 50, 25, 0.8, "arial", 24, "Up", /*"Down"*/, red)
|
|
|
|
/* Set Clip Rectangle */
|
|
gdImageSetClip(im, 25, 25, 75, 75)
|
|
|
|
/* Retrieve Clipping rectangle */
|
|
// aClip := gdImageGetClip(im)
|
|
|
|
// ? "Clipping rectangle values"
|
|
// ? hb_DumpVar( aClip )
|
|
|
|
/* Query functions */
|
|
color := gdImageGetPixel(im, gdImageSX(im) / 2, gdImageSY(im) / 2)
|
|
? "Pixel Color is: ", color
|
|
? "RGB Values: ", gdImageRed(im,color), gdImageGreen(im,color), gdImageBlue(im,color)
|
|
? "Alpha Value: ", gdImageAlpha(im,color)
|
|
|
|
/* Write Images on files */
|
|
gdImagePng(im, IMAGES_OUT + "rect.png")
|
|
|
|
gdImagePng(im2, IMAGES_OUT + "conv_tst.png")
|
|
gdImageJpeg(im2, IMAGES_OUT + "conv_tst.jpg")
|
|
|
|
/* Destroy images in memory */
|
|
gdImageDestroy(im)
|
|
gdImageDestroy(im2)
|
|
|
|
?
|
|
? "Look at " + IMAGES_OUT + " folder for output images"
|
|
?
|
|
|
|
RETURN
|