2012-06-10 16:43 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbziparc/ziparc.prg
! fixed using old IS*() macro w/o common.ch
* contrib/hbziparc/tests/unzipa.prg
* contrib/hbziparc/tests/zipa.prg
+ added #require directives
* contrib/hbgd/tests/animgif.prg
* contrib/hbgd/tests/antialia.prg
* contrib/hbgd/tests/barms.prg
* contrib/hbgd/tests/bartest.prg
* contrib/hbgd/tests/counter.prg
* contrib/hbgd/tests/gdtest.prg
* contrib/hbgd/tests/gdtestcl.prg
* contrib/hbgd/tests/test_out.prg
* contrib/hbgd/tests/testdpi.prg
* contrib/hbgd/tests/tostring.prg
* contrib/hbgd/tests/tpoly.prg
* examples/httpsrv/modules/showcounter.prg
* cleanups and fixes (replaced ISDIRECTORY() xhb function,
fixed Windows dir detection, added simpleio.ch)
* contrib/hbzebra/tests/testcair.prg
* contrib/hbzebra/tests/testhpdf.prg
* contrib/hbzebra/tests/testwin.prg
* contrib/rddads/tests/datad.prg
* contrib/rddads/tests/testmg.prg
+ added #require directives for testing
* contrib/hbfoxpro/misc.prg
* contrib/hbnf/clrsel.prg
* contrib/hbnf/menu1.prg
* contrib/hbnf/metaph.prg
* src/rtl/hbi18n2.prg
* utils/hbtest/rt_str.prg
* formatting (to help a grep case)
This commit is contained in:
@@ -16,6 +16,44 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-06-10 16:43 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/hbziparc/ziparc.prg
|
||||
! fixed using old IS*() macro w/o common.ch
|
||||
|
||||
* contrib/hbziparc/tests/unzipa.prg
|
||||
* contrib/hbziparc/tests/zipa.prg
|
||||
+ added #require directives
|
||||
|
||||
* contrib/hbgd/tests/animgif.prg
|
||||
* contrib/hbgd/tests/antialia.prg
|
||||
* contrib/hbgd/tests/barms.prg
|
||||
* contrib/hbgd/tests/bartest.prg
|
||||
* contrib/hbgd/tests/counter.prg
|
||||
* contrib/hbgd/tests/gdtest.prg
|
||||
* contrib/hbgd/tests/gdtestcl.prg
|
||||
* contrib/hbgd/tests/test_out.prg
|
||||
* contrib/hbgd/tests/testdpi.prg
|
||||
* contrib/hbgd/tests/tostring.prg
|
||||
* contrib/hbgd/tests/tpoly.prg
|
||||
* examples/httpsrv/modules/showcounter.prg
|
||||
* cleanups and fixes (replaced ISDIRECTORY() xhb function,
|
||||
fixed Windows dir detection, added simpleio.ch)
|
||||
|
||||
* contrib/hbzebra/tests/testcair.prg
|
||||
* contrib/hbzebra/tests/testhpdf.prg
|
||||
* contrib/hbzebra/tests/testwin.prg
|
||||
* contrib/rddads/tests/datad.prg
|
||||
* contrib/rddads/tests/testmg.prg
|
||||
+ added #require directives for testing
|
||||
|
||||
* contrib/hbfoxpro/misc.prg
|
||||
* contrib/hbnf/clrsel.prg
|
||||
* contrib/hbnf/menu1.prg
|
||||
* contrib/hbnf/metaph.prg
|
||||
* src/rtl/hbi18n2.prg
|
||||
* utils/hbtest/rt_str.prg
|
||||
* formatting (to help a grep case)
|
||||
|
||||
2012-06-10 14:11 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* src/rtl/cdpdet.prg
|
||||
! *nix specific CP autodetection code missed to call
|
||||
|
||||
@@ -60,7 +60,7 @@ FUNCTION SYS( nValue, xPar1 )
|
||||
CASE 2
|
||||
RETURN hb_ntos( Seconds() )
|
||||
CASE 2002
|
||||
IF ! hb_isNumeric( xPar1 )
|
||||
IF ! HB_ISNUMERIC( xPar1 )
|
||||
xPar1 := SC_NONE
|
||||
ENDIF
|
||||
RETURN SetCursor( xPar1 )
|
||||
@@ -70,11 +70,11 @@ FUNCTION SYS( nValue, xPar1 )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
STATIC FUNCTION AFILLNESTED( aValue, xVal )
|
||||
STATIC FUNCTION AFillNested( aValue, xVal )
|
||||
LOCAL item
|
||||
|
||||
FOR EACH item in aValue
|
||||
IF hb_isArray( item )
|
||||
FOR EACH item IN aValue
|
||||
IF HB_ISARRAY( item )
|
||||
AFillNested( item, xVal )
|
||||
ELSE
|
||||
item := xVal
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "gd.ch"
|
||||
#include "simpleio.ch"
|
||||
|
||||
#define IMAGES_IN "imgs_in" + hb_ps()
|
||||
#define IMAGES_OUT "imgs_out" + hb_ps()
|
||||
@@ -23,74 +24,74 @@ PROCEDURE Main()
|
||||
|
||||
/*
|
||||
// Check output directory
|
||||
IF !ISDirectory( IMAGES_OUT )
|
||||
IF !hb_DirExists( IMAGES_OUT )
|
||||
DirMake( IMAGES_OUT )
|
||||
ENDIF
|
||||
*/
|
||||
|
||||
/* Create the image */
|
||||
im := gdImageCreate(100, 100)
|
||||
im := gdImageCreate( 100, 100 )
|
||||
|
||||
/* Allocate background */
|
||||
// white := gdImageColorAllocate(im, 255, 255, 255)
|
||||
// white := gdImageColorAllocate(im, 255, 255, 255)
|
||||
|
||||
/* Allocate drawing color */
|
||||
black := gdImageColorAllocate(im, 0, 0, 0)
|
||||
black := gdImageColorAllocate( im, 0, 0, 0 )
|
||||
|
||||
/* Allocate transparent color for animation compression */
|
||||
trans := gdImageColorAllocate(im, 1, 1, 1)
|
||||
trans := gdImageColorAllocate( im, 1, 1, 1 )
|
||||
|
||||
/* Draw rectangle */
|
||||
gdImageRectangle(im, 0, 0, 10, 10, black)
|
||||
gdImageRectangle( im, 0, 0, 10, 10, black )
|
||||
|
||||
/* Open output file in binary mode */
|
||||
hFile := FCreate( IMAGES_OUT + "anim1.gif" )
|
||||
/* Write GIF header. Use global color map. Loop a few times */
|
||||
gdImageGifAnimBegin(im, hFile, 1, 3)
|
||||
gdImageGifAnimBegin(im, IMAGES_OUT + "anim2.gif", 1, 3)
|
||||
gdImageGifAnimBegin( im, hFile, 1, 3 )
|
||||
gdImageGifAnimBegin( im, IMAGES_OUT + "anim2.gif", 1, 3 )
|
||||
/* Write the first frame. No local color map. Delay = 1s */
|
||||
gdImageGifAnimAdd(im, hFile, 0, 0, 0, 100, 1, NIL)
|
||||
gdImageGifAnimAdd(im, IMAGES_OUT + "anim2.gif", 0, 0, 0, 100, 1, NIL)
|
||||
gdImageGifAnimAdd( im, hFile, 0, 0, 0, 100, 1, NIL )
|
||||
gdImageGifAnimAdd( im, IMAGES_OUT + "anim2.gif", 0, 0, 0, 100, 1, NIL )
|
||||
/* construct the second frame */
|
||||
im2 := gdImageCreate(100, 100)
|
||||
im2 := gdImageCreate( 100, 100 )
|
||||
/* Allocate background to make it white */
|
||||
gdImageColorAllocate(im2, 255, 255, 255)
|
||||
gdImageColorAllocate( im2, 255, 255, 255 )
|
||||
/* Make sure the palette is identical */
|
||||
gdImagePaletteCopy (im2, im)
|
||||
gdImagePaletteCopy ( im2, im )
|
||||
/* Draw something */
|
||||
gdImageRectangle(im2, 0, 0, 15, 15, black)
|
||||
gdImageRectangle( im2, 0, 0, 15, 15, black )
|
||||
/* Allow animation compression with transparent pixels */
|
||||
gdImageColorTransparent (im2, trans)
|
||||
gdImageColorTransparent ( im2, trans )
|
||||
/* Add the second frame */
|
||||
gdImageGifAnimAdd(im2, hFile, 0, 0, 0, 100, 1, im)
|
||||
gdImageGifAnimAdd(im2, IMAGES_OUT + "anim2.gif", 0, 0, 0, 100, 1, im)
|
||||
gdImageGifAnimAdd( im2, hFile, 0, 0, 0, 100, 1, im )
|
||||
gdImageGifAnimAdd( im2, IMAGES_OUT + "anim2.gif", 0, 0, 0, 100, 1, im )
|
||||
/* construct the second frame */
|
||||
im3 := gdImageCreate(100, 100)
|
||||
im3 := gdImageCreate( 100, 100 )
|
||||
/* Allocate background to make it white */
|
||||
gdImageColorAllocate(im3, 255, 255, 255)
|
||||
gdImageColorAllocate( im3, 255, 255, 255 )
|
||||
/* Make sure the palette is identical */
|
||||
gdImagePaletteCopy (im3, im)
|
||||
gdImagePaletteCopy ( im3, im )
|
||||
/* Draw something */
|
||||
gdImageRectangle(im3, 0, 0, 15, 20, black)
|
||||
gdImageRectangle( im3, 0, 0, 15, 20, black )
|
||||
/* Allow animation compression with transparent pixels */
|
||||
gdImageColorTransparent (im3, trans)
|
||||
gdImageColorTransparent ( im3, trans )
|
||||
/* Add the third frame, compressing against the second one */
|
||||
gdImageGifAnimAdd(im3, hFile, 0, 0, 0, 100, 1, im2)
|
||||
gdImageGifAnimAdd(im3, IMAGES_OUT + "anim2.gif", 0, 0, 0, 100, 1, im2)
|
||||
gdImageGifAnimAdd( im3, hFile, 0, 0, 0, 100, 1, im2 )
|
||||
gdImageGifAnimAdd( im3, IMAGES_OUT + "anim2.gif", 0, 0, 0, 100, 1, im2 )
|
||||
/* Write the end marker */
|
||||
/* gdImageGifAnimEnd(out); is the same as the following: */
|
||||
//putc (';', out);
|
||||
//putc (";", out);
|
||||
gdImageGifAnimEnd( hFile )
|
||||
gdImageGifAnimEnd( IMAGES_OUT + "anim2.gif" )
|
||||
/* Close file */
|
||||
FClose( hFile )
|
||||
/* Destroy images */
|
||||
gdImageDestroy(im)
|
||||
gdImageDestroy(im2)
|
||||
gdImageDestroy(im3)
|
||||
gdImageDestroy( im )
|
||||
gdImageDestroy( im2 )
|
||||
gdImageDestroy( im3 )
|
||||
|
||||
?
|
||||
? "Look at " + IMAGES_OUT + " folder for output images"
|
||||
?
|
||||
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "gd.ch"
|
||||
#include "simpleio.ch"
|
||||
|
||||
#define IMAGES_IN "imgs_in" + hb_ps()
|
||||
#define IMAGES_OUT "imgs_out" + hb_ps()
|
||||
@@ -20,7 +21,7 @@ PROCEDURE Main()
|
||||
|
||||
/*
|
||||
// Check output directory
|
||||
IF !ISDirectory( IMAGES_OUT )
|
||||
IF !hb_DirExists( IMAGES_OUT )
|
||||
DirMake( IMAGES_OUT )
|
||||
ENDIF
|
||||
*/
|
||||
@@ -43,58 +44,58 @@ PROCEDURE Main()
|
||||
/* ***** DRAW A LINE IN A PALETTE BASED IMAGE ***** */
|
||||
|
||||
/* First we create a true color image */
|
||||
im := gdImageCreatePalette(100, 100) // alias of gdImageCreate()
|
||||
im := gdImageCreatePalette( 100, 100 ) // alias of gdImageCreate()
|
||||
|
||||
/* First allocate color is Background color */
|
||||
// black := gdImageColorAllocate(im, 0, 0, 0)
|
||||
// black := gdImageColorAllocate(im, 0, 0, 0)
|
||||
|
||||
/* set foreground color */
|
||||
blue := gdImageColorAllocate(im, 0, 0, 255)
|
||||
blue := gdImageColorAllocate( im, 0, 0, 255 )
|
||||
|
||||
/* Now we draw an aliased line */
|
||||
gdImageLine(im, 0, 0, 99, 40, blue)
|
||||
gdImageLine( im, 0, 0, 99, 40, blue )
|
||||
|
||||
/* Then we set anti-alias color */
|
||||
gdImageSetAntiAliased(im, blue)
|
||||
gdImageSetAntiAliased( im, blue )
|
||||
|
||||
/* and re-draw the line in antialiased mode */
|
||||
gdImageLine(im, 0, 40, 99, 80, gdAntiAliased)
|
||||
gdImageLine( im, 0, 40, 99, 80, gdAntiAliased )
|
||||
|
||||
/* saving the image */
|
||||
gdImageJpeg(im, IMAGES_OUT + "antialiasedpal.jpg")
|
||||
gdImageJpeg( im, IMAGES_OUT + "antialiasedpal.jpg" )
|
||||
|
||||
/* Destroy it */
|
||||
gdImageDestroy(im)
|
||||
gdImageDestroy( im )
|
||||
|
||||
/* ***** DRAW A LINE IN A TRUE COLOR IMAGE ***** */
|
||||
|
||||
/* First we create a true color image */
|
||||
im := gdImageCreateTrueColor(100, 100)
|
||||
im := gdImageCreateTrueColor( 100, 100 )
|
||||
|
||||
/* Background color (true color comes with black background, we have to fill it) */
|
||||
white := gdTrueColor( 255, 255, 255 )
|
||||
gdImageFilledRectangle(im, 0, 0, 100, 100, white)
|
||||
gdImageFilledRectangle( im, 0, 0, 100, 100, white )
|
||||
|
||||
/* set foreground color */
|
||||
blue := gdImageColorAllocate(im, 0, 0, 255)
|
||||
blue := gdImageColorAllocate( im, 0, 0, 255 )
|
||||
|
||||
/* Now we draw an aliased line */
|
||||
gdImageLine(im, 0, 0, 99, 40, blue)
|
||||
gdImageLine( im, 0, 0, 99, 40, blue )
|
||||
|
||||
/* Then we set anti-alias color */
|
||||
gdImageSetAntiAliased(im, blue)
|
||||
gdImageSetAntiAliased( im, blue )
|
||||
|
||||
/* and re-draw the line in antialiased mode */
|
||||
gdImageLine(im, 0, 40, 99, 80, gdAntiAliased)
|
||||
gdImageLine( im, 0, 40, 99, 80, gdAntiAliased )
|
||||
|
||||
/* saving the image */
|
||||
gdImageJpeg(im, IMAGES_OUT + "antialiasedtrue.jpg")
|
||||
gdImageJpeg( im, IMAGES_OUT + "antialiasedtrue.jpg" )
|
||||
|
||||
/* Destroy it */
|
||||
gdImageDestroy(im)
|
||||
gdImageDestroy( im )
|
||||
|
||||
?
|
||||
? "Look at " + IMAGES_OUT + " folder for output images"
|
||||
?
|
||||
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
@@ -84,7 +84,7 @@ PROCEDURE Main()
|
||||
bar:Finish( 8 )
|
||||
|
||||
// BRAZIL-FEBRABAN
|
||||
bar:= TCode():New( 25 )
|
||||
bar := TCode():New( 25 )
|
||||
|
||||
bar:Configure( 25, black, white, 1, 1,, .T. )
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ PROCEDURE Main()
|
||||
bar:Finish( 2 )
|
||||
|
||||
// BRAZIL-FEBRABAN
|
||||
bar:= TCode():New( 25 )
|
||||
bar := TCode():New( 25 )
|
||||
|
||||
bar:Configure( 25, black, white, 1, 1,, .T. )
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "gd.ch"
|
||||
#include "simpleio.ch"
|
||||
|
||||
/* Some digits images from:
|
||||
http://www.digitmania.holowww.com/all.html */
|
||||
@@ -62,7 +63,7 @@ PROCEDURE Main( cValue, cBaseImage )
|
||||
|
||||
// Check output directory
|
||||
/*
|
||||
IF !ISDirectory( IMAGES_OUT )
|
||||
IF !hb_DirExists( IMAGES_OUT )
|
||||
DirMake( IMAGES_OUT )
|
||||
ENDIF
|
||||
*/
|
||||
@@ -136,4 +137,4 @@ PROCEDURE Main( cValue, cBaseImage )
|
||||
? "Look at " + IMAGES_OUT + " folder for output images"
|
||||
?
|
||||
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "gd.ch"
|
||||
#include "simpleio.ch"
|
||||
|
||||
#define IMAGES_IN "imgs_in" + hb_ps()
|
||||
#define IMAGES_OUT "imgs_out" + hb_ps()
|
||||
@@ -18,7 +19,8 @@ PROCEDURE Main()
|
||||
LOCAL im, im2
|
||||
LOCAL black, blue, red, green, cyan
|
||||
LOCAL color, font
|
||||
// LOCAL aClip
|
||||
|
||||
// LOCAL aClip
|
||||
|
||||
// SET GDFONTPATH=C:\windows\fonts
|
||||
IF GetEnv( "GDFONTPATH" ) == ""
|
||||
@@ -29,7 +31,7 @@ PROCEDURE Main()
|
||||
ENDIF
|
||||
/*
|
||||
// Check output directory
|
||||
IF !ISDirectory( IMAGES_OUT )
|
||||
IF !hb_DirExists( IMAGES_OUT )
|
||||
DirMake( IMAGES_OUT )
|
||||
ENDIF
|
||||
*/
|
||||
@@ -37,83 +39,84 @@ PROCEDURE Main()
|
||||
? gdVersion()
|
||||
|
||||
/* Create an image in memory */
|
||||
im := gdImageCreate(200, 200)
|
||||
im := gdImageCreate( 200, 200 )
|
||||
|
||||
/* Load an image in memory from file */
|
||||
im2 := gdImageCreateFromJpeg( IMAGES_IN + "conv_tst.jpg")
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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 )
|
||||
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)
|
||||
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)
|
||||
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')
|
||||
gdImageStringFt( im, blue, "arial", 20, 30, 20, 90, "Test" )
|
||||
|
||||
? gdImageStringFTCircle(im, 120, 120, 50, 25, 0.8, "arial", 24, "Up", /*"Down"*/, red)
|
||||
? gdImageStringFTCircle( im, 120, 120, 50, 25, 0.8, "arial", 24, "Up", /*"Down"*/
|
||||
, red )
|
||||
|
||||
/* Set Clip Rectangle */
|
||||
gdImageSetClip(im, 25, 25, 75, 75)
|
||||
gdImageSetClip( im, 25, 25, 75, 75 )
|
||||
|
||||
/* Retrieve Clipping rectangle */
|
||||
// aClip := gdImageGetClip(im)
|
||||
// aClip := gdImageGetClip(im)
|
||||
|
||||
// ? "Clipping rectangle values"
|
||||
// ? hb_DumpVar( aClip )
|
||||
// ? "Clipping rectangle values"
|
||||
// ? hb_DumpVar( aClip )
|
||||
|
||||
/* Query functions */
|
||||
color := gdImageGetPixel(im, gdImageSX(im) / 2, gdImageSY(im) / 2)
|
||||
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)
|
||||
? "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( im, IMAGES_OUT + "rect.png" )
|
||||
|
||||
gdImagePng(im2, IMAGES_OUT + "conv_tst.png")
|
||||
gdImageJpeg(im2, IMAGES_OUT + "conv_tst.jpg")
|
||||
gdImagePng( im2, IMAGES_OUT + "conv_tst.png" )
|
||||
gdImageJpeg( im2, IMAGES_OUT + "conv_tst.jpg" )
|
||||
|
||||
/* Destroy images in memory */
|
||||
gdImageDestroy(im)
|
||||
gdImageDestroy(im2)
|
||||
gdImageDestroy( im )
|
||||
gdImageDestroy( im2 )
|
||||
|
||||
?
|
||||
? "Look at " + IMAGES_OUT + " folder for output images"
|
||||
?
|
||||
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "gd.ch"
|
||||
#include "simpleio.ch"
|
||||
|
||||
#define IMAGES_IN "imgs_in" + hb_ps()
|
||||
#define IMAGES_OUT "imgs_out" + hb_ps()
|
||||
@@ -20,11 +21,8 @@ PROCEDURE Main()
|
||||
LOCAL oI, oI2, oI3, oI4, nThick, n, nSecs
|
||||
LOCAL oI5
|
||||
LOCAL oB
|
||||
// LOCAL aClip
|
||||
|
||||
// To set fonts run this command:
|
||||
// for windows: SET GDFONTPATH=C:\windows\fonts
|
||||
// per linux : export GDFONTPATH=/usr/share/fonts/default/TrueType
|
||||
// LOCAL aClip
|
||||
|
||||
// SET GDFONTPATH=C:\windows\fonts
|
||||
IF GetEnv( "GDFONTPATH" ) == ""
|
||||
@@ -35,7 +33,7 @@ PROCEDURE Main()
|
||||
ENDIF
|
||||
/*
|
||||
// Check output directory
|
||||
IF !ISDirectory( IMAGES_OUT )
|
||||
IF !hb_DirExists( IMAGES_OUT )
|
||||
DirMake( IMAGES_OUT )
|
||||
ENDIF
|
||||
*/
|
||||
@@ -57,8 +55,8 @@ PROCEDURE Main()
|
||||
cyan := oI:SetColor( 0, 255, 255 )
|
||||
|
||||
/* Draw rectangle */
|
||||
oI:Rectangle( 0, 0, 199, 199, .T., cyan )
|
||||
oI:Rectangle( 0, 0, 199, 199,, black)
|
||||
oI:Rectangle( 0, 0, 199, 199, .T. , cyan )
|
||||
oI:Rectangle( 0, 0, 199, 199, , black )
|
||||
|
||||
oI:SetColor( blue )
|
||||
|
||||
@@ -67,7 +65,7 @@ PROCEDURE Main()
|
||||
|
||||
/* Draw lines */
|
||||
oI:Line( 0, 0, 199, 199, blue )
|
||||
oI:DashedLine(0, 199, 199, 0, blue)
|
||||
oI:DashedLine( 0, 199, 199, 0, blue )
|
||||
nThick := oI:SetThickness( 5 )
|
||||
oI:Line( 50, 150, 100, 150 )
|
||||
oI:SetThickness( nThick )
|
||||
@@ -98,44 +96,44 @@ PROCEDURE Main()
|
||||
oI:AddPoint( 160, 180 )
|
||||
oI:AddPoint( 170, 110 )
|
||||
oI:AddPoint( 150, 160 )
|
||||
oI:Polygon(,.T., green)
|
||||
oI:Polygon( , .T. , green )
|
||||
|
||||
/* Draw an arc */
|
||||
oI:Arc(50, 50, 40, 40, 30, 190,, red )
|
||||
oI:Circle(50, 150, 45, .t., green )
|
||||
oI:Ellipse(120, 120, 50, 20, , green )
|
||||
oI:Arc( 50, 50, 40, 40, 30, 190, , red )
|
||||
oI:Circle( 50, 150, 45, .T. , green )
|
||||
oI:Ellipse( 120, 120, 50, 20, , green )
|
||||
|
||||
/* Draw a character. */
|
||||
oI:SetFontLarge()
|
||||
? "Font Dims", oI:GetFontWidth(), oI:GetFontHeight()
|
||||
oI:SetColor( black )
|
||||
//__OutDebug( "Font", font )
|
||||
oI:Say( 0, 0, 'Test')
|
||||
oI:Say( 0, 15, 'P')
|
||||
oI:Say( 0, 30, 'W')
|
||||
oI:Say( 0, 0, "Test" )
|
||||
oI:Say( 0, 15, "P" )
|
||||
oI:Say( 0, 30, "W" )
|
||||
|
||||
oI:SayVertical( 70, 90, 'Test')
|
||||
oI:SayVertical( 70, 15, 'P')
|
||||
oI:SayVertical( 70, 30, 'W')
|
||||
oI:SayVertical( 70, 90, "Test" )
|
||||
oI:SayVertical( 70, 15, "P" )
|
||||
oI:SayVertical( 70, 30, "W" )
|
||||
|
||||
oI:SayFreeType( 20, 30, "Test", "arial", 24, 15 )
|
||||
oI:SayFreeType( 40, 70, "Test2" )
|
||||
|
||||
|
||||
/* Set Clip Rectangle */
|
||||
oI:SetClippingArea(25, 25, 75, 75)
|
||||
oI:SetClippingArea( 25, 25, 75, 75 )
|
||||
|
||||
/* Retrieve Clipping rectangle */
|
||||
// aClip := oI:GetClippingArea()
|
||||
// aClip := oI:GetClippingArea()
|
||||
? "Clipping rectangle values"
|
||||
// ? hb_DumpVar( aClip )
|
||||
// ? hb_DumpVar( aClip )
|
||||
|
||||
/* Query functions */
|
||||
|
||||
color := oI:GetPixel( oI:Width() / 2, oI:Height() / 2)
|
||||
color := oI:GetPixel( oI:Width() / 2, oI:Height() / 2 )
|
||||
? "Pixel Color is: ", color
|
||||
? "RGB Values: ", oI:Red(color), oI:Green(color), oI:Blue(color)
|
||||
? "Alpha Value: ", oI:Alpha(color)
|
||||
? "RGB Values: ", oI:Red( color ), oI:Green( color ), oI:Blue( color )
|
||||
? "Alpha Value: ", oI:Alpha( color )
|
||||
|
||||
/* Write Images on files */
|
||||
oI:SavePng( IMAGES_OUT + "rect.png" )
|
||||
@@ -167,7 +165,7 @@ PROCEDURE Main()
|
||||
|
||||
nSecs := Seconds()
|
||||
? "start clone"
|
||||
oI4:= oI5:Clone()
|
||||
oI4 := oI5:Clone()
|
||||
? "end", Seconds() - nSecs
|
||||
|
||||
nSecs := Seconds()
|
||||
@@ -177,8 +175,8 @@ PROCEDURE Main()
|
||||
|
||||
//__OutDebug( oI2:pImage )
|
||||
//oI4:SetFontGiant()
|
||||
gray := oI4:SetColor(30, 30, 30)
|
||||
blue := oI4:SetColor(0, 0, 200)
|
||||
gray := oI4:SetColor( 30, 30, 30 )
|
||||
blue := oI4:SetColor( 0, 0, 200 )
|
||||
|
||||
//oI4:SetColor( black )
|
||||
//oI4:Say( 100, 10, "Valentina" )
|
||||
@@ -188,11 +186,11 @@ PROCEDURE Main()
|
||||
nSecs := Seconds()
|
||||
? "start write"
|
||||
FOR n := 0 TO 350 STEP 10
|
||||
oI4:SayFreeType( oI4:CenterWidth(), oI4:CenterHeight(), " GD Font Power", "arial", 20, n )
|
||||
oI4:SayFreeType( oI4:CenterWidth(), oI4:CenterHeight(), " GD Font Power", "arial", 20, n )
|
||||
NEXT
|
||||
? "end", Seconds() - nSecs
|
||||
oI4:SetTransparent( blue )
|
||||
oI4:SayFreeType( oI4:CenterWidth()-4, oI4:CenterHeight()+4, "GD", "verdana", 70, n, gray )
|
||||
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" )
|
||||
@@ -217,21 +215,21 @@ PROCEDURE Main()
|
||||
|
||||
oI5:Zoom( 40 )
|
||||
//oI5:Rotate( 90 )
|
||||
blue := oI5:SetColor(0, 0, 200)
|
||||
blue := oI5:SetColor( 0, 0, 200 )
|
||||
oI5:SayFreeType( oI5:CenterWidth(), oI5:CenterHeight(), "GD", "verdana", 20, 0, blue )
|
||||
oI5:SaveJpeg( IMAGES_OUT + "gd_zoom.jpg" )
|
||||
|
||||
|
||||
oI5 := GDChart():New( 400, 400 )
|
||||
// Define piece colors
|
||||
blue := oI5:SetColor(0, 0, 200)
|
||||
gray := oI5:SetColor(30, 30, 30)
|
||||
green := oI5:SetColor(0, 250, 0)
|
||||
red := oI5:SetColor(250, 0, 0)
|
||||
blue := oI5:SetColor( 0, 0, 200 )
|
||||
gray := oI5:SetColor( 30, 30, 30 )
|
||||
green := oI5:SetColor( 0, 250, 0 )
|
||||
red := oI5:SetColor( 250, 0, 0 )
|
||||
|
||||
// Load an image as brush
|
||||
oB := GDImage():LoadFromGif( IMAGES_IN + "harbour.gif" )
|
||||
oB:Zoom(15)
|
||||
oB:Zoom( 15 )
|
||||
|
||||
//oI5:Circle( 200, 200, oI5:Width() )
|
||||
//oI5:Line( 0, 200, 200, 200 )
|
||||
@@ -239,14 +237,14 @@ PROCEDURE Main()
|
||||
oI5:AddDef( "FONTPITCH", "GIANT" )
|
||||
|
||||
oI5:SetData( { ;
|
||||
{ "LABEL" => "One" , "VALUE" => 10, "COLOR" => blue , "FILLED" => .T., "EXTRUDE" => 40/*, "TILE" => oB*/ },;
|
||||
{ "LABEL" => "Two" , "VALUE" => 35, "COLOR" => gray , "FILLED" => .T., "FONT" => { "NAME" => "Verdana", "PITCH" => 12, "ANGLE" => 0, "COLOR" => red } },;
|
||||
{ "LABEL" => "Three", "VALUE" => 55, "COLOR" => green, "FILLED" => .T. }, ;
|
||||
{ "LABEL" => "Four" , "VALUE" => 55, "FILLED" => .T. , "TILE" => oB }, ;
|
||||
{ "LABEL" => "Five" , "VALUE" => 55, "COLOR" => red , "FILLED" => .T., "EXTRUDE" => 20 }, ;
|
||||
{ "LABEL" => "Six" , "VALUE" => 55, "FILLED" => .T. , "TILE" => oB }, ;
|
||||
{ "LABEL" => "Seven", "VALUE" => 55, "FILLED" => .T. , "COLOR" => green } ;
|
||||
} )
|
||||
{ "LABEL" => "One" , "VALUE" => 10, "COLOR" => blue , "FILLED" => .T. , "EXTRUDE" => 40/*, "TILE" => oB*/ }, ;
|
||||
{ "LABEL" => "Two" , "VALUE" => 35, "COLOR" => gray , "FILLED" => .T. , "FONT" => { "NAME" => "Verdana", "PITCH" => 12, "ANGLE" => 0, "COLOR" => red } }, ;
|
||||
{ "LABEL" => "Three", "VALUE" => 55, "COLOR" => green, "FILLED" => .T. }, ;
|
||||
{ "LABEL" => "Four" , "VALUE" => 55, "FILLED" => .T. , "TILE" => oB }, ;
|
||||
{ "LABEL" => "Five" , "VALUE" => 55, "COLOR" => red , "FILLED" => .T. , "EXTRUDE" => 20 }, ;
|
||||
{ "LABEL" => "Six" , "VALUE" => 55, "FILLED" => .T. , "TILE" => oB }, ;
|
||||
{ "LABEL" => "Seven", "VALUE" => 55, "FILLED" => .T. , "COLOR" => green } ;
|
||||
} )
|
||||
|
||||
//oI5:VerticalBarChart()
|
||||
oI5:PieChart()
|
||||
@@ -256,16 +254,16 @@ PROCEDURE Main()
|
||||
|
||||
oI5 := GDChart():New( 640, 480 )
|
||||
// Define piece colors
|
||||
blue := oI5:SetColor(0, 0, 200)
|
||||
gray := oI5:SetColor(30, 30, 30)
|
||||
green := oI5:SetColor(0, 250, 0)
|
||||
red := oI5:SetColor(250, 0, 0)
|
||||
blue := oI5:SetColor( 0, 0, 200 )
|
||||
gray := oI5:SetColor( 30, 30, 30 )
|
||||
green := oI5:SetColor( 0, 250, 0 )
|
||||
red := oI5:SetColor( 250, 0, 0 )
|
||||
|
||||
// Load an image as brush
|
||||
oB := GDImage():LoadFromJpeg( IMAGES_IN + "conv_tst.jpg" )
|
||||
oB:Zoom(15)
|
||||
oB:Zoom( 15 )
|
||||
|
||||
// oI5:AddDef( "MAXVALUE", 150 )
|
||||
// oI5:AddDef( "MAXVALUE", 150 )
|
||||
oI5:AddDef( "AXISPICT", "@E 999999" )
|
||||
oI5:AddDef( "FONTPITCH", "GIANT" )
|
||||
oI5:AddDef( "COLOR", blue )
|
||||
@@ -290,16 +288,16 @@ PROCEDURE Main()
|
||||
|
||||
|
||||
oI5:SetData( { ;
|
||||
{ "LABEL" => "One", "VALUE" => 10, "COLOR" => blue, "FILLED" => .T., "EXTRUDE" => 40/*, "TILE" => oB*/ },;
|
||||
{ "LABEL" => "Two", "VALUE" => 35, "COLOR" => gray, "FILLED" => .T., "FONT" => { "NAME" => "Verdana", "PITCH" => 12, "ANGLE" => 0, "COLOR" => red } },;
|
||||
{ "LABEL" => "Three", "VALUE" => 55, "COLOR" => green, "FILLED" => .T. }, ;
|
||||
{ "LABEL" => "Four", "VALUE" => 65, "FILLED" => .T., "TILE" => oB }, ;
|
||||
{ "LABEL" => "Five", "VALUE" => 34, "FILLED" => .T., "COLOR" => green }, ;
|
||||
{ "LABEL" => "Six", "VALUE" => 100 }, ;
|
||||
{ "LABEL" => "Seven", "VALUE" => 0, "FILLED" => .T., "COLOR" => red }, ;
|
||||
{ "LABEL" => "Eight", "VALUE" => -0 }, ;
|
||||
{ "LABEL" => "Nine", "VALUE" => -0, "COLOR" => blue, "FILLED" => .T. } ;
|
||||
} )
|
||||
{ "LABEL" => "One", "VALUE" => 10, "COLOR" => blue, "FILLED" => .T. , "EXTRUDE" => 40/*, "TILE" => oB*/ }, ;
|
||||
{ "LABEL" => "Two", "VALUE" => 35, "COLOR" => gray, "FILLED" => .T. , "FONT" => { "NAME" => "Verdana", "PITCH" => 12, "ANGLE" => 0, "COLOR" => red } }, ;
|
||||
{ "LABEL" => "Three", "VALUE" => 55, "COLOR" => green, "FILLED" => .T. }, ;
|
||||
{ "LABEL" => "Four", "VALUE" => 65, "FILLED" => .T. , "TILE" => oB }, ;
|
||||
{ "LABEL" => "Five", "VALUE" => 34, "FILLED" => .T. , "COLOR" => green }, ;
|
||||
{ "LABEL" => "Six", "VALUE" => 100 }, ;
|
||||
{ "LABEL" => "Seven", "VALUE" => 0, "FILLED" => .T. , "COLOR" => red }, ;
|
||||
{ "LABEL" => "Eight", "VALUE" => - 0 }, ;
|
||||
{ "LABEL" => "Nine", "VALUE" => - 0, "COLOR" => blue, "FILLED" => .T. } ;
|
||||
} )
|
||||
|
||||
|
||||
oI5:Clone():VerticalBarChart():SaveJpeg( IMAGES_OUT + "vertbars.jpg" )
|
||||
@@ -321,4 +319,4 @@ PROCEDURE Main()
|
||||
? "Look at " + IMAGES_OUT + " folder for output images"
|
||||
?
|
||||
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#command WRITE <c> => FWrite( 1, <c> + CHR(13)+CHR(10) )
|
||||
#command OutHTML <c> => WRITE <c>
|
||||
|
||||
PROCEDURE Main(...)
|
||||
PROCEDURE Main( ... )
|
||||
|
||||
LOCAL cPar
|
||||
LOCAL aParams := hb_aParams()
|
||||
@@ -21,48 +21,49 @@ PROCEDURE Main(...)
|
||||
LOCAL hParams := { => }
|
||||
|
||||
LOCAL cImg, nPt, nWidth, nHeight, cPhoto
|
||||
|
||||
// LOCAL cText
|
||||
|
||||
IF Empty( aParams )
|
||||
IF !Empty( cQuery )
|
||||
hParams := GetVars( cQuery )
|
||||
hParams := GetVars( cQuery )
|
||||
ENDIF
|
||||
ELSE
|
||||
hParams := GetParams( aParams )
|
||||
ENDIF
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
// Gestione parametri
|
||||
IF !Empty( hParams )
|
||||
FOR EACH cPar IN hParams:Keys
|
||||
// Gestione parametri
|
||||
IF !Empty( hParams )
|
||||
FOR EACH cPar IN hParams:Keys
|
||||
|
||||
do case
|
||||
case cPar == "txt"
|
||||
// cText := hb_hGet( hParams, cPar )
|
||||
DO CASE
|
||||
CASE cPar == "txt"
|
||||
// cText := hb_hGet( hParams, cPar )
|
||||
|
||||
case cPar == "img"
|
||||
cImg := hb_hGet( hParams, cPar )
|
||||
CASE cPar == "img"
|
||||
cImg := hb_hGet( hParams, cPar )
|
||||
|
||||
case cPar == "photo"
|
||||
cPhoto := hb_hGet( hParams, cPar )
|
||||
CASE cPar == "photo"
|
||||
cPhoto := hb_hGet( hParams, cPar )
|
||||
|
||||
case cPar == "width"
|
||||
nWidth := Val( hb_hGet( hParams, cPar ) )
|
||||
CASE cPar == "width"
|
||||
nWidth := Val( hb_hGet( hParams, cPar ) )
|
||||
|
||||
case cPar == "height"
|
||||
nHeight := Val( hb_hGet( hParams, cPar ) )
|
||||
CASE cPar == "height"
|
||||
nHeight := Val( hb_hGet( hParams, cPar ) )
|
||||
|
||||
case cPar == "pt"
|
||||
nPt := Val( hb_hGet( hParams, cPar ) )
|
||||
CASE cPar == "pt"
|
||||
nPt := Val( hb_hGet( hParams, cPar ) )
|
||||
|
||||
endcase
|
||||
NEXT
|
||||
ENDIF
|
||||
ENDCASE
|
||||
NEXT
|
||||
ENDIF
|
||||
|
||||
//__OutDebug( cQuery, ValToPrg( hParams ) )
|
||||
//__OutDebug( cQuery, ValToPrg( hParams ) )
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------------------
|
||||
//hb_default( @cText, "Testo di Prova" )
|
||||
hb_default( @nPt, 30 )
|
||||
|
||||
@@ -82,9 +83,9 @@ PROCEDURE Main(...)
|
||||
OutHTML "</td></tr>"
|
||||
OutHTML "<tr><td align='center'>"
|
||||
OutHTML "<img src='test_out.exe?img=" + cPhoto + ;
|
||||
IIF( nWidth != NIL , "&width=" + AllTrim( Str( nWidth ) ) , "" ) + ;
|
||||
IIF( nHeight != NIL, "&height=" + AllTrim( Str( nHeight ) ), "" ) + ;
|
||||
"'>" + "<br>"
|
||||
iif( nWidth != NIL , "&width=" + AllTrim( Str( nWidth ) ) , "" ) + ;
|
||||
iif( nHeight != NIL, "&height=" + AllTrim( Str( nHeight ) ), "" ) + ;
|
||||
"'>" + "<br>"
|
||||
OutHTML "</td></tr>"
|
||||
OutHTML "<tr><td align='center'>"
|
||||
OutHTML cPhoto
|
||||
@@ -93,14 +94,14 @@ PROCEDURE Main(...)
|
||||
OutHTML "<br>"
|
||||
//OutHTML "<img src='test_out.exe?img=" + cText + "_2&pt=" + AllTrim( Str( nPt ) ) + "'>" + "<br>"
|
||||
//OutHTML OS() + "<br>"
|
||||
//OutHTML IIF( OS_ISWINNT(), "WIN NT", "NON WIN NT" ) + "<br>"
|
||||
//OutHTML iif( OS_ISWINNT(), "WIN NT", "NON WIN NT" ) + "<br>"
|
||||
EndHTML()
|
||||
ELSE
|
||||
StartHTML()
|
||||
EndHTML()
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
PROCEDURE StartHTML( cTitle )
|
||||
|
||||
@@ -108,23 +109,27 @@ PROCEDURE StartHTML( cTitle )
|
||||
|
||||
WRITE 'content-type: text/html'
|
||||
WRITE 'Pragma: no-cache'
|
||||
WRITE CHR(13)+CHR(10)
|
||||
WRITE Chr( 13 ) + Chr( 10 )
|
||||
WRITE "<html>"
|
||||
WRITE "<head>"
|
||||
WRITE "<title>" + cTitle + "</title>"
|
||||
WRITE "</head>"
|
||||
WRITE "<body>"
|
||||
RETURN
|
||||
|
||||
RETURN
|
||||
|
||||
PROCEDURE EndHTML()
|
||||
|
||||
WRITE "</body>"
|
||||
WRITE "</html>"
|
||||
RETURN
|
||||
|
||||
// per windows: SET GDFONTPATH=C:\windows\fonts
|
||||
// per linux : export GDFONTPATH=/usr/share/fonts/default/TrueType
|
||||
RETURN
|
||||
|
||||
// per windows: SET GDFONTPATH=C:\windows\fonts
|
||||
// per linux : export GDFONTPATH=/usr/share/fonts/default/TrueType
|
||||
|
||||
PROCEDURE OutPhoto( cPhoto, nWidth, nHeight )
|
||||
|
||||
LOCAL cType
|
||||
|
||||
LOCAL oImage := GDImage():LoadFromFile( cPhoto )
|
||||
@@ -141,25 +146,25 @@ PROCEDURE OutPhoto( cPhoto, nWidth, nHeight )
|
||||
|
||||
//__OutDebug( hb_dumpvar( oImage ) )
|
||||
|
||||
WRITE 'content-type: ' + oImage:cMime + CHR(13)+CHR(10)
|
||||
WRITE 'content-type: ' + oImage:cMime + Chr( 13 ) + Chr( 10 )
|
||||
cType := oImage:cType
|
||||
|
||||
DO CASE
|
||||
CASE cType == "jpeg"
|
||||
oImage:OutputJpeg()
|
||||
CASE cType == "gif"
|
||||
oImage:OutputGif()
|
||||
CASE cType == "png"
|
||||
oImage:OutputPng()
|
||||
CASE cType == "jpeg"
|
||||
oImage:OutputJpeg()
|
||||
CASE cType == "gif"
|
||||
oImage:OutputGif()
|
||||
CASE cType == "png"
|
||||
oImage:OutputPng()
|
||||
ENDCASE
|
||||
|
||||
oImage := NIL
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
PROCEDURE OutJpg( cText, nPitch )
|
||||
LOCAL cOS := OS()
|
||||
LOCAL cPath := IIF( Left( cOS, 10 ) == "Windows NT", "C:\winnt\fonts\", "C:\windows\fonts\" )
|
||||
|
||||
LOCAL cPath := GetEnv( "WINDIR" ) + "\fonts\"
|
||||
LOCAL oI
|
||||
|
||||
// LOCAL cyan
|
||||
LOCAL blue
|
||||
LOCAL aSize, nWidth, nHeight, nX, nY
|
||||
@@ -172,25 +177,25 @@ PROCEDURE OutJpg( cText, nPitch )
|
||||
oI := GDImage( 400, 100 )
|
||||
|
||||
/* Allocate background */
|
||||
// cyan := oI:SetColor(0, 255, 255)
|
||||
// cyan := oI:SetColor( 0, 255, 255 )
|
||||
|
||||
/* Allocate drawing color */
|
||||
// blue := oI:SetColor(0, 0, 200)
|
||||
// blue := oI:SetColor( 0, 0, 200 )
|
||||
|
||||
//oI:SetTransparent( blue )
|
||||
oI:SetFontName( cFont )
|
||||
oI:SetFontPitch( nPitch )
|
||||
//__OutDebug( oI:GetFTFontHeight() )
|
||||
aSize := oI:GetFTStringSize( cText )
|
||||
nWidth := aSize[1]
|
||||
nHeight := aSize[2]
|
||||
nX := aSize[3]
|
||||
nY := aSize[4]
|
||||
nWidth := aSize[ 1 ]
|
||||
nHeight := aSize[ 2 ]
|
||||
nX := aSize[ 3 ]
|
||||
nY := aSize[ 4 ]
|
||||
oI:Resize( nWidth, nHeight )
|
||||
|
||||
|
||||
/* Allocate drawing color */
|
||||
blue := oI:SetColor(0, 0, 200)
|
||||
blue := oI:SetColor( 0, 0, 200 )
|
||||
oI:SetFontName( cPath + "verdana.ttf" )
|
||||
oI:SetFontPitch( nPitch )
|
||||
oI:SayFreeType( 0 - nX, 0 + nHeight - nY, cText, , , 0, blue )
|
||||
@@ -205,13 +210,14 @@ PROCEDURE OutJpg( cText, nPitch )
|
||||
//oI:SetColor( blue )
|
||||
//oI:Say( 0, 0, cText )
|
||||
|
||||
WRITE 'content-type: image/jpeg' + CHR(13)+CHR(10)
|
||||
WRITE 'content-type: image/jpeg' + Chr( 13 ) + Chr( 10 )
|
||||
|
||||
oI:OutputJpeg()
|
||||
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
FUNCTION GetVars( cFields, cSeparator )
|
||||
|
||||
LOCAL hHashVars := { => }
|
||||
LOCAL aField, cField, aFields
|
||||
LOCAL cName, xValue
|
||||
@@ -226,14 +232,14 @@ FUNCTION GetVars( cFields, cSeparator )
|
||||
LOOP
|
||||
ENDIF
|
||||
|
||||
cName := LTrim( aField[1] )
|
||||
xValue := UrlDecode( aField[2] )
|
||||
cName := LTrim( aField[ 1 ] )
|
||||
xValue := UrlDecode( aField[ 2 ] )
|
||||
|
||||
// Tracelog( "cName, xValue", cName, xValue )
|
||||
|
||||
// is it an array entry?
|
||||
IF Substr( cName, Len( cName ) - 1 ) == "[]"
|
||||
cName := Substr( cName, 1, Len( cName ) - 2 )
|
||||
IF SubStr( cName, Len( cName ) - 1 ) == "[]"
|
||||
cName := SubStr( cName, 1, Len( cName ) - 2 )
|
||||
|
||||
hHashVars[ cName ] := { xValue }
|
||||
|
||||
@@ -246,9 +252,10 @@ FUNCTION GetVars( cFields, cSeparator )
|
||||
NEXT
|
||||
//__OutDebug( hHashVars )
|
||||
|
||||
RETURN hHashVars
|
||||
RETURN hHashVars
|
||||
|
||||
FUNCTION GetParams( aParams )
|
||||
|
||||
LOCAL hHashVars := { => }
|
||||
LOCAL aField, cField, aFields
|
||||
LOCAL cName, xValue
|
||||
@@ -261,14 +268,14 @@ FUNCTION GetParams( aParams )
|
||||
LOOP
|
||||
ENDIF
|
||||
|
||||
cName := LTrim( aField[1] )
|
||||
xValue := UrlDecode( aField[2] )
|
||||
cName := LTrim( aField[ 1 ] )
|
||||
xValue := UrlDecode( aField[ 2 ] )
|
||||
|
||||
// Tracelog( "cName, xValue", cName, xValue )
|
||||
|
||||
// is it an array entry?
|
||||
IF Substr( cName, Len( cName ) - 1 ) == "[]"
|
||||
cName := Substr( cName, 1, Len( cName ) - 2 )
|
||||
IF SubStr( cName, Len( cName ) - 1 ) == "[]"
|
||||
cName := SubStr( cName, 1, Len( cName ) - 2 )
|
||||
|
||||
hHashVars[ cName ] := { xValue }
|
||||
|
||||
@@ -281,34 +288,37 @@ FUNCTION GetParams( aParams )
|
||||
NEXT
|
||||
//__OutDebug( hHashVars )
|
||||
|
||||
RETURN hHashVars
|
||||
RETURN hHashVars
|
||||
|
||||
//***********************************************************
|
||||
// Decoding URL
|
||||
// Can return both a string or a number
|
||||
//
|
||||
|
||||
************************************************************
|
||||
* Decoding URL
|
||||
* Can return both a string or a number
|
||||
*
|
||||
FUNCTION URLDecode( cStr )
|
||||
|
||||
LOCAL cRet := "", i, cCar
|
||||
|
||||
// LOCAL lNumeric := .T.
|
||||
|
||||
FOR i := 1 TO Len( cStr )
|
||||
cCar := cStr[i]
|
||||
cCar := cStr[ i ]
|
||||
|
||||
DO CASE
|
||||
CASE cCar == "+"
|
||||
cRet += " "
|
||||
|
||||
CASE cCar == "+"
|
||||
cRet += " "
|
||||
|
||||
CASE cCar == "%"
|
||||
i ++
|
||||
cRet += Chr( hb_HexToNum( SubStr( cStr, i, 2 ) ) )
|
||||
i ++
|
||||
CASE cCar == "%"
|
||||
i++
|
||||
cRet += Chr( hb_HexToNum( SubStr( cStr, i, 2 ) ) )
|
||||
i++
|
||||
|
||||
OTHERWISE
|
||||
cRet += cCar
|
||||
cRet += cCar
|
||||
|
||||
ENDCASE
|
||||
|
||||
// IF (cRet[i] > "9" .or. cRet[i] < "0") .and. cRet[i] != "."
|
||||
// IF (cRet[ i ] > "9" .or. cRet[ i ] < "0") .and. cRet[ i ] != "."
|
||||
// lNumeric := .F.
|
||||
// ENDIF
|
||||
NEXT
|
||||
@@ -317,31 +327,31 @@ FUNCTION URLDecode( cStr )
|
||||
// cRet := Val( cRet )
|
||||
// ENDIF
|
||||
|
||||
RETURN cRet
|
||||
RETURN cRet
|
||||
|
||||
FUNCTION URLEncode( cStr )
|
||||
|
||||
LOCAL cRet := "", i, nVal, cCar
|
||||
|
||||
FOR i := 1 TO Len( cStr )
|
||||
cCar := cStr[i]
|
||||
cCar := cStr[ i ]
|
||||
DO CASE
|
||||
CASE cCar == " "
|
||||
cRet += "+"
|
||||
|
||||
CASE cCar == " "
|
||||
cRet += "+"
|
||||
CASE cCar >= "A" .AND. cCar <= "Z"
|
||||
cRet += cCar
|
||||
|
||||
CASE cCar >= "A" .and. cCar <= "Z"
|
||||
cRet += cCar
|
||||
CASE cCar >= "a" .AND. cCar <= "z"
|
||||
cRet += cCar
|
||||
|
||||
CASE cCar >= "a" .and. cCar <= "z"
|
||||
cRet += cCar
|
||||
CASE cCar >= "0" .AND. cCar <= "9"
|
||||
cRet += cCar
|
||||
|
||||
CASE cCar >= "0" .and. cCar <= "9"
|
||||
cRet += cCar
|
||||
|
||||
OTHERWISE
|
||||
nVal := Asc( cCar )
|
||||
cRet += "%" + hb_NumToHex( nVal )
|
||||
OTHERWISE
|
||||
nVal := Asc( cCar )
|
||||
cRet += "%" + hb_NumToHex( nVal )
|
||||
ENDCASE
|
||||
NEXT
|
||||
|
||||
RETURN cRet
|
||||
RETURN cRet
|
||||
|
||||
@@ -16,25 +16,25 @@
|
||||
|
||||
PROCEDURE Main()
|
||||
|
||||
LOCAL oI := GDImage():Create( 600, 300 )
|
||||
LOCAL oI := GDImage():Create( 600, 300 )
|
||||
|
||||
LOCAL black := oI:SetColor( 0, 0, 0 )
|
||||
LOCAL black := oI:SetColor( 0, 0, 0 )
|
||||
|
||||
oI:SetColor( black )
|
||||
oI:SetFontName("C:\windows\fonts\arial.ttf")
|
||||
oI:SetFontPitch( 10 )
|
||||
oI:SetColor( black )
|
||||
oI:SetFontName( GetEnv( "WINDIR" ) + "\fonts\arial.ttf" )
|
||||
oI:SetFontPitch( 10 )
|
||||
|
||||
// Resolution = 96 dpi, default
|
||||
oI:SayFreeType( 10, 100, "GD_RESOLUTION: 96 dpi" )
|
||||
// Resolution = 96 dpi, default
|
||||
oI:SayFreeType( 10, 100, "GD_RESOLUTION: 96 dpi" )
|
||||
|
||||
// Resolution = 150 dpi, using parameter 12
|
||||
oI:SayFreeType( 10, 150, "GD_RESOLUTION: 150 dpi",,,,,,,, 150 )
|
||||
// Resolution = 150 dpi, using parameter 12
|
||||
oI:SayFreeType( 10, 150, "GD_RESOLUTION: 150 dpi",,,,,,,, 150 )
|
||||
|
||||
// Resolution = 300 dpi, using parameter 12
|
||||
oI:SayFreeType( 10, 200, "GD_RESOLUTION: 300 dpi",,,,,,,, 300 )
|
||||
// Resolution = 300 dpi, using parameter 12
|
||||
oI:SayFreeType( 10, 200, "GD_RESOLUTION: 300 dpi",,,,,,,, 300 )
|
||||
|
||||
oI:SavePng( IMAGES_OUT + "testdpi.png" )
|
||||
oI:SaveJpeg( IMAGES_OUT + "testdpi.jpg" )
|
||||
oI:SaveGif( IMAGES_OUT + "testdpi.gif" )
|
||||
oI:SavePng( IMAGES_OUT + "testdpi.png" )
|
||||
oI:SaveJpeg( IMAGES_OUT + "testdpi.jpg" )
|
||||
oI:SaveGif( IMAGES_OUT + "testdpi.gif" )
|
||||
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* GD Class test file: tostring() demo
|
||||
*/
|
||||
|
||||
|
||||
#include "gd.ch"
|
||||
#include "simpleio.ch"
|
||||
|
||||
#define IMAGES_IN "imgs_in" + hb_ps()
|
||||
#define IMAGES_OUT "imgs_out" + hb_ps()
|
||||
@@ -20,7 +20,7 @@ PROCEDURE Main()
|
||||
|
||||
/*
|
||||
// Check output directory
|
||||
IF !ISDirectory( IMAGES_OUT )
|
||||
IF !hb_DirExists( IMAGES_OUT )
|
||||
DirMake( IMAGES_OUT )
|
||||
ENDIF
|
||||
*/
|
||||
@@ -40,4 +40,4 @@ PROCEDURE Main()
|
||||
? "Look at " + IMAGES_OUT + " folder for output images"
|
||||
?
|
||||
|
||||
RETURN
|
||||
RETURN
|
||||
|
||||
@@ -34,7 +34,7 @@ PROCEDURE DrawFlake( lOpenPoly )
|
||||
nSideLen := 1500
|
||||
nOrder := 7
|
||||
|
||||
cImageName := IIF( lOpenPoly, "flakeo.png", "flake.png" )
|
||||
cImageName := iif( lOpenPoly, "flakeo.png", "flake.png" )
|
||||
|
||||
gdImage := gdImageCreate( 1900, 2100 )
|
||||
gdImageColorAllocate( gdImage, 0, 0, 0 )
|
||||
@@ -54,7 +54,7 @@ PROCEDURE DrawFlake( lOpenPoly )
|
||||
|
||||
/** In green */
|
||||
gdColor := gdImageColorAllocate( gdImage, 0, 255, 0 )
|
||||
IIF( lOpenPoly,;
|
||||
iif( lOpenPoly,;
|
||||
gdImageOpenPolygon( gdImage, s_aCoords, gdColor ),;
|
||||
gdImagePolygon( gdImage, s_aCoords, gdColor ) )
|
||||
|
||||
@@ -73,7 +73,7 @@ PROCEDURE DrawFlake( lOpenPoly )
|
||||
|
||||
/** In yellow */
|
||||
gdColor := gdImageColorAllocate( gdImage, 255, 255, 0 )
|
||||
IIF( lOpenPoly,;
|
||||
iif( lOpenPoly,;
|
||||
gdImageOpenPolygon( gdImage, s_aCoords, gdColor ),;
|
||||
gdImagePolygon( gdImage, s_aCoords, gdColor ) )
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
IF "EGA" $ UPPER( cVidMode )
|
||||
SETMODE( 43, 80 )
|
||||
ENDIF
|
||||
lColour := iif( "MONO" $ UPPER( cVidMode ), .F., ISCOLOR() )
|
||||
lColour := iif( "MONO" $ UPPER( cVidMode ), .F., IsColor() )
|
||||
|
||||
SET SCOREBOARD Off
|
||||
SETCURSOR( SC_NONE )
|
||||
@@ -168,7 +168,7 @@ LOCAL nColSav := COL()
|
||||
LOCAL aEnvSav := FT_SaveSets()
|
||||
LOCAL cScrSav := SAVESCREEN( 00, 00, MAXROW(), MAXCOL() )
|
||||
|
||||
DEFAULT lColour TO ISCOLOR()
|
||||
DEFAULT lColour TO IsColor()
|
||||
DEFAULT cChr TO chr(254)+chr(254)
|
||||
cChr := PadR( cChr, 2 )
|
||||
|
||||
@@ -261,7 +261,7 @@ DEFAULT aOpt[ C_TYPE ] TO "W"
|
||||
aOpt[ C_CLR ] := UPPER( aOpt[ C_CLR ] ) // need upper case
|
||||
aOpt[ C_TYPE ] := UPPER( aOpt[ C_TYPE ] )
|
||||
|
||||
DEFAULT lColour TO ISCOLOR()
|
||||
DEFAULT lColour TO IsColor()
|
||||
|
||||
*.... display appropriate prompts based on type of colour setting
|
||||
nChoice := 1
|
||||
|
||||
@@ -83,7 +83,7 @@ THREAD STATIC NHPOS, NVPOS, NMAXROW, NMAXCOL
|
||||
|
||||
cCmdLine := iif( cCmdLine == NIL, "", cCmdLine )
|
||||
|
||||
lColor := iif( "MONO" $ UPPER( cCmdLine ), .F., ISCOLOR() )
|
||||
lColor := iif( "MONO" $ UPPER( cCmdLine ), .F., IsColor() )
|
||||
|
||||
* Border, Box, Bar, Current, Unselected
|
||||
aColors := iif( lColor, {"W+/G", "N/G", "N/G", "N/W", "N+/G"}, ;
|
||||
|
||||
@@ -331,7 +331,7 @@ STATIC FUNCTION _ftMakeAlpha ( cStr )
|
||||
LOCAL x, cAlpha := ""
|
||||
|
||||
FOR x := 1 to LEN( cStr )
|
||||
IF SUBSTR( cStr, x, 1 ) == " " .OR. ISALPHA( SUBSTR( cStr, x, 1 ) )
|
||||
IF SUBSTR( cStr, x, 1 ) == " " .OR. IsAlpha( SUBSTR( cStr, x, 1 ) )
|
||||
cAlpha := cAlpha + SUBSTR( cStr, x, 1 )
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#require "hbzebra"
|
||||
#require "hbcairo"
|
||||
|
||||
#include "hbzebra.ch"
|
||||
#include "hbcairo.ch"
|
||||
|
||||
@@ -74,7 +77,7 @@ PROCEDURE DrawBarcode( hCairo, nY, nLineWidth, cType, cCode, nFlags )
|
||||
ENDIF
|
||||
cairo_move_to( hCairo, 40, nY + 13 )
|
||||
cairo_show_text( hCairo, cType )
|
||||
IF Len( cTxt := hb_zebra_getcode( hZebra ) ) < 20
|
||||
IF Len( cTxt := hb_zebra_getcode( hZebra ) ) < 20
|
||||
cairo_move_to( hCairo, 100, nY + 13 )
|
||||
cairo_show_text( hCairo, cTxt )
|
||||
ENDIF
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#require "hbzebra"
|
||||
#require "hbhpdf"
|
||||
|
||||
#include "hbzebra.ch"
|
||||
#include "harupdf.ch"
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#require "hbzebra"
|
||||
#require "hbwin"
|
||||
|
||||
#include "hbzebra.ch"
|
||||
#include "hbwin.ch"
|
||||
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#require "hbziparc"
|
||||
|
||||
#include "simpleio.ch"
|
||||
|
||||
PROCEDURE Main( cZip, ... )
|
||||
|
||||
? hb_UnzipFile( cZip, NIL, .F., NIL, NIL, hb_AParams(), {|x, y| QOut( Str( x / y * 100, 3 ) + "%" ) } )
|
||||
? hb_UnzipFile( cZip, NIL, .F., NIL, NIL, hb_AParams(), {| x, y | QOut( Str( x / y * 100, 3 ) + "%" ) } )
|
||||
|
||||
RETURN
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#require "hbziparc"
|
||||
|
||||
#include "simpleio.ch"
|
||||
|
||||
PROCEDURE Main( cZip, ... )
|
||||
LOCAL a, b, c
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ PROCEDURE SetZipReadOnly( lReadOnly )
|
||||
|
||||
PROCEDURE hb_SetZipComment( cComment )
|
||||
|
||||
IF cComment == NIL .OR. ISCHARACTER( cComment )
|
||||
IF cComment == NIL .OR. HB_ISSTRING( cComment )
|
||||
t_cComment := cComment
|
||||
ENDIF
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
Demo of ADS Connection handling and Data Dictionaries
|
||||
*/
|
||||
|
||||
#require "rddads"
|
||||
|
||||
#include "ads.ch"
|
||||
REQUEST ADS
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#require "rddads"
|
||||
|
||||
#include "ord.ch"
|
||||
#include "set.ch"
|
||||
#include "ads.ch"
|
||||
|
||||
@@ -143,7 +143,7 @@ STATIC FUNCTION CreateCounter( cValue, cBaseImage )
|
||||
|
||||
// Check output directory
|
||||
/*
|
||||
IF !ISDirectory( IMAGES_OUT )
|
||||
IF !hb_DirExists( IMAGES_OUT )
|
||||
DirMake( IMAGES_OUT )
|
||||
ENDIF
|
||||
*/
|
||||
|
||||
@@ -187,13 +187,13 @@ FUNCTION __I18N_POTARRAYLOAD( cFile, cErrorMsg )
|
||||
nOldIndex := nIndex
|
||||
nIndex := 2
|
||||
n := 13
|
||||
IF ISDIGIT( substr( cLine, n, 1 ) )
|
||||
IF IsDigit( substr( cLine, n, 1 ) )
|
||||
nIndex := VAL( substr( cLine, n ) ) + 1
|
||||
IF nIndex < 1
|
||||
cErrorMsg := "wrong plural form index"
|
||||
EXIT
|
||||
ENDIF
|
||||
WHILE ISDIGIT( substr( cLine, n, 1 ) )
|
||||
WHILE IsDigit( substr( cLine, n, 1 ) )
|
||||
++n
|
||||
ENDDO
|
||||
ENDIF
|
||||
@@ -224,9 +224,9 @@ FUNCTION __I18N_POTARRAYLOAD( cFile, cErrorMsg )
|
||||
nOldIndex := IIF( nMode == _I18N_MSGSTR, nIndex, -1 )
|
||||
nIndex := 0
|
||||
n := 8
|
||||
IF ISDIGIT( substr( cLine, n, 1 ) )
|
||||
IF IsDigit( substr( cLine, n, 1 ) )
|
||||
nIndex := VAL( substr( cLine, n ) )
|
||||
WHILE ISDIGIT( substr( cLine, n, 1 ) )
|
||||
WHILE IsDigit( substr( cLine, n, 1 ) )
|
||||
++n
|
||||
ENDDO
|
||||
ENDIF
|
||||
|
||||
@@ -257,7 +257,7 @@ PROCEDURE Main_STR()
|
||||
TEST_LINE( Asc( @scString ) , 72 ) /* Bug in CA-Cl*pper, it returns: "E 1 BASE 1107 Argument error (ASC) OS:0 #:0 A:1:U:HELLO F:S" */
|
||||
#endif
|
||||
|
||||
/* ISDIGIT() */
|
||||
/* IsDigit() */
|
||||
|
||||
#ifndef __XPP__
|
||||
TEST_LINE( IsDigit() , .F. )
|
||||
@@ -278,7 +278,7 @@ PROCEDURE Main_STR()
|
||||
TEST_LINE( IsDigit( "A1" ) , .F. )
|
||||
TEST_LINE( IsDigit( "1A" ) , .T. )
|
||||
|
||||
/* ISALPHA() */
|
||||
/* IsAlpha() */
|
||||
|
||||
#ifndef __XPP__
|
||||
TEST_LINE( IsAlpha() , .F. )
|
||||
@@ -307,7 +307,7 @@ PROCEDURE Main_STR()
|
||||
TEST_LINE( IsAlpha( "`" ) , .F. )
|
||||
TEST_LINE( IsAlpha( "{" ) , .F. )
|
||||
|
||||
/* ISUPPER() */
|
||||
/* IsUpper() */
|
||||
|
||||
#ifndef __XPP__
|
||||
TEST_LINE( IsUpper() , .F. )
|
||||
@@ -327,7 +327,7 @@ PROCEDURE Main_STR()
|
||||
TEST_LINE( IsUpper( "™" ) , .F. )
|
||||
TEST_LINE( IsUpper( "”" ) , .F. )
|
||||
|
||||
/* ISLOWER() */
|
||||
/* IsLower() */
|
||||
|
||||
#ifndef __XPP__
|
||||
TEST_LINE( IsLower() , .F. )
|
||||
|
||||
Reference in New Issue
Block a user