2010-11-21 15:56 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbgd/tests/tpoly.prg
+ Applied PI patch from Tamas.
* contrib/hbgd/gd.ch
! Changed tabs to spaces.
* Formatting.
- Deleted GD_VERS which was not working and its wrong concept
anyway.
* contrib/hbgd/gdwrp.c
! Fixed to always define all wrappers regardless of GD version.
* contrib/hbgd/gdimage.prg
! Deleted reliance on GD_VERS.
This commit is contained in:
@@ -16,6 +16,22 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2010-11-21 15:56 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbgd/tests/tpoly.prg
|
||||
+ Applied PI patch from Tamas.
|
||||
|
||||
* contrib/hbgd/gd.ch
|
||||
! Changed tabs to spaces.
|
||||
* Formatting.
|
||||
- Deleted GD_VERS which was not working and its wrong concept
|
||||
anyway.
|
||||
|
||||
* contrib/hbgd/gdwrp.c
|
||||
! Fixed to always define all wrappers regardless of GD version.
|
||||
|
||||
* contrib/hbgd/gdimage.prg
|
||||
! Deleted reliance on GD_VERS.
|
||||
|
||||
2010-11-21 13:53 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbcpage.hbx
|
||||
* harbour/src/codepage/Makefile
|
||||
|
||||
@@ -50,104 +50,88 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* See doc/license files for licensing terms.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GD_CH
|
||||
#define GD_CH
|
||||
|
||||
|
||||
#if ( defined( HB_OS_WIN ) || defined( __WIN32__ ) )
|
||||
#define GD_VERS 2033
|
||||
#else
|
||||
#define GD_VERS 2028
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
In the wonderful new world of gd 2.0, you can of course have
|
||||
many more colors when using truecolor mode. */
|
||||
|
||||
#define gdMaxColors 256
|
||||
#define gdMaxColors 256
|
||||
|
||||
#define gdAlphaMax 127
|
||||
#define gdAlphaOpaque 0
|
||||
#define gdAlphaTransparent 127
|
||||
#define gdRedMax 255
|
||||
#define gdGreenMax 255
|
||||
#define gdBlueMax 255
|
||||
#define gdAlphaMax 127
|
||||
#define gdAlphaOpaque 0
|
||||
#define gdAlphaTransparent 127
|
||||
#define gdRedMax 255
|
||||
#define gdGreenMax 255
|
||||
#define gdBlueMax 255
|
||||
|
||||
/* For backwards compatibility only. Use gdImageSetStyle()
|
||||
for MUCH more flexible line drawing. Also see
|
||||
gdImageSetBrush(). */
|
||||
#define gdDashSize 4
|
||||
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)
|
||||
#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)
|
||||
This is used in line styles only. */
|
||||
#define gdTransparent ( -6 )
|
||||
|
||||
#define gdAntiAliased (-7)
|
||||
#define gdAntiAliased ( -7 )
|
||||
|
||||
#define gdFTEX_LINESPACE 1
|
||||
#define gdFTEX_CHARMAP 2
|
||||
#define gdFTEX_RESOLUTION 4
|
||||
#define gdFTEX_LINESPACE 1
|
||||
#define gdFTEX_CHARMAP 2
|
||||
#define gdFTEX_RESOLUTION 4
|
||||
|
||||
/* 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
|
||||
gdFTEX_CHARMAP bit in 'flags'. */
|
||||
#define gdFTEX_Unicode 0
|
||||
#define gdFTEX_Shift_JIS 1
|
||||
#define gdFTEX_Big5 2
|
||||
|
||||
#define gdArc 0
|
||||
#define gdPie gdArc
|
||||
#define gdChord 1
|
||||
#define gdNoFill 2
|
||||
#define gdEdged 4
|
||||
#define gdArc 0
|
||||
#define gdPie gdArc
|
||||
#define gdChord 1
|
||||
#define gdNoFill 2
|
||||
#define gdEdged 4
|
||||
|
||||
#define GD2_CHUNKSIZE 128
|
||||
#define GD2_CHUNKSIZE_MIN 64
|
||||
#define GD2_CHUNKSIZE_MAX 4096
|
||||
|
||||
#define GD2_CHUNKSIZE 128
|
||||
#define GD2_CHUNKSIZE_MIN 64
|
||||
#define GD2_CHUNKSIZE_MAX 4096
|
||||
#define GD2_VERS 2
|
||||
#define GD2_ID "gd2"
|
||||
|
||||
#define GD2_VERS 2
|
||||
#define GD2_ID "gd2"
|
||||
#define GD2_FMT_RAW 1
|
||||
#define GD2_FMT_COMPRESSED 2
|
||||
|
||||
#define GD2_FMT_RAW 1
|
||||
#define GD2_FMT_COMPRESSED 2
|
||||
|
||||
#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 */
|
||||
#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 */
|
||||
#define GD_RESOLUTION 96 /* pixels per inch */
|
||||
|
||||
/* Legal values for Disposal. gdDisposalNone is always used by
|
||||
the built-in optimizer if previm is passed. */
|
||||
the built-in optimizer if previm is passed. */
|
||||
#define gdDisposalUnknown 0
|
||||
#define gdDisposalNone 1
|
||||
#define gdDisposalRestoreBackground 2
|
||||
#define gdDisposalRestorePrevious 3
|
||||
|
||||
|
||||
/* FSG - text alignment */
|
||||
#define gdAlignLeft 0
|
||||
#define gdAlignCenter 1
|
||||
#define gdAlignRight 2
|
||||
#define gdAlignLeft 0
|
||||
#define gdAlignCenter 1
|
||||
#define gdAlignRight 2
|
||||
|
||||
#endif // GD_CH
|
||||
#endif /* GD_CH */
|
||||
|
||||
@@ -54,9 +54,9 @@
|
||||
#include "hbclass.ch"
|
||||
#include "gd.ch"
|
||||
|
||||
#define DEFAULT( x, y ) IIF( x == NIL, x := y, )
|
||||
#define DEFAULT( x, y ) iif( x == NIL, x := y, )
|
||||
|
||||
CLASS GDImage
|
||||
CREATE CLASS GDImage
|
||||
|
||||
PROTECTED:
|
||||
DATA pImage
|
||||
@@ -149,9 +149,7 @@ CLASS GDImage
|
||||
|
||||
// Functions usefull for polygons
|
||||
METHOD Polygon( aPoints, lFilled, color )
|
||||
#if ( GD_VERS >= 2033 )
|
||||
METHOD OpenPolygon( aPoints, color )
|
||||
#endif
|
||||
METHOD AddPoint( x, y ) INLINE aAdd( ::aPoints, { x, y } )
|
||||
METHOD ResetPoints() INLINE ::aPoints := {}
|
||||
METHOD Points() INLINE Len( ::aPoints )
|
||||
@@ -297,64 +295,62 @@ ENDCLASS
|
||||
|
||||
METHOD New( sx, sy ) CLASS GDImage
|
||||
::Create( sx, sy )
|
||||
RETURN Self
|
||||
RETURN Self
|
||||
|
||||
METHOD PROCEDURE Destruct() CLASS GDImage
|
||||
//__OutDebug( "Destroyed" )
|
||||
IF ::lDestroy
|
||||
::Destroy()
|
||||
ENDIF
|
||||
RETURN
|
||||
//__OutDebug( "Destroyed" )
|
||||
IF ::lDestroy
|
||||
::Destroy()
|
||||
ENDIF
|
||||
RETURN
|
||||
|
||||
METHOD Polygon( aPoints, lFilled, color ) CLASS GDImage
|
||||
DEFAULT aPoints TO ::aPoints
|
||||
DEFAULT lFilled TO .F.
|
||||
DEFAULT color TO ::pColor
|
||||
IF lFilled
|
||||
gdImageFilledPolygon( ::pImage, aPoints, color )
|
||||
ELSE
|
||||
gdImagePolygon( ::pImage, aPoints, color )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
DEFAULT aPoints TO ::aPoints
|
||||
DEFAULT lFilled TO .F.
|
||||
DEFAULT color TO ::pColor
|
||||
IF lFilled
|
||||
gdImageFilledPolygon( ::pImage, aPoints, color )
|
||||
ELSE
|
||||
gdImagePolygon( ::pImage, aPoints, color )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
#if ( GD_VERS >= 2033 )
|
||||
METHOD OpenPolygon( aPoints, color ) CLASS GDImage
|
||||
DEFAULT aPoints TO ::aPoints
|
||||
DEFAULT color TO ::pColor
|
||||
gdImageOpenPolygon( ::pImage, aPoints, color )
|
||||
RETURN Self
|
||||
#endif
|
||||
DEFAULT aPoints TO ::aPoints
|
||||
DEFAULT color TO ::pColor
|
||||
gdImageOpenPolygon( ::pImage, aPoints, color )
|
||||
RETURN Self
|
||||
|
||||
METHOD Rectangle( x1, y1, x2, y2, lFilled, color ) CLASS GDImage
|
||||
DEFAULT lFilled TO .F.
|
||||
DEFAULT color TO ::pColor
|
||||
IF lFilled
|
||||
gdImageFilledRectangle( ::pImage, x1, y1, x2, y2, color )
|
||||
ELSE
|
||||
gdImageRectangle( ::pImage, x1, y1, x2, y2, color )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
DEFAULT lFilled TO .F.
|
||||
DEFAULT color TO ::pColor
|
||||
IF lFilled
|
||||
gdImageFilledRectangle( ::pImage, x1, y1, x2, y2, color )
|
||||
ELSE
|
||||
gdImageRectangle( ::pImage, x1, y1, x2, y2, color )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
METHOD Arc( x, y, nWidth, nHeight, nStartDegree, nEndDegree, lFilled, color, nStyle ) CLASS GDImage
|
||||
DEFAULT lFilled TO .F.
|
||||
DEFAULT color TO ::pColor
|
||||
DEFAULT nStyle TO gdArc
|
||||
IF lFilled
|
||||
gdImageFilledArc( ::pImage, x, y, nWidth, nHeight, nStartDegree, nEndDegree, color, nStyle )
|
||||
ELSE
|
||||
gdImageArc( ::pImage, x, y, nWidth, nHeight, nStartDegree, nEndDegree, color )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
DEFAULT lFilled TO .F.
|
||||
DEFAULT color TO ::pColor
|
||||
DEFAULT nStyle TO gdArc
|
||||
IF lFilled
|
||||
gdImageFilledArc( ::pImage, x, y, nWidth, nHeight, nStartDegree, nEndDegree, color, nStyle )
|
||||
ELSE
|
||||
gdImageArc( ::pImage, x, y, nWidth, nHeight, nStartDegree, nEndDegree, color )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
METHOD Ellipse( x, y, nWidth, nHeight, lFilled, color ) CLASS GDImage
|
||||
DEFAULT lFilled TO .F.
|
||||
DEFAULT color TO ::pColor
|
||||
IF lFilled
|
||||
gdImageFilledEllipse( ::pImage, x, y, nWidth, nHeight, color )
|
||||
ELSE
|
||||
gdImageEllipse( ::pImage, x, y, nWidth, nHeight, color )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
DEFAULT lFilled TO .F.
|
||||
DEFAULT color TO ::pColor
|
||||
IF lFilled
|
||||
gdImageFilledEllipse( ::pImage, x, y, nWidth, nHeight, color )
|
||||
ELSE
|
||||
gdImageEllipse( ::pImage, x, y, nWidth, nHeight, color )
|
||||
ENDIF
|
||||
RETURN Self
|
||||
|
||||
METHOD LoadFromFile( cFile ) CLASS GDImage
|
||||
LOCAL aLoad
|
||||
@@ -369,311 +365,311 @@ METHOD LoadFromFile( cFile ) CLASS GDImage
|
||||
::hFile := aLoad[2]
|
||||
::cType := aLoad[3]
|
||||
::cMime := aLoad[4]
|
||||
RETURN Self
|
||||
RETURN Self
|
||||
|
||||
METHOD Copy( nSrcX, nSrcY, nWidth, nHeight, nDstX, nDstY, oDestImage ) CLASS GDImage
|
||||
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nWidth TO ::Width()
|
||||
DEFAULT nHeight TO ::Height()
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nWidth TO ::Width()
|
||||
DEFAULT nHeight TO ::Height()
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopy( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nWidth, nHeight )
|
||||
RETURN oDestImage
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopy( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nWidth, nHeight )
|
||||
RETURN oDestImage
|
||||
|
||||
METHOD CopyResized( nSrcX, nSrcY, nSrcWidth, nSrcHeight, nDstX, nDstY, nDstWidth, nDstHeight, oDestImage ) CLASS GDImage
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nSrcWidth TO ::Width()
|
||||
DEFAULT nSrcHeight TO ::Height()
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
DEFAULT nDstWidth TO ::Width()
|
||||
DEFAULT nDstHeight TO ::Height()
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nSrcWidth TO ::Width()
|
||||
DEFAULT nSrcHeight TO ::Height()
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
DEFAULT nDstWidth TO ::Width()
|
||||
DEFAULT nDstHeight TO ::Height()
|
||||
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nDstWidth, nDstHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nDstWidth, nDstHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopyResized( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nDstWidth, nDstHeight, nSrcWidth, nSrcHeight )
|
||||
RETURN oDestImage
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nDstWidth, nDstHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nDstWidth, nDstHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopyResized( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nDstWidth, nDstHeight, nSrcWidth, nSrcHeight )
|
||||
RETURN oDestImage
|
||||
|
||||
METHOD CopyResampled( nSrcX, nSrcY, nSrcWidth, nSrcHeight, nDstX, nDstY, nDstWidth, nDstHeight, oDestImage ) CLASS GDImage
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nSrcWidth TO ::Width()
|
||||
DEFAULT nSrcHeight TO ::Height()
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
DEFAULT nDstWidth TO ::Width()
|
||||
DEFAULT nDstHeight TO ::Height()
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nSrcWidth TO ::Width()
|
||||
DEFAULT nSrcHeight TO ::Height()
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
DEFAULT nDstWidth TO ::Width()
|
||||
DEFAULT nDstHeight TO ::Height()
|
||||
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nDstWidth, nDstHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nDstWidth, nDstHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopyResampled( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nDstWidth, nDstHeight, nSrcWidth, nSrcHeight )
|
||||
RETURN oDestImage
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nDstWidth, nDstHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nDstWidth, nDstHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopyResampled( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nDstWidth, nDstHeight, nSrcWidth, nSrcHeight )
|
||||
RETURN oDestImage
|
||||
|
||||
METHOD CopyRotated( nSrcX, nSrcY, nWidth, nHeight, nDstX, nDstY, nAngle, oDestImage ) CLASS GDImage
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nWidth TO ::Width
|
||||
DEFAULT nHeight TO ::Height
|
||||
DEFAULT nDstX TO nWidth / 2
|
||||
DEFAULT nDstY TO nHeight / 2
|
||||
DEFAULT nAngle TO 90
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nWidth TO ::Width
|
||||
DEFAULT nHeight TO ::Height
|
||||
DEFAULT nDstX TO nWidth / 2
|
||||
DEFAULT nDstY TO nHeight / 2
|
||||
DEFAULT nAngle TO 90
|
||||
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
//__OutDebug( nAngle )
|
||||
gdImageCopyRotated( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nWidth, nHeight, nAngle )
|
||||
RETURN oDestImage
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
//__OutDebug( nAngle )
|
||||
gdImageCopyRotated( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nWidth, nHeight, nAngle )
|
||||
RETURN oDestImage
|
||||
|
||||
METHOD CopyMerge( nSrcX, nSrcY, nWidth, nHeight, nDstX, nDstY, nPerc, oDestImage ) CLASS GDImage
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nWidth TO ::Width
|
||||
DEFAULT nHeight TO ::Height
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
DEFAULT nPerc TO 100
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nWidth TO ::Width
|
||||
DEFAULT nHeight TO ::Height
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
DEFAULT nPerc TO 100
|
||||
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopyMerge( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nWidth, nHeight, nPerc )
|
||||
RETURN oDestImage
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopyMerge( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nWidth, nHeight, nPerc )
|
||||
RETURN oDestImage
|
||||
|
||||
METHOD CopyMergeGray( nSrcX, nSrcY, nWidth, nHeight, nDstX, nDstY, nPerc, oDestImage ) CLASS GDImage
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nWidth TO ::Width
|
||||
DEFAULT nHeight TO ::Height
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
DEFAULT nPerc TO 100
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nWidth TO ::Width
|
||||
DEFAULT nHeight TO ::Height
|
||||
DEFAULT nDstX TO 0
|
||||
DEFAULT nDstY TO 0
|
||||
DEFAULT nPerc TO 100
|
||||
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopyMergeGray( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nWidth, nHeight, nPerc )
|
||||
RETURN oDestImage
|
||||
IF oDestImage == NIL
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
ENDIF
|
||||
gdImageCopyMergeGray( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nWidth, nHeight, nPerc )
|
||||
RETURN oDestImage
|
||||
|
||||
METHOD CopyZoomed( nPerc, nSrcX, nSrcY, nSrcWidth, nSrcHeight ) CLASS GDImage
|
||||
LOCAL oDestImage
|
||||
LOCAL nDstX, nDstY, nDstWidth, nDstHeight
|
||||
LOCAL oDestImage
|
||||
LOCAL nDstX, nDstY, nDstWidth, nDstHeight
|
||||
|
||||
DEFAULT nPerc TO 100
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nSrcWidth TO ::Width()
|
||||
DEFAULT nSrcHeight TO ::Height()
|
||||
DEFAULT nPerc TO 100
|
||||
DEFAULT nSrcX TO 0
|
||||
DEFAULT nSrcY TO 0
|
||||
DEFAULT nSrcWidth TO ::Width()
|
||||
DEFAULT nSrcHeight TO ::Height()
|
||||
|
||||
IF nPerc < 0
|
||||
nPerc := 100
|
||||
ENDIF
|
||||
IF nPerc < 0
|
||||
nPerc := 100
|
||||
ENDIF
|
||||
|
||||
nDstX := 0
|
||||
nDstY := 0
|
||||
nDstWidth := nSrcWidth * nPerc / 100
|
||||
nDstHeight := nSrcHeight * nPerc / 100
|
||||
nDstX := 0
|
||||
nDstY := 0
|
||||
nDstWidth := nSrcWidth * nPerc / 100
|
||||
nDstHeight := nSrcHeight * nPerc / 100
|
||||
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nDstWidth, nDstHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nDstWidth, nDstHeight )
|
||||
ENDIF
|
||||
gdImageCopyResampled( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nDstWidth, nDstHeight, nSrcWidth, nSrcHeight )
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nDstWidth, nDstHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nDstWidth, nDstHeight )
|
||||
ENDIF
|
||||
gdImageCopyResampled( oDestImage:pImage, ::pImage, nDstX, nDstY, nSrcX, nSrcY, nDstWidth, nDstHeight, nSrcWidth, nSrcHeight )
|
||||
|
||||
RETURN oDestImage
|
||||
RETURN oDestImage
|
||||
|
||||
METHOD Rotate( nAngle, lInside ) CLASS GDImage
|
||||
LOCAL oDestImage
|
||||
LOCAL nWidth, nHeight
|
||||
LOCAL nAngRad := nAngle * PI() / 180
|
||||
LOCAL oDestImage
|
||||
LOCAL nWidth, nHeight
|
||||
LOCAL nAngRad := nAngle * PI() / 180
|
||||
|
||||
DEFAULT lInside TO .F.
|
||||
DEFAULT lInside TO .F.
|
||||
|
||||
IF !lInside
|
||||
nWidth := ::Width * cos( nAngRad ) + ::Height * sin( nAngRad )
|
||||
nHeight := ::Width * sin( nAngRad ) + ::Height * cos( nAngRad )
|
||||
ELSE
|
||||
nWidth := ::Width
|
||||
nHeight := ::Height
|
||||
ENDIF
|
||||
//__OutDebug( ::Width, ::Height )
|
||||
//__OutDebug( nWidth, nHeight )
|
||||
IF !lInside
|
||||
nWidth := ::Width * cos( nAngRad ) + ::Height * sin( nAngRad )
|
||||
nHeight := ::Width * sin( nAngRad ) + ::Height * cos( nAngRad )
|
||||
ELSE
|
||||
nWidth := ::Width
|
||||
nHeight := ::Height
|
||||
ENDIF
|
||||
//__OutDebug( ::Width, ::Height )
|
||||
//__OutDebug( nWidth, nHeight )
|
||||
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
IF !lInside
|
||||
::CopyRotated( ,,,, nWidth - nWidth/2, nHeight - nHeight/2, nAngle, oDestImage )
|
||||
ELSE
|
||||
::CopyRotated( ,,,,,, nAngle, oDestImage )
|
||||
ENDIF
|
||||
::Destroy()
|
||||
Self := ::CloneDataFrom( oDestImage )
|
||||
//Self := __ObjClone( oDestImage ) // non funziona
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( nWidth, nHeight )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( nWidth, nHeight )
|
||||
ENDIF
|
||||
IF !lInside
|
||||
::CopyRotated( ,,,, nWidth - nWidth/2, nHeight - nHeight/2, nAngle, oDestImage )
|
||||
ELSE
|
||||
::CopyRotated( ,,,,,, nAngle, oDestImage )
|
||||
ENDIF
|
||||
::Destroy()
|
||||
Self := ::CloneDataFrom( oDestImage )
|
||||
//Self := __ObjClone( oDestImage ) // non funziona
|
||||
|
||||
// Move new image to existing one
|
||||
// Signal that this image must not be destroyed
|
||||
oDestImage:lDestroy := .F.
|
||||
oDestImage := NIL
|
||||
// Move new image to existing one
|
||||
// Signal that this image must not be destroyed
|
||||
oDestImage:lDestroy := .F.
|
||||
oDestImage := NIL
|
||||
|
||||
RETURN Self
|
||||
RETURN Self
|
||||
|
||||
METHOD Crop( nX, nY, nWidth, nHeight ) CLASS GDImage
|
||||
LOCAL oDestImage
|
||||
LOCAL oDestImage
|
||||
|
||||
oDestImage := ::CopyResized( nX, nY, nWidth, nHeight, 0, 0, nWidth, nHeight )
|
||||
::Destroy()
|
||||
Self := ::CloneDataFrom( oDestImage )
|
||||
//Self := __ObjClone( oDestImage ) // non funziona
|
||||
oDestImage := ::CopyResized( nX, nY, nWidth, nHeight, 0, 0, nWidth, nHeight )
|
||||
::Destroy()
|
||||
Self := ::CloneDataFrom( oDestImage )
|
||||
//Self := __ObjClone( oDestImage ) // non funziona
|
||||
|
||||
// Move new image to existing one
|
||||
// Signal that this image must not be destroyed
|
||||
oDestImage:lDestroy := .F.
|
||||
oDestImage := NIL
|
||||
// Move new image to existing one
|
||||
// Signal that this image must not be destroyed
|
||||
oDestImage:lDestroy := .F.
|
||||
oDestImage := NIL
|
||||
|
||||
RETURN Self
|
||||
RETURN Self
|
||||
|
||||
METHOD Resize( nWidth, nHeight ) CLASS GDImage
|
||||
LOCAL oDestImage
|
||||
LOCAL oDestImage
|
||||
|
||||
oDestImage := ::CopyResampled( 0, 0, NIL, NIL, 0, 0, nWidth, nHeight )
|
||||
::Destroy()
|
||||
Self := ::CloneDataFrom( oDestImage )
|
||||
//Self := __ObjClone( oDestImage ) // non funziona
|
||||
oDestImage := ::CopyResampled( 0, 0, NIL, NIL, 0, 0, nWidth, nHeight )
|
||||
::Destroy()
|
||||
Self := ::CloneDataFrom( oDestImage )
|
||||
//Self := __ObjClone( oDestImage ) // non funziona
|
||||
|
||||
// Move new image to existing one
|
||||
// Signal that this image must not be destroyed
|
||||
oDestImage:lDestroy := .F.
|
||||
oDestImage := NIL
|
||||
// Move new image to existing one
|
||||
// Signal that this image must not be destroyed
|
||||
oDestImage:lDestroy := .F.
|
||||
oDestImage := NIL
|
||||
|
||||
RETURN Self
|
||||
RETURN Self
|
||||
|
||||
METHOD Zoom( nPerc ) CLASS GDImage
|
||||
LOCAL oDestImage
|
||||
LOCAL oDestImage
|
||||
|
||||
oDestImage := ::CopyZoomed( nPerc )
|
||||
::Destroy()
|
||||
Self := ::CloneDataFrom( oDestImage )
|
||||
//Self := __ObjClone( oDestImage ) // non funziona
|
||||
oDestImage := ::CopyZoomed( nPerc )
|
||||
::Destroy()
|
||||
Self := ::CloneDataFrom( oDestImage )
|
||||
//Self := __ObjClone( oDestImage ) // non funziona
|
||||
|
||||
// Move new image to existing one
|
||||
// Signal that this image must not be destroyed
|
||||
oDestImage:lDestroy := .F.
|
||||
oDestImage := NIL
|
||||
// Move new image to existing one
|
||||
// Signal that this image must not be destroyed
|
||||
oDestImage:lDestroy := .F.
|
||||
oDestImage := NIL
|
||||
|
||||
RETURN Self
|
||||
RETURN Self
|
||||
|
||||
METHOD Clone() CLASS GDImage
|
||||
LOCAL oDestImage
|
||||
LOCAL pImage
|
||||
LOCAL oDestImage
|
||||
LOCAL pImage
|
||||
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( ::Width, ::Height )
|
||||
ELSE
|
||||
oDestImage := GDImage():Create( ::Width, ::Height )
|
||||
ENDIF
|
||||
IF ::IsTrueColor()
|
||||
oDestImage := GDImage():CreateTrueColor( ::Width, ::Height )
|
||||
ELSE
|
||||
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 )
|
||||
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 := .F.
|
||||
//oDestImage := NIL
|
||||
//oDestImage:pImage := pImage
|
||||
//pImage := oDestImage:pImage
|
||||
//// Signal that this image must not be destroyed
|
||||
//oDestImage:lDestroy := .F.
|
||||
//oDestImage := NIL
|
||||
//oDestImage:pImage := pImage
|
||||
|
||||
RETURN oDestImage
|
||||
RETURN oDestImage
|
||||
|
||||
METHOD Say( x, y, cString, color, nAlign ) CLASS GDImage
|
||||
LOCAL nWidth, nLen
|
||||
LOCAL nPosX
|
||||
LOCAL nWidth, nLen
|
||||
LOCAL nPosX
|
||||
|
||||
DEFAULT color TO ::pColor
|
||||
DEFAULT nAlign TO gdAlignLeft
|
||||
DEFAULT color TO ::pColor
|
||||
DEFAULT nAlign TO gdAlignLeft
|
||||
|
||||
IF nAlign == gdAlignCenter
|
||||
nWidth := ::GetFontWidth()
|
||||
nLen := Len( cString )
|
||||
nPosX := x - ( nLen / 2 * nWidth )
|
||||
ELSEIF nAlign == gdAlignRight
|
||||
nWidth := ::GetFontWidth()
|
||||
nLen := Len( cString )
|
||||
nPosX := x - ( nLen * nWidth )
|
||||
ELSE
|
||||
nPosX := x
|
||||
ENDIF
|
||||
IF nAlign == gdAlignCenter
|
||||
nWidth := ::GetFontWidth()
|
||||
nLen := Len( cString )
|
||||
nPosX := x - ( nLen / 2 * nWidth )
|
||||
ELSEIF nAlign == gdAlignRight
|
||||
nWidth := ::GetFontWidth()
|
||||
nLen := Len( cString )
|
||||
nPosX := x - ( nLen * nWidth )
|
||||
ELSE
|
||||
nPosX := x
|
||||
ENDIF
|
||||
|
||||
gdImageString( ::pImage, ::pFont, nPosX, y, cString, color )
|
||||
RETURN Self
|
||||
gdImageString( ::pImage, ::pFont, nPosX, y, cString, color )
|
||||
RETURN Self
|
||||
|
||||
METHOD SayFreeType( x, y, cString, cFontName, nPitch, nAngle, color, nAlign, ;
|
||||
nLineSpacing, nCharMap, nResolution ) CLASS GDImage
|
||||
LOCAL nWidth, nLen
|
||||
LOCAL nPosX
|
||||
LOCAL nWidth, nLen
|
||||
LOCAL nPosX
|
||||
|
||||
DEFAULT nAlign TO gdAlignLeft
|
||||
DEFAULT color TO ::pColor
|
||||
DEFAULT cFontName TO ::cFontName
|
||||
DEFAULT nPitch TO ::nFontPitch
|
||||
DEFAULT nAngle TO ::nFontAngle
|
||||
DEFAULT nAlign TO gdAlignLeft
|
||||
DEFAULT color TO ::pColor
|
||||
DEFAULT cFontName TO ::cFontName
|
||||
DEFAULT nPitch TO ::nFontPitch
|
||||
DEFAULT nAngle TO ::nFontAngle
|
||||
|
||||
IF nAlign == gdAlignCenter
|
||||
nWidth := nPitch //gdImageFTWidth( cFontName, nPitch )//, ::Radians( nAngle ) ) //::GetFontWidth()
|
||||
//__OutDebug( "nWidth", nWidth )
|
||||
nLen := Len( cString )
|
||||
nPosX := x - ( (nLen / 2) * nWidth )
|
||||
ELSEIF nAlign == gdAlignRight
|
||||
nWidth := gdImageFTWidth( cFontName, nPitch ) //, ::Radians( nAngle ) ) //::GetFontWidth()
|
||||
nLen := Len( cString )
|
||||
nPosX := x - ( nLen * nWidth )
|
||||
ELSE
|
||||
nPosX := x
|
||||
ENDIF
|
||||
IF nAlign == gdAlignCenter
|
||||
nWidth := nPitch //gdImageFTWidth( cFontName, nPitch )//, ::Radians( nAngle ) ) //::GetFontWidth()
|
||||
//__OutDebug( "nWidth", nWidth )
|
||||
nLen := Len( cString )
|
||||
nPosX := x - ( (nLen / 2) * nWidth )
|
||||
ELSEIF nAlign == gdAlignRight
|
||||
nWidth := gdImageFTWidth( cFontName, nPitch ) //, ::Radians( nAngle ) ) //::GetFontWidth()
|
||||
nLen := Len( cString )
|
||||
nPosX := x - ( nLen * nWidth )
|
||||
ELSE
|
||||
nPosX := x
|
||||
ENDIF
|
||||
|
||||
gdImageStringFT( ::pImage, color, cFontName, nPitch, ::Radians( nAngle ), nPosX, y, ;
|
||||
cString, nLineSpacing, nCharMap, nResolution )
|
||||
gdImageStringFT( ::pImage, color, cFontName, nPitch, ::Radians( nAngle ), nPosX, y, ;
|
||||
cString, nLineSpacing, nCharMap, nResolution )
|
||||
|
||||
RETURN Self
|
||||
RETURN Self
|
||||
|
||||
METHOD CloneDataFrom( oSrc )
|
||||
// copy values from Source to Dest
|
||||
@@ -697,4 +693,4 @@ METHOD CloneDataFrom( oSrc )
|
||||
::cType := oSrc:cType
|
||||
::cMime := oSrc:cMime
|
||||
|
||||
RETURN Self
|
||||
RETURN Self
|
||||
|
||||
@@ -958,10 +958,10 @@ HB_FUNC( GDIMAGEPOLYGON ) /* original: void gdImagePolygon(gdImagePtr im, gdPoin
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------*/
|
||||
#if HB_GD_VERS( 2, 0, 33 )
|
||||
HB_FUNC( GDIMAGEOPENPOLYGON ) /* original: void gdImageOpenPolygon(gdImagePtr im, gdPointPtr points, int pointsTotal, int color) */
|
||||
/* implementation: void gdImageOpenPolygon(gdImagePtr im, gdPointPtr points, int color) */
|
||||
{
|
||||
#if HB_GD_VERS( 2, 0, 33 )
|
||||
if( hb_pcount() == 3 &&
|
||||
HB_ISPOINTER( 1 ) &&
|
||||
HB_ISARRAY( 2 ) &&
|
||||
@@ -1010,8 +1010,8 @@ HB_FUNC( GDIMAGEOPENPOLYGON ) /* original: void gdImageOpenPolygon(gdImagePtr im
|
||||
HB_ERR_FUNCNAME, 3,
|
||||
hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
|
||||
}
|
||||
}
|
||||
#endif /* ( GD_VERS >= 2033 ) */
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------*/
|
||||
|
||||
@@ -1329,9 +1329,9 @@ HB_FUNC( GDIMAGEFILLTOBORDER ) /* void gdImageFillToBorder(gdImagePtr im, int x,
|
||||
/* Disabled, because there is a .prg implementation which
|
||||
works with all gd lib versions. [vszakats] */
|
||||
#if 0
|
||||
#if HB_GD_VERS( 2, 0, 35 )
|
||||
HB_FUNC( GDIMAGEELLIPSE ) /* void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color) */
|
||||
{
|
||||
#if HB_GD_VERS( 2, 0, 35 )
|
||||
if( hb_pcount() == 6 &&
|
||||
HB_ISPOINTER( 1 ) &&
|
||||
HB_ISNUM( 2 ) &&
|
||||
@@ -1366,8 +1366,8 @@ HB_FUNC( GDIMAGEELLIPSE ) /* void gdImageEllipse(gdImagePtr im, int cx, int cy,
|
||||
hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
|
||||
hb_paramError( 5 ), hb_paramError( 6 ) );
|
||||
}
|
||||
}
|
||||
#endif /* ( GD_VERS >= 2035 ) */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------*/
|
||||
@@ -3657,10 +3657,13 @@ static void AddImageToFile( const char *szFile, const void * iptr, int sz )
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*BGD_DECLARE(void *) gdImageGifAnimBeginPtr(gdImagePtr im, int *size, int GlobalCM, int Loops); */
|
||||
/* implementation: (void *) gdImageGifAnimBegin( gdImagePtr im, cFile | nHandle, int GlobalCM, int Loops); */
|
||||
HB_FUNC( GDIMAGEGIFANIMBEGIN )
|
||||
{
|
||||
#if HB_GD_VERS( 2, 0, 33 )
|
||||
if( hb_pcount() == 4 &&
|
||||
HB_ISPOINTER( 1 ) &&
|
||||
( HB_ISCHAR( 2 ) || HB_ISNUM( 2 ) || HB_ISNIL( 2 ) ) &&
|
||||
@@ -3704,6 +3707,7 @@ HB_FUNC( GDIMAGEGIFANIMBEGIN )
|
||||
HB_ERR_FUNCNAME, 3,
|
||||
hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------*/
|
||||
@@ -3712,6 +3716,7 @@ HB_FUNC( GDIMAGEGIFANIMBEGIN )
|
||||
/* implementation: (void *) gdImageGifAnimAdd( gdImagePtr im, cFile | nHandle, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm); */
|
||||
HB_FUNC( GDIMAGEGIFANIMADD )
|
||||
{
|
||||
#if HB_GD_VERS( 2, 0, 33 )
|
||||
if( hb_pcount() == 8 &&
|
||||
HB_ISPOINTER( 1 ) &&
|
||||
( HB_ISCHAR( 2 ) || HB_ISNUM( 2 ) || HB_ISNIL( 2 ) ) &&
|
||||
@@ -3761,6 +3766,7 @@ HB_FUNC( GDIMAGEGIFANIMADD )
|
||||
hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
|
||||
hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------*/
|
||||
@@ -3769,6 +3775,7 @@ HB_FUNC( GDIMAGEGIFANIMADD )
|
||||
/* implementation: gdImageGifAnimEnd( cFile | nHandle ); */
|
||||
HB_FUNC( GDIMAGEGIFANIMEND )
|
||||
{
|
||||
#if HB_GD_VERS( 2, 0, 33 )
|
||||
if( hb_pcount() == 1 &&
|
||||
( HB_ISCHAR( 1 ) || HB_ISNUM( 1 ) || HB_ISNIL( 1 ) )
|
||||
)
|
||||
@@ -3798,7 +3805,7 @@ HB_FUNC( GDIMAGEGIFANIMEND )
|
||||
HB_ERR_FUNCNAME, 1,
|
||||
hb_paramError( 1 ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------*/
|
||||
#endif /* ( GD_VERS >= 2033 ) */
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
#include "gd.ch"
|
||||
#include "simpleio.ch"
|
||||
|
||||
#command TurnRight( <x> ) => s_nAngle += M_PI / 3 * <x>
|
||||
#command TurnLeft( <x> ) => s_nAngle -= M_PI / 3 * <x>
|
||||
#command TurnRight( <x> ) => s_nAngle += Pi() / 3 * <x>
|
||||
#command TurnLeft( <x> ) => s_nAngle -= Pi() / 3 * <x>
|
||||
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define IMAGES_OUT "imgs_out" + hb_ps()
|
||||
|
||||
STATIC s_aCoords
|
||||
@@ -27,13 +26,13 @@ PROCEDURE Main()
|
||||
|
||||
PROCEDURE DrawFlake( lOpenPoly )
|
||||
|
||||
LOCAL nDepth, nSide, nSides, nSideLen
|
||||
LOCAL nOrder, nSide, nSides, nSideLen
|
||||
LOCAL gdImage, gdColor
|
||||
LOCAL cImageName
|
||||
|
||||
nSides := 3
|
||||
nSideLen := 1500
|
||||
nDepth := 7
|
||||
nOrder := 7
|
||||
|
||||
cImageName := IIF( lOpenPoly, "flakeo.png", "flake.png" )
|
||||
|
||||
@@ -47,8 +46,8 @@ PROCEDURE DrawFlake( lOpenPoly )
|
||||
s_nAngle := 0
|
||||
|
||||
FOR nSide := 1 TO nSides
|
||||
KochFlake( nDepth, nSideLen, .F. )
|
||||
s_nAngle += M_PI * 2 / nSides
|
||||
KochFlake( nOrder, nSideLen, .F. )
|
||||
s_nAngle += Pi() * 2 / nSides
|
||||
NEXT
|
||||
|
||||
OutStd( hb_strFormat( "Drawing %d vertices%s", Len( s_aCoords ), hb_eol() ) )
|
||||
@@ -66,8 +65,8 @@ PROCEDURE DrawFlake( lOpenPoly )
|
||||
s_nAngle := 0
|
||||
|
||||
FOR nSide := 1 TO nSides
|
||||
KochFlake( nDepth, nSideLen, .T. )
|
||||
s_nAngle += M_PI * 2 / nSides
|
||||
KochFlake( nOrder, nSideLen, .T. )
|
||||
s_nAngle += Pi() * 2 / nSides
|
||||
NEXT
|
||||
|
||||
OutStd( hb_strFormat( "Drawing %d vertices%s", Len( s_aCoords ), hb_eol() ) )
|
||||
@@ -83,36 +82,36 @@ PROCEDURE DrawFlake( lOpenPoly )
|
||||
|
||||
RETURN
|
||||
|
||||
PROCEDURE KochFlake( nDepth, nSideLen, lLeftFirst )
|
||||
PROCEDURE KochFlake( nOrder, nSideLen, lLeftFirst )
|
||||
|
||||
IF nDepth == 0
|
||||
IF nOrder == 0
|
||||
AAdd( s_aCoords, {;
|
||||
s_nCoordX += Cos( s_nAngle ) * nSideLen,;
|
||||
s_nCoordY += Sin( s_nAngle ) * nSideLen;
|
||||
})
|
||||
ELSE
|
||||
KochFlake( nDepth - 1, nSideLen / 3, lLeftFirst )
|
||||
KochFlake( nOrder - 1, nSideLen / 3, lLeftFirst )
|
||||
|
||||
IF lLeftFirst
|
||||
TurnLeft( 1 )
|
||||
ELSE
|
||||
TurnRight( 1 )
|
||||
ENDIF
|
||||
KochFlake( nDepth - 1, nSideLen / 3, lLeftFirst )
|
||||
KochFlake( nOrder - 1, nSideLen / 3, lLeftFirst )
|
||||
|
||||
IF lLeftFirst
|
||||
TurnRight( 2 )
|
||||
ELSE
|
||||
TurnLeft( 2 )
|
||||
ENDIF
|
||||
KochFlake( nDepth - 1, nSideLen / 3, lLeftFirst )
|
||||
KochFlake( nOrder - 1, nSideLen / 3, lLeftFirst )
|
||||
|
||||
IF lLeftFirst
|
||||
TurnLeft( 1 )
|
||||
ELSE
|
||||
TurnRight( 1 )
|
||||
ENDIF
|
||||
KochFlake( nDepth - 1, nSideLen / 3, lLeftFirst )
|
||||
KochFlake( nOrder - 1, nSideLen / 3, lLeftFirst )
|
||||
ENDIF
|
||||
|
||||
RETURN
|
||||
|
||||
Reference in New Issue
Block a user