hbgd

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  
c:\harbour\contrib\hbgd
gdwrp.c
TypeFunctionSourceLine
STATIC HB_GARBAGE_FUNC(hb_gdImage_Destructor )
static HB_GARBAGE_FUNC( hb_gdImage_Destructor )
{
   /* Retrieve image pointer holder */
   gdImagePtr * imPtr = ( gdImagePtr * ) Cargo;

   /* Check if pointer is not NULL to avoid multiple freeing */
   if( * imPtr )
   {
      /* Destroy the image */
      gdImageDestroy( * imPtr );

      /* set pointer to NULL to avoid multiple freeing */
      * imPtr = NULL;
   }
}
gdwrp.c101
STATIC GDIMAGEPTRhb_parGdImage( int iParam )
static gdImagePtr hb_parGdImage( int iParam )
{
   gdImagePtr * imPtr =
               ( gdImagePtr * ) hb_parptrGC( hb_gdImage_Destructor, iParam );

   if( imPtr )
      return * imPtr;
   else
      return NULL;
}
gdwrp.c121
STATIC VOIDhb_retGdImage( gdImagePtr im )
static void hb_retGdImage( gdImagePtr im )
{
   gdImagePtr * imPtr;

   imPtr = ( gdImagePtr * ) hb_gcAlloc( sizeof( gdImagePtr ),
                                        hb_gdImage_Destructor );
   * imPtr = im;
   hb_retptrGC( ( void * ) imPtr );
}
gdwrp.c137
STATIC PHB_ITEMhb_gdImageItemNew( gdImagePtr im )
static PHB_ITEM hb_gdImageItemNew( gdImagePtr im )
{
   gdImagePtr * imPtr;

   imPtr = ( gdImagePtr * ) hb_gcAlloc( sizeof( gdImagePtr ),
                                        hb_gdImage_Destructor );
   * imPtr = im;
   return hb_itemPutPtrGC( NULL, ( void * ) imPtr );
}
gdwrp.c152
STATIC HB_GARBAGE_FUNC(hb_gdFont_Destructor )
static HB_GARBAGE_FUNC( hb_gdFont_Destructor )
{
   /* Retrieve Font pointer holder */
   gdFontPtr * fontPtr = ( gdFontPtr * ) Cargo;

   /* Check if pointer is not NULL to avoid multiple freeing */
   if( * fontPtr )
   {
      /* Destroy the Font */
#if 0
      /* do nothing, GD handles it directly and gdFontDestroy() not exists */
      gdFontDestroy( * fontPtr );
#endif

      /* set pointer to NULL to avoid multiple freeing */
      * fontPtr = NULL;
   }
}
gdwrp.c170
STATIC GDFONTPTRhb_parGdFont( int iParam )
static gdFontPtr hb_parGdFont( int iParam )
{
   gdFontPtr * fontPtr =
               ( gdFontPtr * ) hb_parptrGC( hb_gdFont_Destructor, iParam );

   if( fontPtr )
      return * fontPtr;
   else
      return NULL;
}
gdwrp.c193
STATIC VOIDhb_retGdFont( gdFontPtr font )
static void hb_retGdFont( gdFontPtr font )
{
   gdFontPtr * fontPtr;

   fontPtr = ( gdFontPtr * ) hb_gcAlloc( sizeof( gdFontPtr ),
                                        hb_gdFont_Destructor );
   * fontPtr = font;
   hb_retptrGC( ( void * ) fontPtr );
}
gdwrp.c209
STATIC PHB_ITEMhb_gdFontItemNew( gdFontPtr font )
static PHB_ITEM hb_gdFontItemNew( gdFontPtr font )
{
   gdFontPtr * fontPtr;

   fontPtr = ( gdFontPtr * ) hb_gcAlloc( sizeof( gdFontPtr ),
                                        hb_gdFont_Destructor );
   * fontPtr = font;
   return hb_itemPutPtrGC( NULL, ( void * ) fontPtr );
}
gdwrp.c224
STATIC VOID *LoadImageFromHandle( HB_FHANDLE fhandle, int sz )
static void * LoadImageFromHandle( HB_FHANDLE fhandle, int sz )
{
   void *iptr;

   if ( !( fhandle ) )
   {
      fhandle = 0; /* 0 = std input */
   }

   /* Read file */
   iptr = ( BYTE * ) hb_xgrab( sz );
   hb_fsReadLarge( fhandle, ( BYTE *) iptr, (ULONG) sz );
   /*   TraceLog( NULL, "Error dim %i, read %i", sz, iRead ); */

   return iptr;

}
gdwrp.c239
STATIC VOID *LoadImageFromFile( char *szFile, int *sz )
static void * LoadImageFromFile( char *szFile, int *sz )
{
   void *iptr;
   HB_FHANDLE fhandle;

   if ( ( fhandle = hb_fsOpen( ( BYTE * ) szFile, FO_READ ) ) != FS_ERROR )
   {
      /* get lenght */
      *sz = hb_fsSeek( fhandle, 0, FS_END );
      /* rewind */
      hb_fsSeek( fhandle, 0, FS_SET );

      /* Read file */
      iptr = ( BYTE * ) hb_xgrab( *sz );
      hb_fsReadLarge( fhandle, ( BYTE *) iptr, (ULONG) *sz );
      /*   TraceLog( NULL, "Error dim %i, read %i", sz, iRead ); */

      /* Close file */
      hb_fsClose( fhandle );
   }
   else
   {
      /* File error */
      iptr = NULL;
      *sz  = 0;
   }

   return iptr;

}
gdwrp.c259
STATIC VOIDSaveImageToHandle( HB_FHANDLE fhandle, void *iptr, int sz )
static void SaveImageToHandle( HB_FHANDLE fhandle, void *iptr, int sz )
{
   if ( !(fhandle) )
   {
      fhandle = 1; /* 1 = std output */
   }

   /* Write Image */
   hb_fsWriteLarge( fhandle, ( BYTE *) iptr, (ULONG) sz );
}
gdwrp.c292
STATIC VOIDSaveImageToFile( char *szFile, void *iptr, int sz )
static void SaveImageToFile( char *szFile, void *iptr, int sz )
{
   HB_FHANDLE fhandle;

   if ( ( fhandle = hb_fsCreate( ( BYTE * ) szFile, FC_NORMAL ) ) != FS_ERROR )
   {
      /* Write Image */
      SaveImageToHandle( fhandle, ( BYTE *) iptr, (ULONG) sz );

      /* Close file */
      hb_fsClose( fhandle );
   }
}
gdwrp.c305
STATIC VOIDGDImageCreateFrom( int nType )
static void GDImageCreateFrom( int nType )
{
   gdImagePtr im = NULL;
   char *szFile;
   int sz;
   void *iptr;

   /*TraceLog( NULL, "Params = %i, 1 = %i, 2 = %i \n\r", hb_pcount(), hb_parinfo( 1 ), hb_parinfo( 2 ) );*/

   if ( hb_pcount() == 1 &&
        ( hb_parinfo( 1 ) & HB_IT_STRING )
      )
   {
      /* Retrieve file name */
      szFile = hb_parcx( 1 );
      /* Retrieve image */
      iptr   = LoadImageFromFile( szFile, &sz );
   }

   /* From Image Pointer + size */
   else if ( hb_pcount() == 2 &&
        ( hb_parinfo( 1 ) & HB_IT_POINTER ) &&
        ( hb_parinfo( 2 ) & HB_IT_NUMERIC )
      )
   {

      /* Retrieve image pointer */
      iptr = hb_parGdImage( 1 );
      /* Retrieve image size */
      sz     = hb_parni( 2 );
   }

   /* From file handle */
   else if ( hb_pcount() == 2 &&
        ( hb_parinfo( 1 ) & HB_IT_NUMERIC ) &&
        ( hb_parinfo( 2 ) & HB_IT_NUMERIC )
      )
   {

      HB_FHANDLE fhandle;

      /* Retrieve file handle */
      fhandle = ( hb_parinfo( 1 ) & HB_IT_NUMERIC ) ? hb_parnl( 1 ) : 0; /* 0 = std input */
      /* Retrieve image size */
      sz     = hb_parni( 2 );

      /* retrieve image from handle */
      iptr = LoadImageFromHandle( fhandle, sz );

   }
   else
   {

      /* Parameter error */
      hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
         "GDIMAGECREATEFROM*", 2,
         hb_paramError( 1 ), hb_paramError( 2 ) );
      return;
   }

   if ( iptr && sz )
   {
      /* Create Image */
      switch ( nType )
      {
         case IMAGE_JPEG :
              im = gdImageCreateFromJpegPtr( sz, ( BYTE *) iptr );
              break;
         case IMAGE_GIF  :
              im = gdImageCreateFromGifPtr( sz, ( BYTE *) iptr );
              break;
         case IMAGE_PNG  :
              im = gdImageCreateFromPngPtr( sz, ( BYTE *) iptr );
              break;
         case IMAGE_WBMP :
              im = gdImageCreateFromWBMPPtr( sz, ( BYTE *) iptr );
              break;
         case IMAGE_GD   :
              im = gdImageCreateFromGdPtr( sz, ( BYTE *) iptr );
              break;
      }

      /* Return image pointer */
      hb_retGdImage( im );

      /* Free memory */
      hb_xfree( iptr );

   }
}
gdwrp.c321
STATIC VOIDGDImageSaveTo( int nType )
static void GDImageSaveTo( int nType )
{
   if ( hb_pcount() >= 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;
      char *szFile;
      int sz = 0;
      void *iptr = NULL;
      HB_FHANDLE fhandle;
      int level = 0, fg = 0;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Get file name or an output handler or NIL it I want a return string */
      if ( !( ISNIL(2) ||
              hb_parinfo( 2 ) & HB_IT_STRING ||
              hb_parinfo( 2 ) & HB_IT_NUMERIC ) )
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0,
            "Second argument must be NIL or numeric or a string.",
            "GDIMAGE* (Save functions)", 2,
            hb_paramError( 2 ) );
         return;
      }

      /* Retrieve compression level */
      /*TraceLog( NULL, "Count = %i\n\r", hb_pcount() ); */
      /* check if is numeric */
      if ( !( ISNIL(3) || hb_parinfo( 3 ) & HB_IT_NUMERIC ) )
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0,
            "Tirdh argument must be NIL or numeric.",
            "GDIMAGE* (Save functions)", 1,
            hb_paramError( 3 ) );
         return;
      }

      if ( nType == IMAGE_JPEG )
      {
         /* check range */
         level = ( hb_parinfo( 3 ) & HB_IT_NUMERIC ? hb_parni( 3 ) : -1 );
         if ( !( level >= -1 && level <= 95 ) )
         {
            hb_errRT_BASE_SubstR( EG_ARG, 0,
               "Compression level must be -1 (default) or a value between 0 and 95.",
               "GDIMAGEJPEG (Save functions)", 1,
               hb_paramError( 3 ) );
            return;
         }
      }
      else if ( nType == IMAGE_PNG )
      {
         /* check range */
         level = ( hb_parinfo( 3 ) & HB_IT_NUMERIC ? hb_parni( 3 ) : -1 );
         if ( !( level >= -1 && level <= 9 ) )
         {
            hb_errRT_BASE_SubstR( EG_ARG, 0,
               "Compression level must be -1 (default) or a value between 0 and 9.",
               "GDIMAGEPNG (Save functions)", 1,
               hb_paramError( 3 ) );
            return;
         }
      }
      else if ( nType == IMAGE_WBMP )
      {
         if ( !( hb_parinfo( 3 ) & HB_IT_NUMERIC ) )
         {
            hb_errRT_BASE_SubstR( EG_ARG, 0,
               "Foreground color nedeed",
               "GDIMAGEWBMP (Save functions)", 1,
               hb_paramError( 3 ) );
            return;
         }
         fg = hb_parni( 3 );
      }

      switch( nType )
      {
      case IMAGE_JPEG  :
           /* Get image Ptr */
           iptr = gdImageJpegPtr( im, &sz, level );
           break;
      case IMAGE_GIF   :
           /* Get image Ptr */
           iptr = gdImageGifPtr( im, &sz );
           break;
      case IMAGE_PNG   :
           /* Get image Ptr */
           iptr = gdImagePngPtrEx( im, &sz, level );
           break;
      case IMAGE_WBMP  :
           /* Get image Ptr */
           iptr = gdImageWBMPPtr( im, &sz, fg );
           break;
      case IMAGE_GD    :
           /* Get image Ptr */
           iptr = gdImageGdPtr( im, &sz );
           break;
      }

      /* If i get a file name */
      if ( hb_parinfo( 2 ) & HB_IT_STRING )
      {
         szFile = hb_parcx( 2 );
         SaveImageToFile( szFile, iptr, sz );
      }

      /* Write to file handle (1 = std output) */
      else if ( hb_parinfo( 2 ) & HB_IT_NUMERIC )
      {
         /* Write to std output or to a passed file */
         fhandle = ( hb_parnl( 2 ) > -1 ) ? hb_parnl( 2 ) : 1 ; /* 1 = std output */

         /* Write Image */
         SaveImageToHandle( fhandle, iptr, sz );
      }

      /* Return image as string) */
      else
      {
         /* Return as string */
         hb_retclen( (const char *) iptr, (ULONG) sz );
      }

      /* Free memory */
      gdFree( iptr );
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            "GDIMAGE* (save functions)", 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}
gdwrp.c414
HB_FUNCGDVERSION(void)
HB_FUNC( GDVERSION )
{
#if ( GD_VERS >= 2034 )
   char szVer[ 30 ];
   snprintf( szVer, sizeof( 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
}
gdwrp.c558
HB_FUNCGDVERSIONNUMBER(void)
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
}

/* ---------------------------------------------------------------------------*/

/* ---------------------------------------------------------------------------*/
gdwrp.c571
HB_FUNCGDIMAGECREATE(void)
HB_FUNC( GDIMAGECREATE ) /* gdImagePtr gdImageCreate(sx, sy) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_NUMERIC &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC )
   {
      gdImagePtr im;
      int sx, sy;

      /* Retrieve dimensions */
      sx = hb_parni( 1 );
      sy = hb_parni( 2 );

      /* Create the image */
      im = gdImageCreate( sx, sy );

      /* Return image pointer */
      hb_retGdImage( im );
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c588
HB_FUNCGDIMAGECREATEPALETTE(void)
HB_FUNC( GDIMAGECREATEPALETTE ) /* gdImagePtr gdImageCreatePalette(sx, sy) */
{
   /* Alias of GDCreate() */
   HB_FUNC_EXEC( GDIMAGECREATE );
}
gdwrp.c621
HB_FUNCGDIMAGECREATETRUECOLOR(void)
HB_FUNC( GDIMAGECREATETRUECOLOR ) /* gdImageCreateTrueColor(sx, sy) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_NUMERIC &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC )
   {
      gdImagePtr im;
      int sx, sy;

      /* Retrieve dimensions */
      sx = hb_parni( 1 );
      sy = hb_parni( 2 );

      /* Create the image */
      im = gdImageCreateTrueColor( sx, sy );

      /* Return image pointer */
      hb_retGdImage( im );
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c630
HB_FUNCGDIMAGECREATEFROMJPEG(void)
HB_FUNC( GDIMAGECREATEFROMJPEG ) /* gdImageCreateFromJpegPtr(int size, void *data) */
                                 /* implementation: gdImagePtr gdImageCreateFromJpeg( char *szFile ) */
{
     GDImageCreateFrom( IMAGE_JPEG );
}
gdwrp.c664
HB_FUNCGDIMAGECREATEFROMGIF(void)
HB_FUNC( GDIMAGECREATEFROMGIF ) /* gdImageCreateFromGifPtr(int size, void *data) */
                                /* implementation: gdImagePtr gdImageCreateFromGif( char *szFile ) */
{
   GDImageCreateFrom( IMAGE_GIF );
}
gdwrp.c673
HB_FUNCGDIMAGECREATEFROMPNG(void)
HB_FUNC( GDIMAGECREATEFROMPNG ) /* gdImageCreateFromPngPtr(int size, void *data) */
                                /* implementation: gdImagePtr gdImageCreateFromPng( char *szFile ) */
{
   GDImageCreateFrom( IMAGE_PNG );
}
gdwrp.c682
HB_FUNCGDIMAGECREATEFROMWBMP(void)
HB_FUNC( GDIMAGECREATEFROMWBMP ) /* gdImagePtr gdImageCreateFromWBMPPtr (int size, void *data) */
                                 /* implementation: gdImagePtr gdImageCreateFromWBMP ( char *szFile ) */
{
   GDImageCreateFrom( IMAGE_WBMP );
}
gdwrp.c691
HB_FUNCGDIMAGECREATEFROMGD(void)
HB_FUNC( GDIMAGECREATEFROMGD ) /* gdImagePtr gdImageCreateFromGdPtr (int size, void *data) */
                               /* implementation: gdImagePtr gdImageCreateFromGd ( char *szFile ) */
{
   GDImageCreateFrom( IMAGE_GD );
}


gdwrp.c700
HB_FUNCGDIMAGEJPEG(void)
HB_FUNC( GDIMAGEJPEG ) /* original: void gdImageJpeg(gdImagePtr im, FILE *out) */
                       /* implementation: void gdImageJpeg(gdImagePtr im, char *szFile) */
{
   GDImageSaveTo( IMAGE_JPEG );
}
gdwrp.c711
HB_FUNCGDIMAGEGIF(void)
HB_FUNC( GDIMAGEGIF ) /* original: void gdImageGif(gdImagePtr im, FILE *out) */
                      /* implementation: void gdImageGif(gdImagePtr im, char *szFile) */
{
   GDImageSaveTo( IMAGE_GIF );
}
gdwrp.c720
HB_FUNCGDIMAGEPNG(void)
HB_FUNC( GDIMAGEPNG ) /* original: void gdImagePngEx(gdImagePtr im, FILE *out, int level) */
                      /* implementation: void gdImagePng(gdImagePtr im, char *szFile [, int level] ) */
{
   GDImageSaveTo( IMAGE_PNG );
}
gdwrp.c726
HB_FUNCGDIMAGEWBMP(void)
HB_FUNC( GDIMAGEWBMP ) /* original: void gdImageWBMP(gdImagePtr im, FILE *out) */
                       /* implementation: void gdImageWBMP(gdImagePtr im, char *szFile, int fg) */
{
   GDImageSaveTo( IMAGE_WBMP );
}
gdwrp.c734
HB_FUNCGDIMAGEGD(void)
HB_FUNC( GDIMAGEGD ) /* original: void gdImageGD(gdImagePtr im, FILE *out) */
                     /* implementation: void gdImageGD(gdImagePtr im, char *szFile) */
{
   GDImageSaveTo( IMAGE_GD );
}
gdwrp.c743
HB_FUNCGDIMAGEDESTROY(void)
HB_FUNC( GDIMAGEDESTROY ) /* gdImageDestroy(gdImagePtr im) */
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER )
   {
      /*
      gdImagePtr im;
      */

      /* Retrieve image pointer */
      /*
      im = (gdImagePtr)hb_parptr( 1 );
      */

      /* Destroy the image */
      /*
      gdImageDestroy( im );
      */

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }

}

/* ---------------------------------------------------------------------------*/

/* ---------------------------------------------------------------------------*/
gdwrp.c752
HB_FUNCGDIMAGESETPIXEL(void)
HB_FUNC( GDIMAGESETPIXEL ) /* void gdImageSetPixel(gdImagePtr im, int x, int y, int color) */
{
   if ( hb_pcount() == 4 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int x, y;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coord values */
      x = hb_parni( 2 );
      y = hb_parni( 3 );

      /* Retrieve color value */
      color = hb_parni( 4 );

      /* Draw a rectangle */
      gdImageSetPixel(im, x, y, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 4,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ) );
         return;
      }
   }
}
gdwrp.c795
HB_FUNCGDIMAGELINE(void)
HB_FUNC( GDIMAGELINE ) /* void gdImageLine(gdImagePtr im, int x1, int y1, int x2, int y2, 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 x1, y1, x2, y2;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coord values */
      x1 = hb_parni( 2 );
      y1 = hb_parni( 3 );
      x2 = hb_parni( 4 );
      y2 = hb_parni( 5 );

      /* Retrieve color value */
      color = hb_parni( 6 );

      /* Draw a rectangle */
      gdImageLine(im, x1, y1, x2, y2, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 6,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ) );
         return;
      }
   }
}
gdwrp.c836
HB_FUNCGDIMAGEDASHEDLINE(void)
HB_FUNC( GDIMAGEDASHEDLINE ) /* void gdImageDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, 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 x1, y1, x2, y2;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coord values */
      x1 = hb_parni( 2 );
      y1 = hb_parni( 3 );
      x2 = hb_parni( 4 );
      y2 = hb_parni( 5 );

      /* Retrieve color value */
      color = hb_parni( 6 );

      /* Draw a rectangle */
      gdImageDashedLine(im, x1, y1, x2, y2, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 6,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ) );
         return;
      }
   }
}
gdwrp.c882
HB_FUNCGDIMAGEPOLYGON(void)
HB_FUNC( GDIMAGEPOLYGON ) /* original: void gdImagePolygon(gdImagePtr im, gdPointPtr points, int pointsTotal, int color) */
                          /* implementation: void gdImagePolygon(gdImagePtr im, gdPointPtr points, int color) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_ARRAY   &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      /*gdPointPtr points; */
      int pointsTotal;
      int color;
      PHB_ITEM pPoints;
      int i;

      /* Max Points of polygon */
      gdPoint points[50]; /* TODO: make this dynamic */

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve point array */
      pPoints     = hb_param( 2, HB_IT_ARRAY );
      pointsTotal = hb_arrayLen( pPoints );

      for( i = 0; i < pointsTotal; i ++ )
      {
         PHB_ITEM pPoint = hb_arrayGetItemPtr( pPoints, i+1 );
         if( HB_IS_ARRAY( pPoint ) )
         {
            points[ i ].x = hb_arrayGetNI( pPoint, 1 );
            points[ i ].y = hb_arrayGetNI( pPoint, 2 );
         }
      }

      /* Retrieve color value */
      color = hb_parni( 3 );

      /* Draw a polygon */
      gdImagePolygon(im, (gdPointPtr) points, pointsTotal, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c928
HB_FUNCGDIMAGEOPENPOLYGON(void)
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_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_ARRAY   &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      /*gdPointPtr points; */
      int pointsTotal;
      int color;
      PHB_ITEM pPoints;
      int i;

      /* Max Points of polygon */
      gdPoint points[50]; /* TODO: make this dynamic */

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve point array */
      pPoints     = hb_param( 2, HB_IT_ARRAY );
      pointsTotal = hb_arrayLen( pPoints );

      for( i = 0; i < pointsTotal; i ++ )
      {
         PHB_ITEM pPoint = hb_arrayGetItemPtr( pPoints, i+1 );
         if( HB_IS_ARRAY( pPoint ) )
         {
            points[ i ].x = hb_arrayGetNI( pPoint, 1 );
            points[ i ].y = hb_arrayGetNI( pPoint, 2 );
         }
      }

      /* Retrieve color value */
      color = hb_parni( 3 );

      /* Draw a polygon */
      gdImageOpenPolygon(im, (gdPointPtr) points, pointsTotal, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c985
HB_FUNCGDIMAGERECTANGLE(void)
HB_FUNC( GDIMAGERECTANGLE ) /* void gdImageRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, 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 x1, y1, x2, y2;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coord values */
      x1 = hb_parni( 2 );
      y1 = hb_parni( 3 );
      x2 = hb_parni( 4 );
      y2 = hb_parni( 5 );

      /* Retrieve color value */
      color = hb_parni( 6 );

      /* Draw a rectangle */
      gdImageRectangle(im, x1, y1, x2, y2, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 6,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ) );
         return;
      }
   }
}
gdwrp.c1043
HB_FUNCGDIMAGEELLIPSE(void)
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 = hb_parGdImage( 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 an ellipse */
      gdImageEllipse(im, cx, cy, w, h, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ) );
         return;
      }
   }
}
gdwrp.c1090
HB_FUNCGDIMAGEFILLEDPOLYGON(void)
HB_FUNC( GDIMAGEFILLEDPOLYGON ) /* original: void gdImageFilledPolygon(gdImagePtr im, gdPointPtr points, int pointsTotal, int color) */
                                /* implementation: void gdImageFilledPolygon(gdImagePtr im, gdPointPtr points, int color) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_ARRAY   &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      /*gdPointPtr points; */
      int pointsTotal;
      int color;
      PHB_ITEM pPoints;
      int i;

      /* Max Points of polygon */
      gdPoint points[50];

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve point array */
      pPoints     = hb_param( 2, HB_IT_ARRAY );
      pointsTotal = hb_arrayLen( pPoints );

      for( i = 0; i < pointsTotal; i ++ )
      {
         PHB_ITEM pPoint = hb_arrayGetItemPtr( pPoints, i+1 );
         if( HB_IS_ARRAY( pPoint ) )
         {
            points[ i ].x = hb_arrayGetNI( pPoint, 1 );
            points[ i ].y = hb_arrayGetNI( pPoint, 2 );
         }
      }

      /* Retrieve color value */
      color = hb_parni( 3 );

      /* Draw a filled polygon */
      gdImageFilledPolygon(im, (gdPointPtr) points, pointsTotal, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c1136
HB_FUNCGDIMAGEFILLEDRECTANGLE(void)
HB_FUNC( GDIMAGEFILLEDRECTANGLE ) /* void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, 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 x1, y1, x2, y2;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coord values */
      x1 = hb_parni( 2 );
      y1 = hb_parni( 3 );
      x2 = hb_parni( 4 );
      y2 = hb_parni( 5 );

      /* Retrieve color value */
      color = hb_parni( 6 );

      /* Draw a filled rectangle */
      gdImageFilledRectangle(im, x1, y1, x2, y2, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 6,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ) );
         return;
      }
   }
}
gdwrp.c1193
HB_FUNCGDIMAGEARC(void)
HB_FUNC( GDIMAGEARC ) /* void gdImageArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color) */
{
   if ( hb_pcount() == 8 &&
        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 &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int cx, cy, w, h, s, e, color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 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 starting and ending degree values */
      s  = hb_parni( 6 );
      e  = hb_parni( 7 );
      /* Retrieve color value */
      color = hb_parni( 8 );

      /* Draw an arc */
      gdImageArc(im, cx, cy, w, h, s, e, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 8,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ) );
         return;
      }
   }
}
gdwrp.c1239
HB_FUNCGDIMAGEFILLEDARC(void)
HB_FUNC( GDIMAGEFILLEDARC ) /* void gdImageFilledArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color[, int style]) */
{
   if ( hb_pcount() >= 8 &&
        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 &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int cx, cy, w, h, s, e, color, style;

      /* Retrieve image pointer */
      im = hb_parGdImage( 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 starting and ending degree values */
      s  = hb_parni( 6 );
      e  = hb_parni( 7 );
      /* Retrieve color value */
      color = hb_parni( 8 );

      /* Retrieve style value */
      style = ( hb_parinfo( 9 ) & HB_IT_NUMERIC ? hb_parni( 9 ) : gdNoFill );

      /* Draw a filled arc */
      gdImageFilledArc(im, cx, cy, w, h, s, e, color, style);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 9,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ),
            hb_paramError( 9 ) );
         return;
      }
   }
}
gdwrp.c1289
HB_FUNCGDIMAGEFILLEDELLIPSE(void)
HB_FUNC( GDIMAGEFILLEDELLIPSE ) /* void gdImageFilledEllipse(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 = hb_parGdImage( 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 */
      gdImageFilledEllipse(im, cx, cy, w, h, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 6,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ) );
         return;
      }
   }
}
gdwrp.c1343
HB_FUNCGDIMAGEFILLTOBORDER(void)
HB_FUNC( GDIMAGEFILLTOBORDER ) /* void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color) */
{
   if ( hb_pcount() == 5 &&
        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
      )
   {
      gdImagePtr im;
      int x, y, border, color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve point values */
      x = hb_parni( 2 );
      y = hb_parni( 3 );
      /* Retrieve color to use as border */
      border = hb_parni( 4 );
      /* Retrieve color value */
      color = hb_parni( 5 );

      /* Fill image to border */
      gdImageFillToBorder(im, x, y, border, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 5,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ) );
         return;
      }
   }
}
gdwrp.c1388
HB_FUNCGDIMAGEELLIPSE(void)
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 = hb_parGdImage( 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,
            HB_ERR_FUNCNAME, 6,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ) );
         return;
      }
   }
}
gdwrp.c1431
HB_FUNCGDIMAGEFILL(void)
HB_FUNC( GDIMAGEFILL ) /* void gdImageFill(gdImagePtr im, int x, int y, int color) */
{
   if ( hb_pcount() == 4 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int x, y, color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve point values */
      x = hb_parni( 2 );
      y = hb_parni( 3 );
      /* Retrieve color value */
      color = hb_parni( 4 );

      /* Fill image */
      gdImageFill(im, x, y, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 4,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ) );
         return;
      }
   }
}
gdwrp.c1477
HB_FUNCGDIMAGESETANTIALIASED(void)
HB_FUNC( GDIMAGESETANTIALIASED ) /* void gdImageSetAntiAliased(gdImagePtr im, int color) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve color value */
      color = hb_parni( 2 );

      /* Set Antialias */
      gdImageSetAntiAliased(im, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1516
HB_FUNCGDIMAGESETANTIALIASEDDONTBLEND(void)
HB_FUNC( GDIMAGESETANTIALIASEDDONTBLEND ) /* void gdImageSetAntiAliasedDontBlend(gdImagePtr im, int c, int dont_blend) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int color;
      int dont_blend;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve color value */
      color = hb_parni( 2 );

      /* Retrieve dont_blend value */
      dont_blend = hb_parni( 3 );

      /* Set Antialias but don't blend */
      gdImageSetAntiAliasedDontBlend(im, color, dont_blend);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c1550
HB_FUNCGDIMAGESETBRUSH(void)
HB_FUNC( GDIMAGESETBRUSH ) /* void gdImageSetBrush(gdImagePtr im, gdImagePtr brush) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;
      gdImagePtr brush;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve brush pointer */
      brush = hb_parGdImage( 2 );

      /* Set Brush */
      gdImageSetBrush(im, brush);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1589
HB_FUNCGDIMAGESETTILE(void)
HB_FUNC( GDIMAGESETTILE ) /* void gdImageSetTile(gdImagePtr im, gdImagePtr tile) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;
      gdImagePtr tile;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve tile pointer */
      tile = hb_parGdImage( 2 );

      /* Set Tile */
      gdImageSetTile(im, tile);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1623
HB_FUNCGDIMAGESETSTYLE(void)
HB_FUNC( GDIMAGESETSTYLE ) /* original: void gdImageSetStyle(gdImagePtr im, int *style, int styleLength) */
                           /* implementation: void gdImageSetStyle(gdImagePtr im, int *style) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_ARRAY
      )
   {
      gdImagePtr im;
      PHB_ITEM pStyles;
      int styleLength;
      int i;

      /* Max numbery of Styles */
      int styles[50]; /* TODO: make this dynamic */

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve style array */
      pStyles     = hb_param( 2, HB_IT_ARRAY );
      styleLength = hb_arrayLen( pStyles );

      for( i = 0; i < styleLength; i ++ )
      {
         styles[ i ] = hb_arrayGetNI( pStyles, i+1 );
      }

      /* Set style */
      gdImageSetStyle(im, (int *) styles, styleLength);
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1657
HB_FUNCGDIMAGESETTHICKNESS(void)
HB_FUNC( GDIMAGESETTHICKNESS ) /* void gdImageSetThickness(gdImagePtr im, int thickness) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int thickness;
      int oldthick;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve thickness value */
      thickness = hb_parni( 2 );

      /* Previous value */
      oldthick = im->thick;

      /* Set thickness */
      gdImageSetThickness(im, thickness);

      /* Return previous */
      hb_retni( oldthick );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1702
HB_FUNCGDIMAGEALPHABLENDING(void)
HB_FUNC( GDIMAGEALPHABLENDING ) /* void gdImageAlphaBlending(gdImagePtr im, int blending) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_LOGICAL
      )
   {
      gdImagePtr im;
      int blending;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve blending value - logical */
      blending = hb_parl( 2 );

      /* Set blending */
      gdImageAlphaBlending(im, blending);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1743
HB_FUNCGDIMAGESAVEALPHA(void)
HB_FUNC( GDIMAGESAVEALPHA ) /* void gdImageSaveAlpha(gdImagePtr im, int saveFlag) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_LOGICAL
      )
   {
      gdImagePtr im;
      int saveFlag;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve saveFlag value - logical */
      saveFlag = hb_parl( 2 );

      /* Set saveFlag */
      gdImageSaveAlpha(im, saveFlag);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1777
HB_FUNCGDIMAGESETCLIP(void)
HB_FUNC( GDIMAGESETCLIP ) /* void gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2) */
{
   if ( hb_pcount() == 5 &&
        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
      )
   {
      gdImagePtr im;
      int x1, y1, x2, y2;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coords value */
      x1 = hb_parni( 2 );
      y1 = hb_parni( 3 );
      x2 = hb_parni( 4 );
      y2 = hb_parni( 5 );

      /* Set clipping rectangle */
      gdImageSetClip(im, x1, y1, x2, y2);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 5,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ) );
         return;
      }
   }
}
gdwrp.c1811
HB_FUNCGDIMAGEGETCLIP(void)
HB_FUNC( GDIMAGEGETCLIP ) /* original: void gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) */
                          /* implementation: array gdImageGetClip(gdImagePtr im) */
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;
      int x1, y1, x2, y2;
      PHB_ITEM pClipArray;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Get clipping rectangle */
      gdImageGetClip(im, &x1, &y1, &x2, &y2);

      /* Return clipping rectangle value in an array */
      pClipArray = hb_itemArrayNew( 4 );
      hb_itemPutNI( hb_arrayGetItemPtr( pClipArray, 1 ), x1 );
      hb_itemPutNI( hb_arrayGetItemPtr( pClipArray, 2 ), y1 );
      hb_itemPutNI( hb_arrayGetItemPtr( pClipArray, 3 ), x2 );
      hb_itemPutNI( hb_arrayGetItemPtr( pClipArray, 4 ), y2 );

      /* return array */
      hb_itemRelease( hb_itemReturnForward( pClipArray ) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}

/* ---------------------------------------------------------------------------*/

/* ---------------------------------------------------------------------------*/
gdwrp.c1852
HB_FUNCGDIMAGECOLORSTOTAL(void)
HB_FUNC( GDIMAGECOLORSTOTAL ) /* int gdImageColorsTotal(gdImagePtr im) */
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Get Colors total */
      hb_retni( gdImageColorsTotal(im) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}
gdwrp.c1899
HB_FUNCGDIMAGEALPHA(void)
HB_FUNC( GDIMAGEALPHA ) /* int gdImageAlpha(gdImagePtr im, int color) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve saveFlag value */
      color = hb_parni( 2 );

      /* Get Alpha Level */
      hb_retni( gdImageAlpha(im, color) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1928
HB_FUNCGDIMAGERED(void)
HB_FUNC( GDIMAGERED ) /* int gdImageRed(gdImagePtr im, int color) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve saveFlag value */
      color = hb_parni( 2 );

      /* Get Red Level */
      hb_retni( gdImageRed(im, color) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1962
HB_FUNCGDIMAGEGREEN(void)
HB_FUNC( GDIMAGEGREEN ) /* int gdImageGreen(gdImagePtr im, int color) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve saveFlag value */
      color = hb_parni( 2 );

      /* Get Green Level */
      hb_retni( gdImageGreen(im, color) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c1996
HB_FUNCGDIMAGEBLUE(void)
HB_FUNC( GDIMAGEBLUE ) /* int gdImageBlue(gdImagePtr im, int color) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve saveFlag value */
      color = hb_parni( 2 );

      /* Get Blue Level */
      hb_retni( gdImageBlue(im, color) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c2030
HB_FUNCGDIMAGESX(void)
HB_FUNC( GDIMAGESX ) /* int gdImageSX(gdImagePtr im) */
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Get Image Width in pixels */
      hb_retni( gdImageSX(im) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}
gdwrp.c2064
HB_FUNCGDIMAGESY(void)
HB_FUNC( GDIMAGESY ) /* int gdImageSX(gdImagePtr im) */
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Get Image Height in pixels */
      hb_retni( gdImageSY(im) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}
gdwrp.c2093
HB_FUNCGDIMAGEGETPIXEL(void)
HB_FUNC( GDIMAGEGETPIXEL ) /* int gdImageGetPixel(gdImagePtr im, int x, int y) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int x,y;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coord value */
      x = hb_parni( 2 );
      y = hb_parni( 3 );

      /* Get Color of a pixel */
      hb_retni( gdImageGetPixel(im, x, y) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c2122
HB_FUNCGDIMAGEBOUNDSSAFE(void)
HB_FUNC( GDIMAGEBOUNDSSAFE ) /* int gdImageBoundsSafe(gdImagePtr im, int x, int y) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int x,y;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coord value */
      x = hb_parni( 2 );
      y = hb_parni( 3 );

      /* Get if pixel in Clipping region */
      hb_retl( gdImageBoundsSafe(im, x, y) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c2158
HB_FUNCGDIMAGEGETINTERLACED(void)
HB_FUNC( GDIMAGEGETINTERLACED ) /* int gdImageGetInterlaced(gdImagePtr im) */
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Image is interlaced ? */
      hb_retl( gdImageGetInterlaced(im) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ) );
         return;
      }
   }
}
gdwrp.c2194
HB_FUNCGDIMAGEGETTRANSPARENT(void)
HB_FUNC( GDIMAGEGETTRANSPARENT ) /* int gdImageGetTransparent(gdImagePtr im) */
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Image is trasparent ? */
      hb_retl( gdImageGetTransparent(im) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}
gdwrp.c2223
HB_FUNCGDIMAGETRUECOLOR(void)
HB_FUNC( GDIMAGETRUECOLOR ) /* int gdImageTrueColor(gdImagePtr im) */
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Is TrueColor ? */
      hb_retl( gdImageTrueColor(im) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}
gdwrp.c2252
HB_FUNCGDIMAGETRUECOLORTOPALETTE(void)
HB_FUNC( GDIMAGETRUECOLORTOPALETTE ) /* void gdImageTrueColorToPalette (gdImagePtr im, int ditherFlag, int colorsWanted) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_LOGICAL &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int ditherFlag, colorsWanted;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve ditherFlag - logical */
      ditherFlag = hb_parl( 2 );

      /* Retrieve number of color wanted */
      colorsWanted = hb_parni( 3 );

      /* Converts a truecolor image to a palette-based image */
      gdImageTrueColorToPalette(im, ditherFlag, colorsWanted);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c2281
HB_FUNCGDIMAGECREATEPALETTEFROMTRUECOLOR(void)
HB_FUNC( GDIMAGECREATEPALETTEFROMTRUECOLOR ) /* gdImagePtr gdImageCreatePaletteFromTrueColor(gdImagePtr im, int ditherFlag, int colorsWanted) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_LOGICAL &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      gdImagePtr imNew;
      int ditherFlag, colorsWanted;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve ditherFlag - logical */
      ditherFlag = hb_parl( 2 );

      /* Retrieve number of color wanted */
      colorsWanted = hb_parni( 3 );

      /* Converts a truecolor image to a palette-based image and return the image */
      imNew = gdImageCreatePaletteFromTrueColor(im, ditherFlag, colorsWanted);

      /* Return image pointer */
      hb_retGdImage( imNew );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c2319
HB_FUNCGDIMAGEPALETTEPIXEL(void)
HB_FUNC( GDIMAGEPALETTEPIXEL ) /* int gdImagePalettePixel(gdImagePtr im, int x, int y) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int x,y;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coord value */
      x = hb_parni( 2 );
      y = hb_parni( 3 );

      /* Get Color of a pixel */
      hb_retni( gdImagePalettePixel(im, x, y) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c2361
HB_FUNCGDIMAGETRUECOLORPIXEL(void)
HB_FUNC( GDIMAGETRUECOLORPIXEL ) /* int gdImageTrueColorPixel(gdImagePtr im, int x, int y) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int x,y;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve coord value */
      x = hb_parni( 2 );
      y = hb_parni( 3 );

      /* Get Color of a pixel */
      hb_retni( gdImageTrueColorPixel(im, x, y) );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c2397
HB_FUNCGDIMAGEGETTHICKNESS(void)
HB_FUNC( GDIMAGEGETTHICKNESS ) /* void gdImageGetThickness(gdImagePtr im) */
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdImagePtr im;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Return previous */
      hb_retni( im->thick );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}

/* ---------------------------------------------------------------------------*/

/* ---------------------------------------------------------------------------*/
gdwrp.c2433
HB_FUNCGDFONTGETSMALL(void)
HB_FUNC( GDFONTGETSMALL ) /* gdFontPtr gdFontGetSmall(void) */
{
   gdFontPtr font;

   /* Get font pointer */
   font = gdFontGetSmall();

   /* Return font pointer */
   hb_retGdFont( font );
   /*hb_retptr( font ); */
}
gdwrp.c2466
HB_FUNCGDFONTGETLARGE(void)
HB_FUNC( GDFONTGETLARGE ) /* gdFontPtr gdFontGetLarge(void) */
{
   gdFontPtr font;

   /* Get font pointer */
   font = gdFontGetLarge();

   /* Return font pointer */
   hb_retGdFont( font );
   /*hb_retptr( font ); */
}
gdwrp.c2480
HB_FUNCGDFONTGETMEDIUMBOLD(void)
HB_FUNC( GDFONTGETMEDIUMBOLD ) /* gdFontPtr gdFontGetMediumBold(void) */
{
   gdFontPtr font;

   /* Get font pointer */
   font = gdFontGetMediumBold();

   /* Return font pointer */
   hb_retGdFont( font );
   /*hb_retptr( font ); */
}
gdwrp.c2494
HB_FUNCGDFONTGETGIANT(void)
HB_FUNC( GDFONTGETGIANT ) /* gdFontPtr gdFontGetGiant(void) */
{
   gdFontPtr font;

   /* Get font pointer */
   font = gdFontGetGiant();

   /* Return font pointer */
   hb_retGdFont( font );
   /*hb_retptr( font ); */
}
gdwrp.c2508
HB_FUNCGDFONTGETTINY(void)
HB_FUNC( GDFONTGETTINY ) /* gdFontPtr gdFontGetTiny(void) */
{
   gdFontPtr font;

   /* Get font pointer */
   font = gdFontGetTiny();

   /* Return font pointer */
   hb_retGdFont( font );
   /*hb_retptr( font ); */
}
gdwrp.c2522
HB_FUNCGDIMAGESTRING(void)
HB_FUNC( GDIMAGESTRING ) /* void gdImageChar(gdImagePtr im, gdFontPtr font, int x, int y, int c, int color) */
                         /* void gdImageString(gdImagePtr im, gdFontPtr font, int x, int y, unsigned char *s, int color) */
{
   if ( hb_pcount() == 6 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC &&
        hb_parinfo( 5 ) & HB_IT_STRING  &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      gdFontPtr  font;
      int x, y, c, color;
      unsigned char *s;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve font pointer */
      font = hb_parGdFont( 2 );

      /* Retrieve coord value */
      x = hb_parni( 3 );
      y = hb_parni( 4 );

      /* Retrieve color value */
      color = hb_parni( 6 );

      /* Write char */
      if ( hb_parclen(5) == 1 )
      {
         /* Retrieve char value */
         c = hb_parni( 5 );
         gdImageChar(im, font, x, y, c, color);
      }
      else
      {
         /* Retrieve string value */
         s = ( unsigned char * )hb_parcx( 5 );
         gdImageString(im, font, x, y, s, color);
      }

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 6,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ) );
         return;
      }
   }
}
gdwrp.c2536
HB_FUNCGDIMAGESTRINGUP(void)
HB_FUNC( GDIMAGESTRINGUP ) /* void gdImageCharUp(gdImagePtr im, gdFontPtr font, int x, int y, int c, int color) */
                           /* void gdImageStringUp(gdImagePtr im, gdFontPtr font, int x, int y, unsigned char *s, int color) */
{
   if ( hb_pcount() == 6 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC &&
        hb_parinfo( 5 ) & HB_IT_STRING  &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      gdFontPtr  font;
      int x, y, c, color;
      unsigned char *s;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve font pointer */
      font = hb_parGdFont( 2 );

      /* Retrieve coord value */
      x = hb_parni( 3 );
      y = hb_parni( 4 );

      /* Retrieve color value */
      color = hb_parni( 6 );

      /* Write char */
      if ( hb_parclen(5) == 1 )
      {
         /* Retrieve char value */
         c = hb_parni( 5 );
         gdImageCharUp(im, font, x, y, c, color);
      }
      else
      {
         /* Retrieve string value */
         s = ( unsigned char * )hb_parcx( 5 );
         gdImageStringUp(im, font, x, y, s, color);
      }

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 6,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ) );
         return;
      }
   }
}
gdwrp.c2596
HB_FUNCGDIMAGESTRINGFTEX(void)
/* implementation: cError := gdImageStringFTEx( im, aRect, int fg, cFontname, nPtSize, nAngle, x, y, cString, nLinespacing, nCharmap, nResolution ) */
HB_FUNC( GDIMAGESTRINGFTEX )
{
   /* TraceLog( NULL, "Parameters: %i, Type 1 =%i=\n\r", hb_pcount(), hb_parinfo( 1 ) ); */

   if ( hb_pcount() >= 9 &&
        ( ISNIL(1) || hb_parinfo( 1 ) & ( HB_IT_POINTER ) ) &&
        hb_parinfo( 2 ) & HB_IT_ARRAY   &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_STRING  &&
        hb_parinfo( 5 ) & HB_IT_NUMERIC &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC &&
        hb_parinfo( 9 ) & HB_IT_STRING
      )
   {
      gdImagePtr im;
      gdFTStringExtra extra;
      int fg;
      char *fontname;
      double ptsize, angle;
      int x, y, i;
      char *string;
      PHB_ITEM pRect;
      int aRect[8];
      char *err;
      int flags;
      double linespacing;
      int charmap;
      int resolution;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );
      /*TraceLog( NULL, "Image pointer: %p\n\r", im ); */

      /* Retrieve rectangle array */
      pRect = hb_param( 2, HB_IT_ARRAY );
      for( i = 0; i < 8; i ++ )
      {
         aRect[ i ] = hb_arrayGetNI( pRect, i+1 );
      }

      /* Retrieve foreground color value */
      fg = hb_parni( 3 );
      /*TraceLog( NULL, "Forecolor: %i\n\r", fg ); */

      /* Retrieve fontname value */
      fontname = hb_parc( 4 );
      /*TraceLog( NULL, "Font: %s\n\r", fontname ); */

      /* Retrieve point size value */
      ptsize = hb_parni( 5 );
      /*TraceLog( NULL, "PTSize: %lf\n\r", ptsize ); */

      /* Retrieve angle value in radians */
      angle = hb_parnd( 6 );
      /*TraceLog( NULL, "Angle: %lf\n\r", angle ); */

      /* Retrieve pos value */
      x = hb_parni( 7 );
      y = hb_parni( 8 );
      /*TraceLog( NULL, "Pos: %i, %i\n\r", x, y ); */

      /* Retrieve string value */
      string = hb_parcx( 9 );
      /*TraceLog( NULL, "String: %s\n\r", string ); */

      /* EXTENDED FLAGS */
      flags       = 0;

      /* defaults */
      linespacing = 1.05;
      charmap     = gdFTEX_Unicode;
      resolution  = 96;

      /* Retrieve line spacing */
      if ( hb_parinfo( 10 ) & HB_IT_DOUBLE )
      {
         linespacing = hb_parnd( 10 );
         flags |= gdFTEX_LINESPACE;
      }

      /* Retrieve charmap */
      if ( hb_parinfo( 11 ) & HB_IT_NUMERIC )
      {
         charmap = hb_parni( 11 );
         flags |= gdFTEX_CHARMAP;
      }

      /* Retrieve resolution */
      if ( hb_parinfo( 12 ) & HB_IT_NUMERIC )
      {
         resolution = hb_parni( 12 );
         flags |= gdFTEX_RESOLUTION;
      }

      if ( !( flags == 0 ) )
      {
         extra.flags       = flags;
         extra.linespacing = ( flags & gdFTEX_LINESPACE  ? linespacing : 1.05 );
         extra.charmap     = ( flags & gdFTEX_CHARMAP    ? charmap : gdFTEX_Unicode );
         extra.hdpi        = ( flags & gdFTEX_RESOLUTION ? resolution : 96 );
         extra.vdpi        = ( flags & gdFTEX_RESOLUTION ? resolution : 96 );
      }

      /* Write string */
      err = gdImageStringFTEx(im, &aRect[0], fg, fontname, ptsize, angle, x, y, string, ( !( flags == 0 ) ? &extra : 0 ));
      if ( !( err ) )
      {
         /* Save in array the correct text rectangle dimensions */
         PHB_ITEM pArray;
         pArray = hb_itemArrayNew( 8 );
         for( i = 0; i < 8; i ++ )
         {
            hb_itemPutNI( hb_arrayGetItemPtr( pArray, i+1 ), aRect[i] );
         }
         hb_itemCopy( pRect, pArray );
         hb_itemRelease( pArray );
      }
      hb_retc( err );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 12,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ),
            hb_paramError( 9 ), hb_paramError( 10 ), hb_paramError( 11 ), hb_paramError( 12 ) );
         return;
      }
   }
}
gdwrp.c2654
HB_FUNCGDIMAGESTRINGFTCIRCLE(void)
HB_FUNC( GDIMAGESTRINGFTCIRCLE ) /* char *gdImageStringFTCircle(gdImagePtr im, int cx, int cy, double radius, double textRadius, double fillPortion, char *font, double points, char *top, char *bottom, int fgcolor) */
{
   /*TraceLog( NULL, "Parameters: %i, Type 9 =%i=\n\r", hb_pcount(), hb_parinfo( 10 ) ); */

   if ( hb_pcount() == 11 &&
        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 &&
        hb_parinfo( 7 ) & HB_IT_STRING  &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC &&
        ( ISNIL( 9 ) || ( hb_parinfo( 9 ) & HB_IT_STRING ) ) &&
        ( ISNIL( 10 ) || ( hb_parinfo( 10 ) & HB_IT_STRING ) ) &&
        hb_parinfo( 11 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int cx, cy;
      double radius, textRadius, fillPortion, points;
      char *top;
      char *bottom;
      int fgcolor;
      char *font;
      char *err;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve pos value */
      cx = hb_parni( 2 );
      cy = hb_parni( 3 );

      /* Retrieve radius value */
      radius = hb_parnd( 4 );

      /* Retrieve textRadius value */
      textRadius = hb_parnd( 5 );

      /* Retrieve textRadius value */
      fillPortion = hb_parnd( 6 );

      /* Retrieve fontname value */
      font = hb_parcx( 7 );

      /* Retrieve points value */
      points = hb_parnd( 8 );

      /* Retrieve top string value */
      top = hb_parcx( 9 );

      /* Retrieve top string value */
      bottom = hb_parcx( 10 );

      /* Retrieve foreground color value */
      fgcolor = hb_parni( 11 );

      /* Write string */
      err = gdImageStringFTCircle(im, cx, cy, radius, textRadius, fillPortion, font, points, top, bottom, fgcolor);
      hb_retc( err );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 11,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ),
            hb_paramError( 9 ), hb_paramError( 10 ), hb_paramError( 11 ) );
         return;
      }
   }
}
gdwrp.c2795
HB_FUNCGDFONTCACHESETUP(void)
HB_FUNC( GDFONTCACHESETUP ) /* int gdFontCacheSetup (void) */
{
   /* This function initializes the font cache for freetype text output functions */
   hb_retl( gdFontCacheSetup() );
}
gdwrp.c2874
HB_FUNCGDFONTCACHESHUTDOWN(void)
HB_FUNC( GDFONTCACHESHUTDOWN ) /* void gdFontCacheShutdown (void) */
{
   /* This function initializes the font cache for freetype text output functions */
   gdFontCacheShutdown();
}
gdwrp.c2882
HB_FUNCGDFONTGETWIDTH(void)
HB_FUNC( GDFONTGETWIDTH )
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdFontPtr font;

      /* Retrieve font pointer */
      font = hb_parGdFont( 1 );

      /* Return value */
      hb_retni( font->w );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}
gdwrp.c2890
HB_FUNCGDFONTGETHEIGHT(void)
HB_FUNC( GDFONTGETHEIGHT )
{
   if ( hb_pcount() == 1 &&
        hb_parinfo( 1 ) & HB_IT_POINTER
      )
   {
      gdFontPtr font;

      /* Retrieve font pointer */
      font = hb_parGdFont( 1 );

      /* Return value */
      hb_retni( font->h );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 ) );
         return;
      }
   }
}

/* ---------------------------------------------------------------------------*/

/* ---------------------------------------------------------------------------*/
gdwrp.c2919
HB_FUNCGDIMAGECOLORALLOCATE(void)
HB_FUNC( GDIMAGECOLORALLOCATE ) /* int gdImageColorAllocate(gdImagePtr im, int r, int g, int b) */
{
   if ( hb_pcount() == 4 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int r, g, b;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve RGB values */
      r = hb_parni( 2 );
      g = hb_parni( 3 );
      b = hb_parni( 4 );

      /* Allocate color */
      color = gdImageColorAllocate(im, r, g, b);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 4,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ) );
         return;
      }
   }
}
gdwrp.c2952
HB_FUNCGDIMAGECOLORDEALLOCATE(void)
HB_FUNC( GDIMAGECOLORDEALLOCATE ) /* void gdImageColorDeallocate(gdImagePtr im, int color) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve saveFlag value */
      color = hb_parni( 2 );

      /* Deallocate color */
      gdImageColorDeallocate(im, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c2994
HB_FUNCGDIMAGECOLORALLOCATEALPHA(void)
HB_FUNC( GDIMAGECOLORALLOCATEALPHA ) /* int gdImageColorAllocateAlpha(gdImagePtr im, int r, int g, int b, int a) */
{
   if ( hb_pcount() == 5 &&
        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
      )
   {
      gdImagePtr im;
      int r, g, b;
      int color;
      int a;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve RGB values */
      r = hb_parni( 2 );
      g = hb_parni( 3 );
      b = hb_parni( 4 );

      /* Retrieve Alpha value */
      a = hb_parni( 5 );

      /* Allocate color */
      color = gdImageColorAllocateAlpha(im, r, g, b, a);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 5,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ) );
         return;
      }
   }
}
gdwrp.c3028
HB_FUNCGDIMAGECOLORCLOSEST(void)
HB_FUNC( GDIMAGECOLORCLOSEST ) /* int gdImageColorClosest(gdImagePtr im, int r, int g, int b) */
{
   if ( hb_pcount() == 4 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int r, g, b;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve RGB values */
      r = hb_parni( 2 );
      g = hb_parni( 3 );
      b = hb_parni( 4 );

      /* Search color closest */
      color = gdImageColorClosest(im, r, g, b);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 4,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ) );
         return;
      }
   }
}
gdwrp.c3076
HB_FUNCGDIMAGECOLORCLOSESTALPHA(void)
HB_FUNC( GDIMAGECOLORCLOSESTALPHA ) /* int gdImageColorClosestAlpha(gdImagePtr im, int r, int g, int b, int a) */
{
   if ( hb_pcount() == 5 &&
        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
      )
   {
      gdImagePtr im;
      int r, g, b;
      int color;
      int a;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve RGB values */
      r = hb_parni( 2 );
      g = hb_parni( 3 );
      b = hb_parni( 4 );

      /* Retrieve Alpha value */
      a = hb_parni( 5 );

      /* Allocate color */
      color = gdImageColorClosestAlpha(im, r, g, b, a);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 5,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ) );
         return;
      }
   }
}
gdwrp.c3118
HB_FUNCGDIMAGECOLORCLOSESTHWB(void)
HB_FUNC( GDIMAGECOLORCLOSESTHWB ) /*  gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b) */
{
   if ( hb_pcount() == 4 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int r, g, b;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve RGB values */
      r = hb_parni( 2 );
      g = hb_parni( 3 );
      b = hb_parni( 4 );

      /* Search color closest */
      color = gdImageColorClosestHWB(im, r, g, b);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 4,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ) );
         return;
      }
   }
}
gdwrp.c3166
HB_FUNCGDIMAGECOLOREXACT(void)
HB_FUNC( GDIMAGECOLOREXACT ) /* int gdImageColorExact(gdImagePtr im, int r, int g, int b) */
{
   if ( hb_pcount() == 4 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int r, g, b;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve RGB values */
      r = hb_parni( 2 );
      g = hb_parni( 3 );
      b = hb_parni( 4 );

      /* Search if there is the color */
      color = gdImageColorExact(im, r, g, b);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 4,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ) );
         return;
      }
   }
}
gdwrp.c3208
HB_FUNCGDIMAGECOLORRESOLVE(void)
HB_FUNC( GDIMAGECOLORRESOLVE ) /* int gdImageColorResolve(gdImagePtr im, int r, int g, int b) */
{
   if ( hb_pcount() == 4 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int r, g, b;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve RGB values */
      r = hb_parni( 2 );
      g = hb_parni( 3 );
      b = hb_parni( 4 );

      /* Search if there is the color or similar, if not it creates */
      color = gdImageColorResolve(im, r, g, b);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 4,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ) );
         return;
      }
   }
}
gdwrp.c3250
HB_FUNCGDIMAGECOLORRESOLVEALPHA(void)
HB_FUNC( GDIMAGECOLORRESOLVEALPHA ) /* int gdImageColorResolveAlpha(gdImagePtr im, int r, int g, int b, int a) */
{
   if ( hb_pcount() == 5 &&
        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
      )
   {
      gdImagePtr im;
      int r, g, b;
      int color;
      int a;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve RGB values */
      r = hb_parni( 2 );
      g = hb_parni( 3 );
      b = hb_parni( 4 );

      /* Retrieve Alpha value */
      a = hb_parni( 5 );

      /* Allocate color */
      color = gdImageColorResolveAlpha(im, r, g, b, a);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 5,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ) );
         return;
      }
   }
}
gdwrp.c3292
HB_FUNCGDIMAGECOLORTRANSPARENT(void)
HB_FUNC( GDIMAGECOLORTRANSPARENT ) /* void gdImageColorTransparent(gdImagePtr im, int color) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int color;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve saveFlag value */
      color = hb_parni( 2 );

      /* Set transparent color (to define no transparent color set -1) */
      gdImageColorTransparent(im, color);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c3340
HB_FUNCGDTRUECOLOR(void)
HB_FUNC( GDTRUECOLOR ) /* int gdTrueColor(int red, int green, int blue) */
{
   if ( hb_pcount() == 3 &&
        hb_parinfo( 1 ) & HB_IT_NUMERIC &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC
      )
   {
      int r, g, b;
      int color;

      /* Retrieve RGB values */
      r = hb_parni( 1 );
      g = hb_parni( 2 );
      b = hb_parni( 3 );

      /* Allocate color */
      color = gdTrueColor(r, g, b);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c3374
HB_FUNCGDTRUECOLORALPHA(void)
HB_FUNC( GDTRUECOLORALPHA ) /* int gdTrueColorAlpha(int red, int green, int blue, int alpha) */
{
   if ( hb_pcount() == 4 &&
        hb_parinfo( 1 ) & HB_IT_NUMERIC &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC
      )
   {
      int r, g, b, a;
      int color;

      /* Retrieve RGB values */
      r = hb_parni( 1 );
      g = hb_parni( 2 );
      b = hb_parni( 3 );
      a = hb_parni( 4 );

      /* Allocate color */
      color = gdTrueColorAlpha(r, g, b, a);

      /* return color */
      hb_retni( color );

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 4,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ) );
         return;
      }
   }
}

/* ---------------------------------------------------------------------------*/

/* ---------------------------------------------------------------------------*/
gdwrp.c3411
HB_FUNCGDIMAGECOPY(void)
HB_FUNC( GDIMAGECOPY ) /* void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h) */
{
   if ( hb_pcount() == 8 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC &&
        hb_parinfo( 5 ) & HB_IT_NUMERIC &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr dst, src;
      int dstX, dstY, srcX, srcY, w, h;

      /* Retrieve destination image pointer */
      dst = hb_parGdImage( 1 );

      /* Retrieve source image pointer */
      src = hb_parGdImage( 2 );

      /* Retrieve destination pos value */
      dstX = hb_parni( 3 );
      dstY = hb_parni( 4 );

      /* Retrieve source pos value */
      srcX = hb_parni( 5 );
      srcY = hb_parni( 6 );

      /* Retrieve width value */
      w = hb_parni( 7 );

      /* Retrieve height value */
      h = hb_parni( 8 );

      /* Perform copy */
      gdImageCopy(dst, src, dstX, dstY, srcX, srcY, w, h);
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 8,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ) );
         return;
      }
   }
}
gdwrp.c3454
HB_FUNCGDIMAGECOPYRESIZED(void)
HB_FUNC( GDIMAGECOPYRESIZED ) /* void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH) */
{
   if ( hb_pcount() == 10 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC &&
        hb_parinfo( 5 ) & HB_IT_NUMERIC &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC &&
        hb_parinfo( 9 ) & HB_IT_NUMERIC &&
        hb_parinfo( 10 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr dst, src;
      int dstX, dstY, srcX, srcY;
      int dstW, dstH, srcW, srcH;

      /* Retrieve destination image pointer */
      dst = hb_parGdImage( 1 );

      /* Retrieve source image pointer */
      src = hb_parGdImage( 2 );

      /* Retrieve destination pos value */
      dstX = hb_parni( 3 );
      dstY = hb_parni( 4 );

      /* Retrieve source pos value */
      srcX = hb_parni( 5 );
      srcY = hb_parni( 6 );

      /* Retrieve dest width value */
      dstW = hb_parni( 7 );

      /* Retrieve dest height value */
      dstH = hb_parni( 8 );

      /* Retrieve source width value */
      srcW = hb_parni( 9 );

      /* Retrieve source height value */
      srcH = hb_parni( 10 );

      /* Perform copy */
      gdImageCopyResized(dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 10,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ),
            hb_paramError( 9 ), hb_paramError( 10 ) );
         return;
      }
   }
}
gdwrp.c3508
HB_FUNCGDIMAGECOPYRESAMPLED(void)
HB_FUNC( GDIMAGECOPYRESAMPLED ) /* void gdImageCopyResampled(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH) */
{
   if ( hb_pcount() == 10 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC &&
        hb_parinfo( 5 ) & HB_IT_NUMERIC &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC &&
        hb_parinfo( 9 ) & HB_IT_NUMERIC &&
        hb_parinfo( 10 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr dst, src;
      int dstX, dstY, srcX, srcY;
      int dstW, dstH, srcW, srcH;

      /* Retrieve destination image pointer */
      dst = hb_parGdImage( 1 );

      /* Retrieve source image pointer */
      src = hb_parGdImage( 2 );

      /* Retrieve destination pos value */
      dstX = hb_parni( 3 );
      dstY = hb_parni( 4 );

      /* Retrieve source pos value */
      srcX = hb_parni( 5 );
      srcY = hb_parni( 6 );

      /* Retrieve dest width value */
      dstW = hb_parni( 7 );

      /* Retrieve dest height value */
      dstH = hb_parni( 8 );

      /* Retrieve source width value */
      srcW = hb_parni( 9 );

      /* Retrieve source height value */
      srcH = hb_parni( 10 );

      /* Perform copy */
      gdImageCopyResampled(dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 10,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ),
            hb_paramError( 9 ), hb_paramError( 10 ) );
         return;
      }
   }
}
gdwrp.c3572
HB_FUNCGDIMAGECOPYROTATED(void)
HB_FUNC( GDIMAGECOPYROTATED ) /* void gdImageCopyRotated(gdImagePtr dst, gdImagePtr src, double dstX, double dstY, int srcX, int srcY, int srcW, int srcH, int angle) */
{
   if ( hb_pcount() == 9 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC &&
        hb_parinfo( 5 ) & HB_IT_NUMERIC &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC &&
        hb_parinfo( 9 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr dst, src;
      double dstX, dstY;
      int srcX, srcY, srcW, srcH, angle;

      /* Retrieve destination image pointer */
      dst = hb_parGdImage( 1 );

      /* Retrieve source image pointer */
      src = hb_parGdImage( 2 );

      /* Retrieve destination pos value */
      dstX = hb_parnd( 3 );
      dstY = hb_parnd( 4 );

      /* Retrieve source pos value */
      srcX = hb_parni( 5 );
      srcY = hb_parni( 6 );

      /* Retrieve source width value */
      srcW = hb_parni( 7 );

      /* Retrieve source height value */
      srcH = hb_parni( 8 );

      /* Retrieve angle value */
      angle = hb_parni( 9 );

      /* Perform rotation */
      gdImageCopyRotated(dst, src, dstX, dstY, srcX, srcY, srcW, srcH, angle);
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 9,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ),
            hb_paramError( 9 ) );
         return;
      }
   }
}
gdwrp.c3636
HB_FUNCGDIMAGECOPYMERGE(void)
HB_FUNC( GDIMAGECOPYMERGE ) /* void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct) */
{
   if ( hb_pcount() == 9 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC &&
        hb_parinfo( 5 ) & HB_IT_NUMERIC &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC &&
        hb_parinfo( 9 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr dst, src;
      int dstX, dstY, srcX, srcY, w, h, pct;

      /* Retrieve destination image pointer */
      dst =hb_parGdImage( 1 );

      /* Retrieve source image pointer */
      src = hb_parGdImage( 2 );

      /* Retrieve destination pos value */
      dstX = hb_parni( 3 );
      dstY = hb_parni( 4 );

      /* Retrieve source pos value */
      srcX = hb_parni( 5 );
      srcY = hb_parni( 6 );

      /* Retrieve width value */
      w = hb_parni( 7 );

      /* Retrieve height value */
      h = hb_parni( 8 );

      /* Retrieve percentual value */
      pct = hb_parni( 9 );

      /* Perform copy */
      gdImageCopyMerge(dst, src, dstX, dstY, srcX, srcY, w, h, pct);
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 9,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ),
            hb_paramError( 9 ) );
         return;
      }
   }
}
gdwrp.c3696
HB_FUNCGDIMAGECOPYMERGEGRAY(void)
HB_FUNC( GDIMAGECOPYMERGEGRAY ) /* void gdImageCopyMergeGray(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct) */
{
   if ( hb_pcount() == 9 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC &&
        hb_parinfo( 5 ) & HB_IT_NUMERIC &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        hb_parinfo( 8 ) & HB_IT_NUMERIC &&
        hb_parinfo( 9 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr dst, src;
      int dstX, dstY, srcX, srcY, w, h, pct;

      /* Retrieve destination image pointer */
      dst = hb_parGdImage( 1 );

      /* Retrieve source image pointer */
      src = hb_parGdImage( 2 );

      /* Retrieve destination pos value */
      dstX = hb_parni( 3 );
      dstY = hb_parni( 4 );

      /* Retrieve source pos value */
      srcX = hb_parni( 5 );
      srcY = hb_parni( 6 );

      /* Retrieve width value */
      w = hb_parni( 7 );

      /* Retrieve height value */
      h = hb_parni( 8 );

      /* Retrieve percentual value */
      pct = hb_parni( 9 );

      /* Perform copy */
      gdImageCopyMergeGray(dst, src, dstX, dstY, srcX, srcY, w, h, pct);
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 9,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 ),
            hb_paramError( 9 ) );
         return;
      }
   }
}
gdwrp.c3755
HB_FUNCGDIMAGEPALETTECOPY(void)
HB_FUNC( GDIMAGEPALETTECOPY ) /* void gdImagePaletteCopy(gdImagePtr dst, gdImagePtr src) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER
      )
   {
      gdImagePtr dst, src;

      /* Retrieve destination image pointer */
      dst = hb_parGdImage( 1 );

      /* Retrieve source image pointer */
      src = hb_parGdImage( 2 );

      /* Perform copy */
      gdImagePaletteCopy(dst, src);
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c3814
HB_FUNCGDIMAGESQUARETOCIRCLE(void)
HB_FUNC( GDIMAGESQUARETOCIRCLE ) /* void gdImageSquareToCircle(gdImagePtr im, int radius) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int radius;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve radius value */
      radius = hb_parni( 2 );

      /* TODO */
      gdImageSquareToCircle(im, radius);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c3846
HB_FUNCGDIMAGESHARPEN(void)
HB_FUNC( GDIMAGESHARPEN ) /* void gdImageSharpen(gdImagePtr im, int pct) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      int pct;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve percentual value */
      pct = hb_parni( 2 );

      /* Sharpens the specified image */
      gdImageSharpen(im, pct);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}

/* ---------------------------------------------------------------------------*/

/* ---------------------------------------------------------------------------*/
gdwrp.c3880
HB_FUNCGDIMAGECOMPARE(void)
HB_FUNC( GDIMAGECOMPARE ) /* int gdImageCompare(gdImagePtr im1, gdImagePtr im2) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_POINTER
      )
   {
      gdImagePtr dst, src;

      /* Retrieve destination image pointer */
      dst = hb_parGdImage( 1 );

      /* Retrieve source image pointer */
      src = hb_parGdImage( 2 );

      /* Compare images - if return <> 0 check value for infos */
      hb_retni( gdImageCompare(dst, src) );
   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c3918
HB_FUNCGDIMAGEINTERLACE(void)
HB_FUNC( GDIMAGEINTERLACE ) /* void gdImageInterlace(gdImagePtr im, int interlace) */
{
   if ( hb_pcount() == 2 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        hb_parinfo( 2 ) & HB_IT_LOGICAL
      )
   {
      gdImagePtr im;
      int interlace;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve interlace value */
      interlace = hb_parl( 2 );

      /* Set interlace */
      gdImageInterlace(im, interlace);

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 2,
            hb_paramError( 1 ), hb_paramError( 2 ) );
         return;
      }
   }
}
gdwrp.c3950
STATIC VOIDAddImageToFile( char *szFile, void *iptr, int sz )
static void AddImageToFile( char *szFile, void *iptr, int sz )
{
   HB_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 );
   }
}
gdwrp.c3986
HB_FUNCGDIMAGEGIFANIMBEGIN(void)
HB_FUNC( GDIMAGEGIFANIMBEGIN )
{
   if ( hb_pcount() == 4 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        ( hb_parinfo( 2 ) & HB_IT_STRING || hb_parinfo( 2 ) & HB_IT_NUMERIC || ISNIL( 2 ) ) &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC
      )
   {
      gdImagePtr im;
      void *iptr;
      int size;
      int GlobalCM, Loops;

      /* Retrieve image pointer */
      im = hb_parGdImage( 1 );

      /* Retrieve global color map value */
      GlobalCM = hb_parni( 3 );

      /* Retrieve Loops value */
      Loops = hb_parni( 4 );

      /* run function */
      iptr = gdImageGifAnimBeginPtr(im, &size, GlobalCM, Loops);

      /* Check if 2nd parameter is a file name or an handle */
      if ( hb_parinfo( 2 ) & HB_IT_STRING )
      {
         char *szFile;
         szFile = hb_parcx( 2 );

         SaveImageToFile( szFile, iptr, size );
      }
      else if ( hb_parinfo( 2 ) & HB_IT_NUMERIC || ISNIL( 2 ) )
      {
         HB_FHANDLE fhandle;

         /* Retrieve file handle */
         fhandle = ( hb_parinfo( 2 ) & HB_IT_NUMERIC ) ? hb_parnl( 2 ) : 1; /* 1 = std output */

         SaveImageToHandle( fhandle, iptr, size );

      }

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 3,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
         return;
      }
   }
}
gdwrp.c4003
HB_FUNCGDIMAGEGIFANIMADD(void)
HB_FUNC( GDIMAGEGIFANIMADD )
{
   if ( hb_pcount() == 8 &&
        hb_parinfo( 1 ) & HB_IT_POINTER &&
        ( hb_parinfo( 2 ) & HB_IT_STRING || hb_parinfo( 2 ) & HB_IT_NUMERIC || ISNIL( 2 ) ) &&
        hb_parinfo( 3 ) & HB_IT_NUMERIC &&
        hb_parinfo( 4 ) & HB_IT_NUMERIC &&
        hb_parinfo( 5 ) & HB_IT_NUMERIC &&
        hb_parinfo( 6 ) & HB_IT_NUMERIC &&
        hb_parinfo( 7 ) & HB_IT_NUMERIC &&
        ( hb_parinfo( 8 ) & HB_IT_POINTER || ISNIL( 8 ) )
      )
   {
      gdImagePtr im, previm;
      void *iptr;
      int size;
      int LocalCM, LeftOfs, TopOfs, Delay, Disposal;

      /* Retrieve parameters */
      im       = hb_parGdImage( 1 );

      LocalCM  = hb_parni( 3 );
      LeftOfs  = hb_parni( 4 );
      TopOfs   = hb_parni( 5 );
      Delay    = hb_parni( 6 );
      Disposal = hb_parni( 7 );
      previm   = hb_parGdImage( 8 );

      /* Run function and return value */
      iptr = gdImageGifAnimAddPtr(im, &size, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm);

      /* Check if 2nd parameter is a file name or an handle */
      if ( hb_parinfo( 2 ) & HB_IT_STRING )
      {
         char *szFile;
         szFile = hb_parcx( 2 );

         AddImageToFile( szFile, iptr, size );
      }
      else if ( hb_parinfo( 2 ) & HB_IT_NUMERIC || ISNIL( 2 ) )
      {
         HB_FHANDLE fhandle;

         /* Retrieve file handle */
         fhandle = ( hb_parinfo( 2 ) & HB_IT_NUMERIC ) ? hb_parnl( 2 ) : 1; /* 1 = std output */

         SaveImageToHandle( fhandle, iptr, size );

      }

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 8,
            hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ), hb_paramError( 4 ),
            hb_paramError( 5 ), hb_paramError( 6 ), hb_paramError( 7 ), hb_paramError( 8 )
         );
         return;
      }
   }
}
gdwrp.c4065
HB_FUNCGDIMAGEGIFANIMEND(void)
HB_FUNC( GDIMAGEGIFANIMEND )
{
   if ( hb_pcount() == 1 &&
        ( hb_parinfo( 1 ) & HB_IT_STRING || hb_parinfo( 1 ) & HB_IT_NUMERIC || ISNIL( 1 ) )
      )
   {
      void *iptr;
      int size;

      /* Run function and return value */
      iptr = gdImageGifAnimEndPtr(&size);

      /* Check if 1st parameter is a file name or an handle */
      if ( hb_parinfo( 1 ) & HB_IT_STRING )
      {
         char *szFile;
         szFile = hb_parcx( 1 );

         AddImageToFile( szFile, iptr, size );
      }
      else if ( hb_parinfo( 2 ) & HB_IT_NUMERIC || ISNIL( 2 ) )
      {
         HB_FHANDLE fhandle;

         /* Retrieve file handle */
         fhandle = ( hb_parinfo( 1 ) & HB_IT_NUMERIC ) ? hb_parnl( 1 ) : 1; /* 1 = std output */

         SaveImageToHandle( fhandle, iptr, size );

      }

   }
   else
   {
      /* Parameter error */
      {
         hb_errRT_BASE_SubstR( EG_ARG, 0, NULL,
            HB_ERR_FUNCNAME, 1,
            hb_paramError( 1 )
         );
         return;
      }
   }
}
gdwrp.c4134
gd.prg
TypeFunctionSourceLine
FUNCTIONgdImageChar( im, font, x, y, char, color )
FUNCTION gdImageChar( im, font, x, y, char, color )
RETURN gdImageString( im, font, x, y, char, color )
gd.prg61
FUNCTIONgdImageCharUp( im, font, x, y, char, color )
FUNCTION gdImageCharUp( im, font, x, y, char, color )
RETURN gdImageStringUp( im, font, x, y, char, color )
gd.prg64
FUNCTIONgdImageCircle( im, cx, cy, w, color )
FUNCTION gdImageCircle( im, cx, cy, w, color )
RETURN gdImageArc( im, cx, cy, w, w, 0, 360, color )
gd.prg67
FUNCTIONgdImageFilledCircle( im, cx, cy, w, color )
FUNCTION gdImageFilledCircle( im, cx, cy, w, color )
RETURN gdImageFilledEllipse( im, cx, cy, w, w, color )
gd.prg70
FUNCTIONgdImageEllipse( im, cx, cy, w, h, color )
FUNCTION gdImageEllipse( im, cx, cy, w, h, color )
RETURN gdImageArc( im, cx, cy, w, h, 0, 360, color )
gd.prg73
FUNCTIONgdImageFTWidth( fontname, ptsize, angle )
FUNCTION gdImageFTWidth( fontname, ptsize, angle )
  LOCAL nWidth := 0
  LOCAL cErr
  LOCAL aRect := Array(8)
  DEFAULT fontname TO "Arial"
  DEFAULT ptsize   TO 8
  DEFAULT angle    TO 0
  cErr := gdImageStringFTEx( , @aRect, 0, fontname, ptsize, angle, 0, 0, "M" )
  //__OutDebug( "ptsize", ptsize, aRect )
  IF cErr == ""
     nWidth := aRect[3] - aRect[1]
  ENDIF

RETURN nWidth
gd.prg76
FUNCTIONgdImageFTHeight( fontname, ptsize, angle )
FUNCTION gdImageFTHeight( fontname, ptsize, angle )
  LOCAL nWidth := 0
  LOCAL cErr
  LOCAL aRect := Array(8)
  DEFAULT fontname TO "Arial"
  DEFAULT ptsize   TO 8
  DEFAULT angle    TO 0

  cErr := gdImageStringFTEx( , @aRect, 0, fontname, ptsize, angle, 0, 0, "M" )
  IF cErr == ""
     nWidth := aRect[2] - aRect[8]
  ENDIF

RETURN nWidth
gd.prg91
FUNCTIONgdImageFTSize( string, fontname, ptsize, angle )
FUNCTION gdImageFTSize( string, fontname, ptsize, angle )
  LOCAL nWidth  := 0
  LOCAL nHeight := 0
  LOCAL nX, nY
  LOCAL cErr
  LOCAL aRect := Array(8)
  DEFAULT fontname TO "Arial"
  DEFAULT ptsize   TO 8
  DEFAULT angle    TO 0
  cErr := gdImageStringFTEx( , @aRect, 0, fontname, ptsize, angle, 0, 0, string )
  //__OutDebug( "ptsize", ptsize, aRect )
  IF cErr == ""
     nWidth  := aRect[3] - aRect[1]
     nHeight := aRect[2] - aRect[8]
     nX      := aRect[1]
     nY      := aRect[2]
  ENDIF

RETURN { nWidth, nHeight, nX, nY }
gd.prg106
FUNCTIONgdImageStringFT( im, fg, fontname, ptsize, angle, x, y, string, linespacing, charmap, resolution )
FUNCTION gdImageStringFT( im, fg, fontname, ptsize, angle, x, y, string, ;
                          linespacing, charmap, resolution )
  LOCAL cErr
  LOCAL aRect := Array(8)
  cErr := gdImageStringFTEx( , @aRect, fg, fontname, ptsize, angle, x, y, string, linespacing, charmap, resolution )
  IF cErr == ""
     cErr := gdImageStringFTEx( im, aRect, fg, fontname, ptsize, angle, x, y, string, linespacing, charmap, resolution )
  ENDIF
RETURN cErr
gd.prg126
FUNCTIONgdImageFromFile( cFile )
FUNCTION gdImageFromFile( cFile )
  LOCAL cPath, cName, cExt, cDrive
  LOCAL cType, cMime
  LOCAL hFile := {=>}
  LOCAL oImage

  IF File( cFile )
     HB_FNameSplit( cFile, @cPath, @cName, @cExt, @cDrive )
     //TraceLog( cFile, cPath, cName, cExt, cDrive )
     cExt := Lower( cExt )
     DO CASE
        CASE cExt == ".jpg" .OR. cExt == ".jpeg"
             hFile[ "file"  ] := cFile
             hFile[ "path"  ] := cPath
             hFile[ "name"  ] := cName
             hFile[ "ext"   ] := cExt
             hFile[ "drive" ] := cDrive
             cType  := "jpeg"
             cMime  := "image/jpeg"
             oImage := GDImage():LoadFromJpeg( cFile )


        CASE cExt == ".gif"
             hFile[ "file"  ] := cFile
             hFile[ "path"  ] := cPath
             hFile[ "name"  ] := cName
             hFile[ "ext"   ] := cExt
             hFile[ "drive" ] := cDrive
             cType  := "gif"
             cMime  := "image/gif"
             oImage := GDImage():LoadFromGif( cFile )


        CASE cExt == ".png"
             hFile[ "file"  ] := cFile
             hFile[ "path"  ] := cPath
             hFile[ "name"  ] := cName
             hFile[ "ext"   ] := cExt
             hFile[ "drive" ] := cDrive
             cType  := "png"
             cMime  := "image/png"
             oImage := GDImage():LoadFromPng( cFile )
     ENDCASE

  ENDIF

RETURN { oImage, hFile, cType, cMime }
gd.prg136
FUNCTIONgdImageToString( oImage )
FUNCTION gdImageToString( oImage )
  LOCAL cString

  //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"
                   cString := :ToStringJpeg()
              CASE :cType == "gif"
                   cString := :ToStringGif()
              CASE :cType == "png"
                   cString := :ToStringPng()
           ENDCASE
        ENDIF
     END
  ENDIF
RETURN cString
gd.prg184
PROCEDUREgdImageToFile( oImage, cFile )
PROCEDURE gdImageToFile( oImage, cFile )
  LOCAL cString, cExt

  DEFAULT cFile TO "image"

  //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"
                   cString := :ToStringJpeg()
                   cExt    := "jpg"
              CASE :cType == "gif"
                   cString := :ToStringGif()
                   cExt    := "gif"
              CASE :cType == "png"
                   cString := :ToStringPng()
                   cExt    := "png"
           ENDCASE
           IF cString != NIL
              MemoWrit( cFile + "." + cExt, cString )
           ENDIF
        ENDIF
     END
  ENDIF

RETURN
gd.prg206
PROCEDUREgdImageToHandle( oImage, nHandle )
PROCEDURE gdImageToHandle( oImage, nHandle )

  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
gd.prg237
gdbar.prg
TypeFunctionSourceLine
CLASSTBarCode FROM GDImage
CLASS TBarCode  FROM GDImage

   // class attributes
   DATA positionX AS NUMERIC INIT  4
   DATA positionY AS NUMERIC
   DATA maxHeight AS NUMERIC INIT 25
   DATA maxHDefa  AS NUMERIC INIT 25
   DATA lastX     AS NUMERIC
   DATA lastY     AS NUMERIC
   DATA error     AS NUMERIC
   DATA imWidth   AS NUMERIC

   // Barcode attributes
   DATA Parity
   DATA LeftHand_Even  AS ARRAY
   DATA Right_Hand     AS ARRAY
   DATA LeftHand_Odd   AS ARRAY
   DATA keys           AS ARRAY

   DATA book      AS LOGICAL INIT .F.
   DATA acode     AS ARRAY
   DATA KeysModeA AS CHARACTER
   DATA KeysModeB AS CHARACTER
   DATA KeysModeC AS ARRAY

   // image attributes
   DATA res          AS NUMERIC
   DATA textfont     AS NUMERIC
   DATA text         AS CHARACTER
   DATA filename     AS CHARACTER
   DATA color_b      AS ARRAY
   DATA color_f      AS ARRAY
   DATA FillColor    AS NUMERIC
   DATA BackColor    AS NUMERIC
   DATA lDrawValue   AS LOGICAL INIT .T.

   // Methods
   METHOD CreateBar( sx, sy, filename, ccolor)
   METHOD Configure( nmaxHeight, aFillColor, aBackColor, nres, ntextfont, lbook, lDrawValue )
   METHOD Allocate()
   METHOD DrawError(ptext)
   METHOD DrawSingleBar(pcode )
   METHOD DrawSingleI25( pcode )
   METHOD DrawText()
   METHOD nextX()
   METHOD Finish( image_style, quality )
   METHOD SetText( ptext )
   METHOD ResetColor()
   METHOD CheckCode()
   METHOD CheckValInArray(cchar)

ENDCLASS
gdbar.prg70
TBARCODE:METHODCreateBar( sx, sy, filename, ccolor ) CLASS TBarCode
METHOD CreateBar( sx, sy, filename, ccolor ) CLASS TBarCode

   ::Create(sx, sy)

   DEFAULT ccolor  TO {255,255,255}

   ::setcolor( ccolor[1], ccolor[2], ccolor[3] )

   ::error     := 0
   ::positionY := 0
   ::imWidth   := sx

   if !empty( filename )
      ::filename  := filename
   endif

   ::FillColor  := ::setcolor( ::color_f[1] ,::color_f[2] ,::color_f[3] )
	::BackColor  := ::setcolor( ::color_b[1] ,::color_b[2] ,::color_b[3] )

	::Setfont("Arial")

   // configures Fontes
   If        ::textfont == 1 ; ::SetFontSmall()
   	ElseIf ::textfont == 2 ; ::SetFontLarge()
   	ElseIf ::textfont == 3 ; ::SetFontMediumBold()
   	ElseIf ::textfont == 4 ; ::SetFontGiant()
   	ElseIf ::textfont == 5 ; ::SetFontTiny()
	EndIf

	::SetFontPitch(::textfont)

	// always restores
   ::maxHeight := ::maxHDefa

Return Self
gdbar.prg123
TBARCODE:METHODConfigure( nmaxHeight, aFillColor, aBackColor, nres, ntextfont, lbook, lDrawValue ) CLASS TBarCode
METHOD Configure( nmaxHeight, aFillColor, aBackColor, nres, ntextfont, lbook, lDrawValue ) CLASS TBarCode

   DEFAULT lbook       TO .F.
   DEFAULT lDrawValue  TO .T.
   DEFAULT nmaxHeight  TO 25
   DEFAULT ntextfont   TO 2
   DEFAULT nres        TO 2
   DEFAULT aBackColor  TO {255,255,255}
   DEFAULT aFillColor  TO {0,0,0}

   ::book       := lbook
   ::maxHeight  := nmaxHeight
   ::res        := nres
   ::textfont   := ntextfont
	::lDrawValue := lDrawValue

   ::color_b    := aClone(aBackColor)
   ::color_f    := aClone(aFillColor)


RETURN NIL
gdbar.prg159
TBARCODE:METHODSetText( ptext ) CLASS TBarCode
METHOD SetText( ptext )  CLASS TBarCode

   ::text := ptext

Return NIL
gdbar.prg181
TBARCODE:METHODResetColor() CLASS TBarCode
METHOD ResetColor() CLASS TBarCode

   ::FillColor  := ::setcolor( ::color_f[1] ,::color_f[2] ,::color_f[3] )
	::BackColor  := ::setcolor( ::color_b[1] ,::color_b[2] ,::color_b[3] )

Return NIL
gdbar.prg187
TBARCODE:METHODAllocate() CLASS TBarCode
METHOD Allocate() CLASS TBarCode

   LOCAL R := ::color_b[1]
   LOCAL G := ::color_b[2]
   LOCAL B := ::color_b[3]

Return ::SetColor(R,G,B)
gdbar.prg194
TBARCODE:METHODDrawSingleBar( pcode ) CLASS TBarCode
METHOD DrawSingleBar( pcode ) CLASS TBarCode

    LOCAL i := 0
    LOCAL j := 0

    For j := 1 To Len( pcode )

       For i := 1  TO ::res
           ::Line( ::positionX + i  , ::positionY , ::positionX + i , (::positionY+::maxHeight) ,;
                        iif( SubStr(pcode,j,1) $ "0", ::BackColor, ::FillColor  ) )
       Next

      ::NextX()

    Next

Return NIL
gdbar.prg202
TBARCODE:METHODDrawSingleI25( pcode ) CLASS TBarCode
METHOD DrawSingleI25( pcode ) CLASS TBarCode

    LOCAL i      := 0
    LOCAL j      := 0

    LOCAL widthSlimBar  := 1
    LOCAL widthFatBar   := 3

    LOCAL imgBar
    LOCAL imgWid
    LOCAL end_y
    LOCAL qw

    ::positionX := 10

    For j := 1 To Len( pcode )

       imgBar := iif( j % 2 == 0, ::FillColor, ::BackColor )
       imgWid := iif( SubStr(pcode,j,1) =="0" , widthSlimBar, widthFatBar )

 		 end_y := ::maxHeight

		 For qw := 1 TO imgWid
			::Line( ::positionX, 1, ::positionX, end_y, imgBar)
			::nextX(.T.)
		 Next

    Next

Return NIL
gdbar.prg220
TBARCODE:METHODDrawError(ptext) CLASS TBarCode
METHOD DrawError(ptext) CLASS TBarCode

   ::Say( 5, ::error*15, ptext, ::FillColor )

	::error++

	::lastX := iif( (::GetFontWidth()*Len(ptext) ) > ::lastX , ( ::GetFontWidth()*Len(ptext)) , ::lastX )
	::lastY := ::error*15

Return NIL
gdbar.prg252
TBARCODE:METHODnextX(lI25) CLASS TBarCode
METHOD nextX(lI25) CLASS TBarCode

    DEFAULT li25 TO .F.

    If li25
       ::positionX ++
    Else
       ::positionX += ::res
    EndIf

Return NIL
gdbar.prg263
TBARCODE:METHODDrawText(lIsI25) CLASS TBarCode
METHOD DrawText(lIsI25) CLASS TBarCode

   LOCAL xPosition

   DEFAULT lIsI25 TO .F.

   If lIsI25
      If ::textfont != 0
          xPosition  := 10 * ::GetFontWidth()
          ::say(  xPosition, ::maxHeight, "*" + ::text + "*" , ::FillColor )
          ::lastY    := ::maxHeight + ::GetFontHeight()
      EndIf
   Else
      If ::textfont != 0
          xPosition  := ( ::positionX / 2) - ( Len( ::text ) /2 ) * ::GetFontWidth()
          ::say(  xPosition, ::maxHeight, ::text, ::FillColor )
            ::lastY    := ::maxHeight + ::GetFontHeight()
      EndIf
   EndIf

Return .T.
gdbar.prg275
TBARCODE:METHODCheckCode() CLASS TBarCode
METHOD CheckCode() CLASS TBarCode

   LOCAL lRet := .T.
   LOCAL i

   For i := 1 To Len( ::text )
       If !IsInt( ::CheckValInArray( SubStr( ::text, i, 1 ) ) )
           ::DrawError("Character  "+SubStr( ::text, i, 1 )+" not allowed .")
           lRet := .F.
       EndIf
   Next

Return lRet
gdbar.prg297
TBARCODE:METHODCheckValInArray(cchar) CLASS TBarCode
METHOD CheckValInArray(cchar) CLASS TBarCode

  LOCAL npos
  LOCAL uret

  npos := ASCAN( ::keys, { |x| SubStr( x, 1, 1 ) == cchar } )

  If npos > 0
     uret := npos
  Else
     uret := NIL
  EndIf

Return uret
gdbar.prg311
TBARCODE:METHODFinish( image_style, quality, nFG ) CLASS TBarCode
METHOD Finish( image_style, quality, nFG  ) CLASS TBarCode

   DEFAULT image_style TO IMG_FORMAT_PNG
   DEFAULT quality     TO 95
   DEFAULT nFG         TO {255,255,255}

   If Empty( ::filename ) .OR. ::filename == NIL

      // Output std handle == 1

      //::filename := ::text
      If image_style == IMG_FORMAT_PNG

         ::OutputPng()

      Elseif image_style == IMG_FORMAT_JPEG

         ::OutputJpeg( , quality )

      ElseIf image_style == IMG_FORMAT_WBMP

         ::OutputWBmp( , nFG )

      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

Return .T.
gdbar.prg326
FUNCTIONIsInt( pvar )
FUNCTION IsInt( pvar )

   If Valtype( pvar ) == "C"
      Return .F.
   EndIf

Return .T.
gdbar.prg379
gdbarcod.prg
TypeFunctionSourceLine
CLASSTCode FROM TBarCode
CLASS TCode FROM TBarCode

   DATA nType

   // EAN-13 ISBN
   METHOD New( nType ) CONSTRUCTOR
   METHOD Draw( cText )

   METHOD Draw13( cText )
   METHOD DrawText13()

   // EAN-8
   METHOD Draw8( cText )
   METHOD DrawText8()

   // EAN-128
   METHOD Draw128( cText, cModeCode )

   // I25
   METHOD DrawI25( cText )
   METHOD GenCodei25()

   // Utils
   METHOD FindCharCode( cstring, cchar )
   METHOD MixCode(bar_string)
   METHOD Findcode( uval )

ENDCLASS
gdbarcod.prg69
TCODE:METHODNew( nTypeCode ) CLASS TCode
METHOD New( nTypeCode ) CLASS TCode

   Local ii

   If ( nTypeCode == 13 .OR.;
        nTypeCode ==  8 )

      ::LeftHand_Odd  := {"0011001", "0010011", "0111101", "0100011", "0110001", "0101111", "0111011", "0110111", "0001011","0001101"}
      ::LeftHand_Even := {"0110011", "0011011", "0100001", "0011101", "0111001", "0000101", "0010001", "0001001", "0010111","0100111"}
      ::Right_Hand    := {"1100110", "1101100", "1000010", "1011100", "1001110", "1010000", "1000100", "1001000", "1110100","1110010"}
      ::Parity        := {"OOEOEE",  "OOEEOE",  "OOEEEO",  "OEOOEE",  "OEEOOE",  "OEEEOO",  "OEOEOE",  "OEOEEO",  "OEEOEO","OOOOOO"  }
      ::keys          := {'1','2','3','4','5','6','7','8','9','0'}

   ElseIf nTypeCode == 128 // 128

      ::aCode :={     "212222","222122","222221","121223","121322","131222","122213","122312","132212","221213",;
                      "221312","231212","112232","122132","122231","113222","123122","123221","223211","221132",;
                      "221231","213212","223112","312131","311222","321122","321221","312212","322112","322211",;
                      "212123","212321","232121","111323","131123","131321","112313","132113","132311","211313",;
                      "231113","231311","112133","112331","132131","113123","113321","133121","313121","211331",;
                      "231131","213113","213311","213131","311123","311321","331121","312113","312311","332111",;
                      "314111","221411","431111","111224","111422","121124","121421","141122","141221","112214",;
                      "112412","122114","122411","142112","142211","241211","221114","213111","241112","134111",;
                      "111242","121142","121241","114212","124112","124211","411212","421112","421211","212141",;
                      "214121","412121","111143","111341","131141","114113","114311","411113","411311","113141",;
                      "114131","311141","411131","211412","211214","211232","2331112";
                 }

      ::KeysmodeA := " " + [!"#$%&\()*+-.,/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ] + "[\]^_"
      ::KeysmodeB := " " + [!"#$%&\()*+-.,/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ] + "[\]^_abcdefghijklmnopqrstuvwxyz{|}~"

      ::KeysModeC := Array(99)

      For ii := 1 TO 99
          ::KeysmodeC[ii] :=  StrZero(ii,2)
      Next

   ElseIf nTypeCode == 25

      ::keys          := {'1','2','3','4','5','6','7','8','9','0'}

      ::aCode := Array(12)

      ::aCode[1]  := "10001"          //1 digit
      ::aCode[2]  := "01001"          //2 digit
      ::aCode[3]  := "11000"          //3 digit
      ::aCode[4]  := "00101"          //4 digit
      ::aCode[5]  := "10100"          //5 digit
      ::aCode[6]  := "01100"          //6 digit
      ::aCode[7]  := "00011"          //7 digit
      ::aCode[8]  := "10010"          //8 digit
      ::aCode[9]  := "01010"          //9 digit
      ::aCode[10] := "00110"          //0 digit
      ::acode[11] := "10000"          //pre-amble
      ::acode[12] := "100"            //post-amble

   Else

      Alert(" Invalid type to barcode !")

      Return NIL

   EndIf

   ::nType := nTypeCode

Return SELF
gdbarcod.prg98
TCODE:METHODDraw( cText ) CLASS TCode
METHOD Draw( cText ) CLASS TCode

   if ::nType == 13
      ::Draw13( cText )
   elseif ::nType == 8
      ::Draw8( cText )
   elseif ::nType == 128
      ::Draw128( cText )
   elseif ::nType == 25
      ::DrawI25( cText )
   endif

Return NIL
gdbarcod.prg166
TCODE:METHODDraw13(cText) CLASS TCode
METHOD Draw13(cText)  CLASS TCode

   LOCAL lerror := .f.
   LOCAL nchkSum :=0
   LOCAL nChk    :=0
   LOCAL ii,jj
   LOCAL xParity

   ::Settext( ctext )

	// Valid characters
	If !::CheckCode()
	   lerror := .T.
	EndIf

   If !lerror

      If ::book .AND. Len( ::text) != 10
			::DrawError("Must contains 10 chars if ISBN is true.")
			lerror := .T.
      EndIf

		// book, we changed the code to the right
      If ( ::book .And. Len( ::text )==10 )
			::text := "978"+substr(::text,1, Len( ::text )-1 )
      EndIF

  	   //  contain only 12 characters ?
      If Len( ::text ) != 12
			::DrawError( "Must contains 12 chars, the 13th digit is automatically added.")
			lerror := .t.
      EndIf

      If !lerror

			// If we have to write text, we moved the barcode to the right to have space to put digit
         ::positionX := iif( ::textfont == 0 , 0, 10 )

         xParity := ::Parity[ Val( SubStr( ::text, 1, 1 ) ) ]

   		// First Bar
   		::positionX := 10
   		::maxHeight := ::maxHeight + 9
   		::DrawSingleBar("101")

			// start code
			::maxHeight := ::maxHeight - 9

         For ii := 1 To Len( ::text )

             // Calculate check digit
             If Mod( ((Len(::text) + 1) - ii), 2 ) == 0
                nchkSum := nchkSum +  Int( Val( Substr(::text , ii, 1) ) )
             Else
                nchkSum := nchkSum +  Int( Val( Substr( ::text , ii, 1) ) ) * 3
             EndIf

        		 // ANow, the bar of the middle
             If ii == 8
               ::positionX += 1
         		::maxHeight := ::maxHeight + 9
         		::DrawSingleBar("101")
         		::maxHeight := ::maxHeight - 9
         		::positionX += 1
             EndIf

             jj := Val( SubStr( ::text, ii, 1) )

             If jj == 0
                jj := 10
             EndIf

             If ii > 1 .And. ii < 8

               ::DrawSingleBar( iif( Substr(xParity, ii - 1, 1) == "E",;
                                        ::LeftHand_Even[jj],;
                                              ::LeftHand_Odd[jj] ) )
             ElseIf ii > 1 .And. ii >= 8

                ::DrawSingleBar( ::Right_Hand[jj] )

             EndIf

        Next

        jj := Mod( nchkSum, 10 )

        If jj != 0
           nChk := 10 - jj
        EndIf

        If nChk == 0
           nChk := 10
        EndIf

        ::DrawSingleBar( ::Right_Hand[nChk] )

        // Now,  finish bar
        ::maxHeight := ::maxHeight + 9
        ::DrawSingleBar("101")

  		  ::lastX := ::positionX
		  ::lastY := ::maxHeight

		  ctext+=AllTrim( Str( nChk,1 ) )

	     // Draw Text
	     If ::lDrawValue
	        ::Settext( ctext )
    		  ::DrawText13()
    	  EndIf

      EndIf

   EndIf

Return NIL
gdbarcod.prg180
TCODE:METHODDrawText13() CLASS TCode
METHOD DrawText13()  CLASS TCode

   if ( ::textfont != 0 )

		::Say( 2, ::maxHeight-( ::GetFontHeight() / 2 ),SubStr( ::text,1,1) , ::FillColor )
		::Say( (10+(3*::res+48*::res)/2)-(::GetFontWidth()*(6/2)),::maxHeight+1,substr(::text,2,6), ::FillColor )
		::Say( 10+46*::res+(3*::res+46*::res)/2-::GetFontWidth()*(6/2),::maxHeight+1,substr(::text,8,6),::FillColor)

    EndIf

    ::lastY :=  ::maxHeight + ::GetFontHeight()

Return NIL
gdbarcod.prg298
TCODE:METHODDraw8( cText ) CLASS TCode
METHOD Draw8( cText ) CLASS TCode

   LOCAL lerror := .f.
   LOCAL ii,jj
   LOCAL xParity
   LOCAL nchkSum := 0
   LOCAL nChk    := 0

   ::Settext( ctext )

	// Valid characters
	If !::CheckCode()
	   lerror := .T.
	EndIf

	If !lerror

      ::positionX := iif( ::textfont == 0 , 0, 10 )

      xParity := ::Parity[ 7 ]

  		// First Bar
		::positionX := 10
		::maxHeight := ::maxHeight + 9
		::DrawSingleBar("101")

		// Start Code
 		::maxHeight := ::maxHeight - 9

      For ii := 1 To Len(::text)

           If Mod( ((Len(::text) + 1 ) - ii ), 2 ) == 0
              nchkSum := nchkSum +  Int( Val(Substr( ::text, ii, 1) ) )
           Else
              nchkSum := nchkSum +  Int( Val(Substr( ::text, ii, 1) ) ) * 3
           EndIf

           If ii == 5
              ::positionX += 1
        		  ::maxHeight := ::maxHeight + 9
      		  ::DrawSingleBar("01010")
      		  ::maxHeight := ::maxHeight - 9
      		  ::positionX += 1
           EndIf

           jj := Val( SubStr( ::text, ii, 1) )

           If jj == 0
              jj := 10
           EndIf

           If ii < 5
              ::DrawSingleBar( ::LeftHand_Odd[jj] )
           ElseIf ii >= 5
              ::DrawSingleBar( ::Right_Hand[jj] )
           EndIf

      Next

      jj := Mod( nchkSum, 10 )

      If jj != 0
         nChk := 10 - jj
      EndIf

      ::DrawSingleBar(::Right_Hand[nChk])

      // Now, finish bar
      ::maxHeight := ::maxHeight + 9
      ::DrawSingleBar("101")

  	   ::lastX := ::positionX
		::lastY := ::maxHeight

		ctext+=AllTrim( Str( nChk,1 ) )

 	   // Draw text
	   If ::lDrawValue
	      ::Settext( ctext )
    	   ::DrawText8()
    	EndIf


   EndIf

Return NIL
gdbarcod.prg312
TCODE:METHODDrawText8() CLASS TCode
METHOD DrawText8() CLASS TCode

	::say(  10+( (3*::res+34*::res)/2-::GetFontWidth()*(4/2) ),::maxHeight+1, substr( ::text,1,4 ),::fillcolor)
	::say(10+(32*::res+(3*::res+32*::res)/2-::GetFontWidth()*(4/2)),::maxHeight+1,substr(::text,5,4),::fillcolor)

   ::lastY :=  ::maxHeight + ::GetFontHeight()

Return NIL
gdbarcod.prg399
TCODE:METHODFindCharCode( cstring, cchar ) CLASS TCode
METHOD FindCharCode( cstring, cchar ) CLASS TCode

   LOCAL i
   LOCAL nC   := 0
   LOCAL nret := 0

   FOR i := 1 TO Len( cstring )

       If SubStr( cstring, i, 1 ) == cchar
          ++nC
          nRet := nC
          EXIT
       EndIf

       ++nC

   NEXT

Return nret
gdbarcod.prg408
TCODE:METHODDraw128( cText, cModeCode ) CLASS TCode
METHOD Draw128( cText, cModeCode ) CLASS TCode

    Local cchar, nvalchar, n, i

    Local nSum       := 0
    Local nC         := 0
    LOCAL npos       := 0
    LOCAL value_test := 0
    Local lTypeCodeC := .F.
    Local lTypeCodeA := .F.
    LOCAL lerror     := .F.
    Local cBarCode   := ""
    Local cconc      := ""

    DEFAULT cModeCode TO "B"

    ::settext( cText )

    If !Empty( cModeCode )
        If valtype(cModeCode)='C' .and. Upper(cModeCode) $'ABC'
            cModeCode := Upper(cModeCode)
        Else
           ::DrawError("Code 128 Modes are A,B o C. Character values.")
           lerror := .T.
        EndIf
    EndIf

	// Checking if all chars are allowed
	For i := 1 TO Len( ::text )

		If cModeCode == "C"

         npos := AsCAn( ::KeysmodeC, { |x| x == SubStr( ::Text, i, 1 ) + SubStr( ::Text, i+1, 1 ) } )

			If npos == 0
				 ::DrawError("With Code C, you must provide always pair of two integers. Char "+SubStr( ::text, i, 1 )+SubStr( ::text, i+1, 1 )+" not allowed." )
				 lerror := .T.
		  EndIf

		ElseIf cModeCode == "B"

			 If ::FindCharCode( ::KeysmodeB, SubStr( ::Text, i, 1 ) ) == 0
		       ::DrawError('Char '+ SubStr( ::text, i, 1 )+" not allowed.")
  			    lerror := .T.
			 EndIf

		ElseiF cModeCode == "A"

		   If ::FindCharCode( ::KeysmodeA, SubStr( ::text, i, 1 ) ) == 0
		      ::DrawError('Char '+ SubStr( ::text, i, 1 ) +" not allowed.")
  		      lerror := .T.
		   EndIf

		EndIf

   Next

   If !lerror

       If Empty(cModeCode)

          If Str( Val( ::text ), Len( ::text ) ) == ::text

              lTypeCodeC :=  .T.
              cconc  := ::aCode[ STARTC ]
              nSum   := STARTB

          Else

              For n := 1 TO  Len( ::text )
                  nC += iif( substr( ::text ,n,1 ) > 31, 1, 0 )
              Next

              If nC < Len( ::text ) / 2
                 lTypeCodeA:= .t.
                 cconc := ::aCode[STARTA]
                 nSum  := FNC1
              Else
                 cconc := ::aCode[STARTB]
                 nSum := STARTA
              EndIf

           EndIf

       Else

           If cModeCode =='C'

              lTypeCodeC  := .T.
              cconc       := ::aCode[STARTC]
              nSum        := STARTB

           Elseif cModeCode =='A'

               lTypeCodeA := .t.
               cconc      := ::aCode[STARTB]
               nSum       := FNC1

           Else

               cconc := ::aCode[STARTB]
               nSum := STARTA

           EndIf

       EndIf

       nC := 0

       For n := 1 To Len( ::text )

           nC ++

           cchar := Substr(::text,n,1)

           if lTypeCodeC

              If Len( ::TEXT ) == n
                 cconc += ::aCode[101]
                 nvalchar := Asc(cchar)-31
              Else
                 nvalchar := Val(Substr( ::text,n,2 ) ) + 1
                 n++
              EndIf

           Elseif lTypeCodeA

               If cchar > '_'
                   cconc += ::aCode[101]
                   nvalchar  := Asc(cchar)-31
               Elseif cchar <= ' '
                   nvalchar  := Asc(cchar)+64
               Else
                   nvalchar  := Asc(cchar)-31
               Endif

           Else

               If cchar < ' '
                   cconc += ::aCode[CODEA]
                   nvalchar := Asc(cchar)+64
               Else
                   nvalchar := Asc(cchar)-31
               EndIf

           Endif
           nSum += (nvalchar-1)*nC
           cconc := cconc +::aCode[nvalchar]

       next

       nSum  := nSum%103 +1
       cconc := cconc + ::aCode[ nSum ] +::aCode[107]

       For n:=1 To Len(cconc) STEP 2
           cBarCode +=Replicate('1', Val( Substr( cconc, n,1 ) ) )
           cBarCode +=Replicate('0', Val( substr( cconc, n+1,1 ) ) )
       Next

       ::DrawSingleBar( cBarCode )

   	 ::lastX := ::positionX
		 ::lastY := ::maxHeight

    	 // Draw Text
   	 If ::lDrawValue
   	    ::Settext( ctext )
          ::DrawText()
       EndIf

   EndIf

Return NIL
gdbarcod.prg428
TCODE:METHODDrawI25( cText ) CLASS TCode
METHOD DrawI25( cText ) CLASS TCode

  ::settext( cText )

  ::GenCodei25()

Return NIL
gdbarcod.prg602
TCODE:METHODGenCodei25() CLASS TCode
METHOD GenCodei25() CLASS TCode

   LOCAL lError   := .F.
   LOCAL bc_string := ::text
   LOCAL new_string := ""

   If ( Len(::text) % 2 )!= 0
      ::DrawError("Invalid barcode lenght")
      lError := .T.
   Endif

   If !lError

      bc_string := upper( ::text )

      // encode itemId to I25 barcode standard. //////////////////////////////////////

      bc_string := ::MixCode( bc_string )

      ///////////////////////////////////////////////////////////////////////////////////////////////
      //Adding Start and Stop Pattern

      ::DrawSingleI25( ::acode[11] + bc_string + ::acode[12]  )

      ::lastY := ::maxHeight

        // Draw Text
       If ::lDrawValue
          ::DrawText(.T.)
       EndIf

   EndIf

Return NIL
gdbarcod.prg610
TCODE:METHODMixCode(value) CLASS TCode
METHOD MixCode(value) CLASS TCode

   LOCAL l,i,k
   LOCAL s
   LOCAL bar_string := ""
   LOCAL cfirst
   LOCAL cnext

   l := Len( value )

   If ( l % 2 ) != 0
      ::DrawError("Code cannot be intercalated:  Invalid length (mix)")
   Else

      i    := 1
      s    := ""

      While i < l

        cFirst := ::Findcode( value[i] )
        cnext  := ::Findcode( value[i+1] )

        // Mix of the codes
        // NNNNWNNWWW
        //  N N N W W
        For k := 1 TO 5
            s += cFirst[k] + cnext[k]
        Next

        i += 2

      EndDo

      bar_string :=  s

   EndIf

Return bar_string
gdbarcod.prg648
TCODE:METHODFindcode( uval ) CLASS TCode
METHOD Findcode( uval ) CLASS TCode

   LOCAL npos
   LOCAL cretc

   npos  :=  AsCan( ::keys, { |x| x[1] == uval } )
   cretc := ::acode[npos]

Return cretc
gdbarcod.prg687
gdchart.prg
TypeFunctionSourceLine
CLASSGDChart FROM GDImage
CLASS GDChart FROM GDImage

   DATA cTitle
   DATA cAxisX
   DATA cAxisY
   DATA nWidth
   DATA nHeight
   DATA nScaleX
   DATA nScaleY

   DATA aSeries
   DATA aDataOfHashes         // Hash contains graph datas
   DATA hDefs


   METHOD New( sx, sy )  CONSTRUCTOR
   METHOD AddData()
   METHOD AddDef()
   METHOD SetData()
   METHOD SetDefs()

   METHOD PieChart()
   METHOD VerticalBarChart()
   METHOD HorizontalBarChart()
   METHOD LineChart()

   // clone method for gdchart
   METHOD Clone()

   PROTECTED:
   METHOD CloneDataFrom()

ENDCLASS
gdchart.prg66
GDCHART:METHODNew( sx, sy ) CLASS GDChart
METHOD New( sx, sy ) CLASS GDChart

   DEFAULT sx TO 320
   DEFAULT sy TO 200

   ::cTitle := "Chart"
   ::aSeries        := {}
   ::hDefs          := {=>}
   ::aDataOfHashes  := {}

   ::Create( sx, sy )
RETURN Self
gdchart.prg100
GDCHART:METHODAddData( hData ) CLASS GDChart
METHOD AddData( hData ) CLASS GDChart
   IF ValType( hData ) == "H"
      aAdd( ::aDataOfHashes, hData )
   ENDIF
RETURN Self
gdchart.prg113
GDCHART:METHODSetData( aData ) CLASS GDChart
METHOD SetData( aData ) CLASS GDChart
   IF ValType( aData ) == "A"
      ::aDataOfHashes := aData
   ENDIF
RETURN Self
gdchart.prg119
GDCHART:METHODAddDef( cDefKey, xDefVal ) CLASS GDChart
METHOD AddDef( cDefKey, xDefVal ) CLASS GDChart
   IF ValType( cDefKey ) == "C"
      HB_hSet( ::hDefs, Upper( cDefKey ), xDefVal )
   ENDIF
RETURN Self
gdchart.prg125
GDCHART:METHODSetDefs( hDefs ) CLASS GDChart
METHOD SetDefs( hDefs ) CLASS GDChart
   IF ValType( hDefs ) == "H"
      ::hDefs := hDefs
   ENDIF
RETURN Self
gdchart.prg131
GDCHART:METHODPieChart() CLASS GDChart
METHOD PieChart() CLASS GDChart
  LOCAL hElement, nTot := 0
  LOCAL nDegree := 0
  LOCAL lFilled, lExtruded, nExtrude, nTotExtr := 0, pTile
  LOCAL colorp
  LOCAL nVal, nDim
  LOCAL nPosX, nPosY
  LOCAL cLabel, hFont, cFontName, nPitch, nAngle, textcolor
  LOCAL x, y, nWidth
  LOCAL aPieDataOfHash, hDefs
  LOCAL cFontPitch

  aPieDataOfHash := ::aDataOfHashes
  hDefs          := ::hDefs

  x          := HGetValue( hDefs, "POSX" )
  y          := HGetValue( hDefs, "POSY" )
  nWidth     := HGetValue( hDefs, "WIDTH" )
  cFontPitch := HGetValue( hDefs, "FONTPITCH" )

  DEFAULT x          TO ::CenterWidth()
  DEFAULT y          TO ::CenterHeight()
  DEFAULT nWidth     TO Min( ::Width(), ::Height() )
  DEFAULT cFontPitch TO "TINY"

  DO CASE
     CASE cFontPitch == "TINY"
          ::SetFontTiny()
     CASE cFontPitch == "SMALL"
          ::SetFontSmall()
     CASE cFontPitch == "MEDIUM"
          ::SetFontMediumBold()
     CASE cFontPitch == "LARGE"
          ::SetFontLarge()
     CASE cFontPitch == "GIANT"
          ::SetFontGiant()
  ENDCASE

  //__OutDebug( "x, y, nWidth", x, y, nWidth )


  /*
    hData := ["TITLE"], ["VALUE"], ["FILLED"], ["COLOR"], ["TILE"], ["EXTRUDE"]
  */

  // Before sum of values to determine perentual
  FOR EACH hElement IN aPieDataOfHash
      nTot += hElement["VALUE"]
      // Check extrution
      IF ( nExtrude  := HGetValue( hElement, "EXTRUDE" ) ) <> NIL
         nTotExtr := Max( nTotExtr, nExtrude )
      ENDIF
  NEXT

  nWidth -= ( nTotExtr + 2 ) * 2

  //__OutDebug( "nTotExtr, nWidth", nTotExtr, nWidth )

  // Second,
  FOR EACH hElement IN aPieDataOfHash
      cLabel    := HGetValue( hElement, "LABEL" )
      lFilled   := HGetValue( hElement, "FILLED" )
      nExtrude  := HGetValue( hElement, "EXTRUDE" )
      pTile     := HGetValue( hElement, "TILE" )
      IF nExtrude <> NIL
         lExtruded := TRUE
      ELSE
         lExtruded := FALSE
      ENDIF
      colorp    := HGetValue( hElement, "COLOR" )
      nVal      := hElement["VALUE"]
      nDim      := 360 * ( ( nVal / nTot ) * 100 ) / 100
      DEFAULT lFilled  TO FALSE
      DEFAULT nExtrude TO 0
      DEFAULT colorp   TO ::SetColor( 0, 0, 0 )
      IF lExtruded
         nPosX   := x + nExtrude * cos(::Radians( nDegree + nDim / 2 ))
         nPosY   := y + nExtrude * sin(::Radians( nDegree + nDim / 2 ))
      ELSE
         nPosX   := x
         nPosY   := y
      ENDIF
      IF pTile <> NIL
         ::SetTile( pTile )
         colorp := gdTiled
      ELSE
         if ISARRAY( colorp )
            colorp := ::SetColor( colorp[1], colorp[2], colorp[3] )
         endif
      ENDIF
      IF lFilled
         ::Arc( nPosX, nPosY, nWidth, nWidth, nDegree, nDegree + nDim, TRUE, colorp, gdPie )
      ELSE
         ::Arc( nPosX, nPosY, nWidth, nWidth, nDegree, nDegree + nDim, TRUE, colorp, gdNoFill + gdEdged )
      ENDIF
      IF cLabel <> NIL
         //hFont := HGetValue( hElement, "FONT" )
         //IF hFont == NIL
         //   ::SetFontMediumBold()
            cFontName := NIL
            nPitch    := NIL
            nAngle    := NIL
            textcolor := NIL
         //ELSE
         //   cFontName := HGetValue( hFont, "NAME" )
         //   nPitch    := HGetValue( hFont, "PITCH" )
         //   nAngle    := HGetValue( hFont, "ANGLE" )
         //   textcolor := HGetValue( hFont, "COLOR" )
         //   DEFAULT cFontName TO "Arial"
         //   DEFAULT nPitch    TO 8
         //   DEFAULT nAngle    TO 0
         //ENDIF
         nPosX   := nPosX + ( (nExtrude + nWidth) / 4 ) * cos(::Radians( nDegree + nDim / 2 ))
         nPosY   := nPosY + ( (nExtrude + nWidth) / 4 ) * sin(::Radians( nDegree + nDim / 2 ))
         IF textcolor == NIL
            colorp    := ::GetPixel( nPosX, nPosY )
            textcolor := ::SetColor( 255 - ::Red( colorp ), 255 - ::Green( colorp ), 255 - ::Blue( colorp ) )
         ENDIF
         //cTitle := LTrim( Str( nVal ) )
         IF hFont == NIL
            ::Say( nPosX, nPosY, cLabel, textcolor, gdAlignCenter )
         ELSE
            ::SayFreeType( nPosX, nPosY, cLabel, cFontName, nPitch, nAngle, textcolor, gdAlignCenter )
         ENDIF
      ENDIF

      nDegree += nDim + 0.1
  NEXT
RETURN Self
gdchart.prg137
GDCHART:METHODVerticalBarChart() CLASS GDChart
METHOD VerticalBarChart() CLASS GDChart
  LOCAL hElement, nTot := 0
  LOCAL nDegree := 0
  LOCAL lFilled, lExtruded, nExtrude, pTile
  LOCAL colorp
  LOCAL nVal, nDim
  LOCAL nPosX, nPosY
  LOCAL nSize, nMax
  LOCAL nBorder, nThick, n
  LOCAL x, y, nWidth, nHeight, nMaxValue, color, nMaxLabel, cLabel
  LOCAL lShowAxis, lShowGrid

  LOCAL nLeftLabelSpace   //:= 40
  LOCAL nRightLabelSpace  //:= 40
  LOCAL nBottomLabelSpace //:= 40
  LOCAL nTopLabelSpace    := 40
  LOCAL lShowLabelLeft    := TRUE
  LOCAL lShowLabelRight   := TRUE //FALSE
  LOCAL lShowLabelBottom  := TRUE
  LOCAL lShowLabelTop     := FALSE
  LOCAL cAxisPict
  LOCAL cFontPitch

  LOCAL aDataOfHash, hDefs

  aDataOfHash := ::aDataOfHashes
  hDefs       := ::hDefs

  x          := HGetValue( hDefs, "POSX" )
  y          := HGetValue( hDefs, "POSY" )
  nWidth     := HGetValue( hDefs, "WIDTH" )
  nHeight    := HGetValue( hDefs, "HEIGHT" )
  nMaxValue  := HGetValue( hDefs, "MAXVALUE" )
  color      := HGetValue( hDefs, "COLOR" )
  lShowAxis  := HGetValue( hDefs, "SHOWAXIS" )
  lShowGrid  := HGetValue( hDefs, "SHOWGRID" )
  cAxisPict  := HGetValue( hDefs, "AXISPICT" )
  cFontPitch := HGetValue( hDefs, "FONTPITCH" )

  DEFAULT x          TO 0
  DEFAULT y          TO 0
  DEFAULT nWidth     TO ::Width()
  DEFAULT nHeight    TO ::Height()
  DEFAULT color      TO ::GetColor()
  DEFAULT lShowAxis  TO TRUE
  DEFAULT lShowGrid  TO TRUE
  DEFAULT cAxisPict  TO "@E 9,999.99"
  DEFAULT cFontPitch TO "TINY"

  DEFAULT nBorder TO 4

  /*
    hData := ["TITLE"], ["VALUE"], ["FILLED"], ["COLOR"], ["TILE"], ["EXTRUDE"]
  */

  DO CASE
     CASE cFontPitch == "TINY"
          ::SetFontTiny()
     CASE cFontPitch == "SMALL"
          ::SetFontSmall()
     CASE cFontPitch == "MEDIUM"
          ::SetFontMediumBold()
     CASE cFontPitch == "LARGE"
          ::SetFontLarge()
     CASE cFontPitch == "GIANT"
          ::SetFontGiant()
  ENDCASE



  // Before sum of values to determine perentual
  nMaxLabel := 0
  nMax      := 0
  FOR EACH hElement IN aDataOfHash
      IF hElement:__enumIndex() == 1
         nMax := hElement["VALUE"]
      ELSE
         nMax := Max( nMax, hElement["VALUE"] )
      ENDIF
      cLabel    := HGetValue( hElement, "LABEL" )
      nMaxLabel := Max( nMaxLabel, Len( IIF( cLabel <> NIL, cLabel, "" ) ) )
      nTot      += hElement["VALUE"]
  NEXT

  //__OutDebug( "Len( LTrim( Str( nMax ) ) )", Len( LTrim( cStr( nMax ) ) ), Str( nMax ) )

  DEFAULT nLeftLabelSpace    TO nBorder + Len( LTrim( Transform( nMax, cAxisPict ) ) ) * ::GetFontWidth() + nBorder
  DEFAULT nRightLabelSpace   TO nLeftLabelSpace //nBorder + Len( LTrim( Str( nMax ) ) ) * ::GetFontWidth() + nBorder
  DEFAULT nBottomLabelSpace  TO nBorder + nMaxLabel * ::GetFontWidth() + nBorder
  DEFAULT nMaxValue          TO nMax

  IF lShowAxis
     IF lShowLabelLeft
        x       += nLeftLabelSpace
        nWidth  -= nLeftLabelSpace
     ENDIF
     IF lShowLabelRight
        nWidth  -= nRightLabelSpace
     ENDIF
     IF lShowLabelBottom
        y       += nBottomLabelSpace
        nHeight -= nBottomLabelSpace
     ENDIF
     IF lShowLabelTop
        nHeight -= nTopLabelSpace
     ENDIF
  ENDIF

  nSize := nWidth / Len( aDataOfHash )

  IF lShowGrid
     ::Rectangle( x, ::Height() - ( y + nHeight ), x + nWidth, ::Height() - y, FALSE, color )

     nThick := ::SetThickness( 1 )

     ::ResetStyles()
     ::AddStyle( color )
     ::AddStyle( color )
     ::AddStyle( color )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::SetStyle()
     FOR n := 10 TO 100 STEP 10
         nDim  := ( ( nMaxValue / 100 ) * n )
         nPosY := ( nDim / nMaxValue ) * nHeight
         //__OutDebug( "nDim", nDim )
         ::Line( x, ::Height() - ( y + nPosY), x + nWidth, ::Height() - ( y + nPosY ), gdStyled )
     NEXT
      ::SetThickness( nThick )
  ENDIF
  IF lShowAxis
     // Y Axis
     FOR n := 10 TO 100 STEP 10
         nDim  := ( ( nMaxValue / 100 ) * n )
         cLabel := LTrim( Transform( nDim, cAxisPict ) )
         nPosY := ( nDim / nMaxValue ) * nHeight
         IF lShowLabelLeft
            ::Say( x - nLeftLabelSpace + nBorder, ::Height() - ( y + nPosY ), PadL( cLabel, Len( LTrim( Transform( nMaxValue, cAxisPict ) ) ) ), color )
         ENDIF
         IF lShowLabelRight
            ::Say( x + nWidth + nBorder, ::Height() - ( y + nPosY ), cLabel, color )
         ENDIF
     NEXT
  ENDIF

  // Second,
  FOR EACH hElement IN aDataOfHash
      cLabel    := HGetValue( hElement, "LABEL" )
      lFilled   := HGetValue( hElement, "FILLED" )
      nExtrude  := HGetValue( hElement, "EXTRUDE" )
      pTile     := HGetValue( hElement, "TILE" )
      IF nExtrude <> NIL
         lExtruded := TRUE
      ELSE
         lExtruded := FALSE
      ENDIF
      colorp    := HGetValue( hElement, "COLOR" )
      nVal      := hElement["VALUE"]
      nDim      := ( nVal / nMaxValue ) * nHeight

      DEFAULT lFilled  TO FALSE
      DEFAULT nExtrude TO 0
      DEFAULT colorp   TO ::SetColor( 0, 0, 0 )

      nPosX   := x + ( nSize * ( hElement:__enumIndex() - 1 ) )
      nPosY   := y
      IF pTile <> NIL
         ::SetTile( pTile )
         colorp := gdTiled
      ELSE
         if ISARRAY( colorp )
            colorp := ::SetColor( colorp[1], colorp[2], colorp[3] )
         endif
      ENDIF
      ::Rectangle( nPosX + nBorder, ::Height() - ( nPosY + nDim ), nPosX + nSize - nBorder, ::Height() - nPosY, lFilled, colorp )

      IF lShowAxis
         // Y Axis
         IF lShowLabelBottom
            ::SayVertical( nPosX + nSize / 2 - ::GetFontHeight() / 2, ::Height() - nBorder, PadL( cLabel, nMaxLabel ), color )
         ENDIF
      ENDIF

  NEXT
RETURN Self
gdchart.prg267
GDCHART:METHODHorizontalBarChart() CLASS GDChart
METHOD HorizontalBarChart() CLASS GDChart
  LOCAL hElement, nTot := 0
  LOCAL nDegree := 0
  LOCAL lFilled, lExtruded, nExtrude, pTile
  LOCAL colorp
  LOCAL nVal, nDim
  LOCAL nPosX, nPosY
  LOCAL nSize, nMax
  LOCAL nBorder, nThick, n
  LOCAL x, y, nWidth, nHeight, nMaxValue, color, nMaxLabel, cLabel
  LOCAL lShowAxis, lShowGrid

  LOCAL nLeftLabelSpace   //:= 40
  LOCAL nRightLabelSpace  //:= 40
  LOCAL nBottomLabelSpace //:= 40
  LOCAL nTopLabelSpace    //:= 40
  LOCAL lShowLabelLeft    := TRUE
  LOCAL lShowLabelRight   := TRUE
  LOCAL lShowLabelBottom  := TRUE
  LOCAL lShowLabelTop     := TRUE
  LOCAL cAxisPict
  LOCAL cFontPitch

  LOCAL aDataOfHash, hDefs

  aDataOfHash := ::aDataOfHashes
  hDefs       := ::hDefs

  x          := HGetValue( hDefs, "POSX" )
  y          := HGetValue( hDefs, "POSY" )
  nWidth     := HGetValue( hDefs, "WIDTH" )
  nHeight    := HGetValue( hDefs, "HEIGHT" )
  nMaxValue  := HGetValue( hDefs, "MAXVALUE" )
  color      := HGetValue( hDefs, "COLOR" )
  lShowAxis  := HGetValue( hDefs, "SHOWAXIS" )
  lShowGrid  := HGetValue( hDefs, "SHOWGRID" )
  cAxisPict  := HGetValue( hDefs, "AXISPICT" )
  cFontPitch := HGetValue( hDefs, "FONTPITCH" )

  DEFAULT x          TO 0
  DEFAULT y          TO 0
  DEFAULT nWidth     TO ::Width()
  DEFAULT nHeight    TO ::Height()
  DEFAULT color      TO ::GetColor()
  DEFAULT lShowAxis  TO TRUE
  DEFAULT lShowGrid  TO TRUE
  DEFAULT cAxisPict  TO "@E 9,999.99"
  DEFAULT cFontPitch TO "TINY"

  DEFAULT nBorder TO 4

  /*
    hData := ["TITLE"], ["VALUE"], ["FILLED"], ["COLOR"], ["TILE"], ["EXTRUDE"]
  */

  DO CASE
     CASE cFontPitch == "TINY"
          ::SetFontTiny()
     CASE cFontPitch == "SMALL"
          ::SetFontSmall()
     CASE cFontPitch == "MEDIUM"
          ::SetFontMediumBold()
     CASE cFontPitch == "LARGE"
          ::SetFontLarge()
     CASE cFontPitch == "GIANT"
          ::SetFontGiant()
  ENDCASE

  // Before sum of values to determine perentual
  nMaxLabel := 0
  nMax      := 0
  FOR EACH hElement IN aDataOfHash
      IF hElement:__enumIndex() == 1
         nMax := hElement["VALUE"]
      ELSE
         nMax := Max( nMax, hElement["VALUE"] )
      ENDIF
      cLabel    := HGetValue( hElement, "LABEL" )
      nMaxLabel := Max( nMaxLabel, Len( IIF( cLabel <> NIL, cLabel, "" ) ) )
      nTot      += hElement["VALUE"]
  NEXT
  DEFAULT nLeftLabelSpace    TO nBorder + nMaxLabel * ::GetFontWidth() + nBorder
  DEFAULT nRightLabelSpace   TO nBorder + ( Len( LTrim( Transform( nMax, cAxisPict ) ) ) * ::GetFontWidth() / 2 )
  DEFAULT nTopLabelSpace     TO nBorder + ::GetFontHeight() + nBorder
  DEFAULT nBottomLabelSpace  TO nTopLabelSpace // nBorder + ::GetFontHeight() + nBorder
  DEFAULT nMaxValue          TO nMax

  IF lShowAxis
     IF lShowLabelLeft
        x       += nLeftLabelSpace
        nWidth  -= nLeftLabelSpace
     ENDIF
     IF lShowLabelRight
        nWidth  -= nRightLabelSpace
     ENDIF
     IF lShowLabelBottom
        y       += nBottomLabelSpace
        nHeight -= nBottomLabelSpace
     ENDIF
     IF lShowLabelTop
        nHeight -= nTopLabelSpace
     ENDIF
  ENDIF

  nSize := nHeight / Len( aDataOfHash )

  IF lShowGrid
     ::Rectangle( x, ::Height() - ( y + nHeight ), x + nWidth, ::Height() - y, FALSE, color )

     nThick := ::SetThickness( 1 )

     ::ResetStyles()
     ::AddStyle( color )
     ::AddStyle( color )
     ::AddStyle( color )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::SetStyle()
     FOR n := 10 TO 100 STEP 10
         nDim  := ( ( nMaxValue / 100 ) * n )
         nPosX := ( nDim / nMaxValue ) * nWidth
         ::Line( x + nPosX, y, x + nPosX, y + nHeight, gdStyled )
     NEXT
      ::SetThickness( nThick )
  ENDIF
  IF lShowAxis
     // X Axis
     FOR n := 0 TO 100 STEP 10
         nDim   := ( ( nMaxValue / 100 ) * n )
         cLabel := LTrim( Transform( nDim, cAxisPict ) )
         nPosX  := ( nDim / nMaxValue ) * nWidth - ( ( Len( cLabel ) / 2 ) * ::GetFontWidth() )
         IF lShowLabelTop
            ::Say( x + nPosX, y - nTopLabelSpace + nBorder, cLabel, color )
         ENDIF
         IF lShowLabelBottom
            ::Say( x + nPosX, y + nHeight + nBorder, cLabel, color )
         ENDIF
     NEXT
  ENDIF

  // Second,
  FOR EACH hElement IN aDataOfHash
      cLabel    := HGetValue( hElement, "LABEL" )
      lFilled   := HGetValue( hElement, "FILLED" )
      nExtrude  := HGetValue( hElement, "EXTRUDE" )
      pTile     := HGetValue( hElement, "TILE" )
      IF nExtrude <> NIL
         lExtruded := TRUE
      ELSE
         lExtruded := FALSE
      ENDIF
      colorp    := HGetValue( hElement, "COLOR" )
      nVal      := hElement["VALUE"]
      nDim      := ( nVal / nMaxValue ) * nWidth
      //__OutDebug( "nDim", nDim )
      DEFAULT lFilled  TO FALSE
      DEFAULT nExtrude TO 0
      DEFAULT colorp   TO ::SetColor( 0, 0, 0 )

      nPosX   := x
      nPosY   := y + ( nSize * ( hElement:__enumIndex() - 1 ) )

      IF pTile <> NIL
         ::SetTile( pTile )
         colorp := gdTiled
      ELSE
         if ISARRAY( colorp )
            colorp := ::SetColor( colorp[1], colorp[2], colorp[3] )
         endif
      ENDIF
      ::Rectangle( nPosX, nPosY + nBorder, nPosX + nDim,  nPosY + nSize - nBorder, lFilled, colorp )

      IF lShowAxis
         // Y Axis
         IF lShowLabelBottom
            ::Say( nBorder, nPosY + nSize / 2 - ::GetFontHeight() / 2, PadL( cLabel, nMaxLabel ), color )
         ENDIF
      ENDIF

  NEXT
RETURN Self
gdchart.prg456
GDCHART:METHODLineChart() CLASS GDChart
METHOD LineChart() CLASS GDChart
  LOCAL hElement
  LOCAL nDegree := 0
  LOCAL lFilled, lExtruded, nExtrude, pTile
  LOCAL colorp
  LOCAL nVal, nDim
  LOCAL nPosX, nPosY
  LOCAL cLabel
  LOCAL nSize, nMax, nMin, nTotRange, nCeiling
  LOCAL nBorder, nThick, n
  LOCAL x, y, nWidth, nHeight, nMaxValue, nMinValue, color, nMaxLabel, nMinLabel
  LOCAL lShowAxis, lShowGrid

  LOCAL nLeftLabelSpace   //:= 40
  LOCAL nRightLabelSpace  //:= 40
  LOCAL nBottomLabelSpace //:= 40
  LOCAL nTopLabelSpace    := 40
  LOCAL lShowLabelLeft    := TRUE
  LOCAL lShowLabelRight   := TRUE //FALSE
  LOCAL lShowLabelBottom  := TRUE
  LOCAL lShowLabelTop     := FALSE
  LOCAL cAxisPict
  LOCAL cFontPitch

  LOCAL aDataOfHash, hDefs, aPoints

  aDataOfHash := ::aDataOfHashes
  hDefs       := ::hDefs

  x          := HGetValue( hDefs, "POSX" )
  y          := HGetValue( hDefs, "POSY" )
  nWidth     := HGetValue( hDefs, "WIDTH" )
  nHeight    := HGetValue( hDefs, "HEIGHT" )
  nMaxValue  := HGetValue( hDefs, "MAXVALUE" )
  nMinValue  := HGetValue( hDefs, "MINVALUE" )
  color      := HGetValue( hDefs, "COLOR" )
  lShowAxis  := HGetValue( hDefs, "SHOWAXIS" )
  lShowGrid  := HGetValue( hDefs, "SHOWGRID" )
  cAxisPict  := HGetValue( hDefs, "AXISPICT" )
  cFontPitch := HGetValue( hDefs, "FONTPITCH" )

  DEFAULT x          TO 0
  DEFAULT y          TO 0
  DEFAULT nWidth     TO ::Width()
  DEFAULT nHeight    TO ::Height()
  DEFAULT color      TO ::GetColor()
  DEFAULT lShowAxis  TO TRUE
  DEFAULT lShowGrid  TO TRUE
  DEFAULT cAxisPict  TO "@E 9,999.99"
  DEFAULT cFontPitch TO "TINY"

  DEFAULT nBorder TO 4

  /*
    hData := ["TITLE"], ["VALUE"], ["FILLED"], ["COLOR"], ["TILE"], ["EXTRUDE"]
  */

  DO CASE
     CASE cFontPitch == "TINY"
          ::SetFontTiny()
     CASE cFontPitch == "SMALL"
          ::SetFontSmall()
     CASE cFontPitch == "MEDIUM"
          ::SetFontMediumBold()
     CASE cFontPitch == "LARGE"
          ::SetFontLarge()
     CASE cFontPitch == "GIANT"
          ::SetFontGiant()
  ENDCASE

  // Before sum of values to determine percentual
  nMaxLabel := 0
  nMax      := 0
  FOR EACH hElement IN aDataOfHash
      IF hElement:__enumIndex() == 1
         nMax := hElement["VALUE"]
      ELSE
         nMax := Max( nMax, hElement["VALUE"] )
      ENDIF
      cLabel    := HGetValue( hElement, "LABEL" )
      nMaxLabel := Max( nMaxLabel, Len( IIF( cLabel <> NIL, cLabel, "" ) ) )
  NEXT

  // Before sum of values to determine percentual
  nMinLabel := 0
  nMin      := 0
  FOR EACH hElement IN aDataOfHash
      IF hElement:__enumIndex() == 1
         nMin := hElement["VALUE"]
      ELSE
         nMin := Min( nMin, hElement["VALUE"] )
      ENDIF
      cLabel    := HGetValue( hElement, "LABEL" )
      nMinLabel := Max( nMinLabel, Len( IIF( cLabel <> NIL, cLabel, "" ) ) )
  NEXT

  DEFAULT nLeftLabelSpace    TO nBorder + Max( Len( LTrim( Transform( nMax, cAxisPict ) ) ), Len( LTrim( Transform( nMin, cAxisPict ) ) ) ) * ::GetFontWidth() + nBorder
  DEFAULT nRightLabelSpace   TO nLeftLabelSpace
  DEFAULT nBottomLabelSpace  TO nBorder + nMaxLabel * ::GetFontWidth() + nBorder
  DEFAULT nMaxValue          TO nMax
  DEFAULT nMinValue          TO nMin

  IF lShowAxis
     IF lShowLabelLeft
        x       += nLeftLabelSpace
        nWidth  -= nLeftLabelSpace
     ENDIF
     IF lShowLabelRight
        nWidth  -= nRightLabelSpace
     ENDIF
     IF lShowLabelBottom
        y       += nBottomLabelSpace
        nHeight -= nBottomLabelSpace
     ENDIF
     IF lShowLabelTop
        nHeight -= nTopLabelSpace
     ENDIF
  ENDIF

  nSize := Len( aDataOfHash ) - 1

  if nSize > 1
     nSize := nWidth / nSize
  else
     nSize := nWidth
  endif

  nTotRange := nMaxValue + iif( nMinValue < 0, abs( nMinValue ), 0 )

  nCeiling := 0

  do while ( nTotRange / ( 10 ^ nCeiling ) ) > 100
     nCeiling++
  enddo

  nCeiling := 10 ^ nCeiling

  nMaxValue := ceiling( nMaxValue / nCeiling ) * nCeiling
  nMinValue := iif( nMinValue < 0, -ceiling( abs( nMinValue ) / nCeiling ) * nCeiling, ceiling( nMinValue / nCeiling ) * nCeiling )

  nTotRange := nMaxValue + iif( nMinValue < 0, abs( nMinValue ), 0 )

  IF lShowGrid
     ::Rectangle( x, ::Height() - ( y + nHeight ), x + nWidth, ::Height() - y, FALSE, color )

     nThick := ::SetThickness( 1 )

     ::ResetStyles()
     ::AddStyle( color )
     ::AddStyle( color )
     ::AddStyle( color )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::AddStyle( gdTransparent )
     ::SetStyle()
     FOR n := 10 TO 100 STEP 10
         nDim  := ( ( nTotRange / 100 ) * n )
         nPosY := ( nDim / nTotRange ) * nHeight
         //__OutDebug( "nDim", nDim )
         ::Line( x, ::Height() - ( y + nPosY), x + nWidth, ::Height() - ( y + nPosY ), gdStyled )
     NEXT
     FOR EACH hElement IN aDataOfHash
         nPosX   := x + ( nSize * ( hElement:__enumIndex() - 1 ) )
         ::Line( nPosX, ::Height() - y, nPosX, ::Height() - ( y + nHeight ), gdStyled )
     NEXT
      ::SetThickness( nThick )
  ENDIF

  IF lShowAxis
     // Y Axis
     FOR n := 0 TO 100 STEP 10
         nDim  := ( ( nTotRange / 100 ) * n )
         cLabel := LTrim( Transform( nMinValue + ( nTotRange / 10 ) * ( n / 10 ), cAxisPict ) )
         nPosY := ( nDim / nTotRange ) * nHeight
         IF lShowLabelLeft
            ::Say( x - nLeftLabelSpace + nBorder, ::Height() - ( y + nPosY ), cLabel, color )
         ENDIF
         IF lShowLabelRight
            ::Say( x + nWidth + nBorder, ::Height() - ( y + nPosY ), cLabel, color )
         ENDIF
     NEXT
  ENDIF

  // Second,
  aPoints := {}
  FOR EACH hElement IN aDataOfHash
      cLabel    := HGetValue( hElement, "LABEL" )
      lFilled   := HGetValue( hElement, "FILLED" )
      nExtrude  := HGetValue( hElement, "EXTRUDE" )
      pTile     := HGetValue( hElement, "TILE" )
      IF nExtrude <> NIL
         lExtruded := TRUE
      ELSE
         lExtruded := FALSE
      ENDIF
      colorp    := HGetValue( hElement, "COLOR" )
      nVal      := hElement["VALUE"]
      nDim      := ( ( nVal + abs( nMinValue ) ) / nTotRange ) * nHeight

      DEFAULT lFilled  TO FALSE
      DEFAULT nExtrude TO 0
      DEFAULT colorp   TO ::SetColor( 0, 0, 0 )

      nPosX   := x + ( nSize * ( hElement:__enumIndex() - 1 ) )
      nPosY   := y
      IF pTile <> NIL
         ::SetTile( pTile )
         colorp := gdTiled
      ELSE
         if ISARRAY( colorp )
            colorp := ::SetColor( colorp[1], colorp[2], colorp[3] )
         endif
      ENDIF
      //::Rectangle( nPosX + nBorder, ::Height() - ( nPosY + nDim ), nPosX + nSize - nBorder, ::Height() - nPosY, lFilled, colorp )
      aAdd( aPoints, { nPosX, ::Height() - ( nPosY + nDim ) } )

      IF lShowAxis
         // Y Axis
         IF lShowLabelBottom
            ::SayVertical( nPosX - ::GetFontHeight() / 2, ::Height() - nBorder, PadL( cLabel, nMaxLabel ), color )
         ENDIF
      ENDIF

  NEXT

  // Draw lines
  nThick := ::SetThickness( 3 )

  //::ResetStyles()
  //::AddStyle( color )
  //::AddStyle( color )
  //::AddStyle( color )
  //::AddStyle( gdTransparent )
  //::AddStyle( gdTransparent )
  //::AddStyle( gdTransparent )
  //::AddStyle( gdTransparent )
  //::AddStyle( gdTransparent )
  //::SetStyle()
  FOR n := 1 TO Len( aPoints ) - 1
      ::Line( aPoints[ n ][ 1 ], aPoints[ n ][ 2 ], aPoints[ n + 1 ][ 1 ], aPoints[ n + 1 ][ 2 ], color )
  NEXT
  ::SetThickness( nThick )

RETURN Self
gdchart.prg641
GDCHART:METHODClone() CLASS GDChart
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
gdchart.prg888
GDCHART:METHODCloneDataFrom( oSrc )
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 )
   ::hDefs         := HB_HClone( oSrc:hDefs )

RETURN Self
gdchart.prg914
STATIC FUNCTIONHGetValue( hHash, cKey )
STATIC FUNCTION HGetValue( hHash, cKey )
  LOCAL nPos
  LOCAL xVal
  IF hHash <> NIL
     xVal := IIF( ( nPos := HB_HPos( hHash, cKey )) == 0, NIL, HB_HValueAt( hHash, nPos) )
  ENDIF
RETURN xVal
gdchart.prg935
gdimage.prg
TypeFunctionSourceLine
CLASSGDImage
CLASS GDImage

   PROTECTED:
   DATA pImage
   DATA pBrush
   DATA pTile
   DATA pFont
   DATA pColor

   DATA cFontName    INIT "Arial"
   DATA nFontPitch   INIT 20
   DATA nFontAngle   INIT 0

   DATA aPoints      INIT {}
   DATA aStyles      INIT {}
   DATA lDestroy     INIT TRUE

   EXPORTED:
   DATA hFile
   DATA cType
   DATA cMime

   METHOD New( sx, sy )  CONSTRUCTOR
gdimage.prg65
GDIMAGE:METHODCreate( sx, sy )
   METHOD Create( sx, sy )                 INLINE ::pImage := gdImageCreate( sx, sy ), Self
gdimage.prg92
GDIMAGE:METHODCreateTrueColor( sx, sy )
   METHOD CreateTrueColor( sx, sy )        INLINE ::pImage := gdImageCreateTrueColor( sx, sy ), Self
gdimage.prg93
GDIMAGE:METHODLoadFromPng( cFile )
   METHOD LoadFromPng( cFile )             INLINE ::pImage := gdImageCreateFromPng( cFile )          , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg96
GDIMAGE:METHODLoadFromJpeg( cFile )
   METHOD LoadFromJpeg( cFile )            INLINE ::pImage := gdImageCreateFromJpeg( cFile )         , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg97
GDIMAGE:METHODLoadFromWBmp( cFile )
   METHOD LoadFromWBmp( cFile )            INLINE ::pImage := gdImageCreateFromWBMP( cFile )         , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg98
GDIMAGE:METHODLoadFromGd( cFile )
   METHOD LoadFromGd( cFile )              INLINE ::pImage := gdImageCreateFromGD( cFile )           , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg99
GDIMAGE:METHODLoadFromGif( cFile )
   METHOD LoadFromGif( cFile )             INLINE ::pImage := gdImageCreateFromGif( cFile )          , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg100
GDIMAGE:METHODInputPng( nHandle, nSize )
   METHOD InputPng( nHandle, nSize )       INLINE ::pImage := gdImageCreateFromPng( nHandle, nSize ) , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg103
GDIMAGE:METHODInputJpeg( nHandle, nSize )
   METHOD InputJpeg( nHandle, nSize )      INLINE ::pImage := gdImageCreateFromJpeg( nHandle, nSize ), IIF( ::pImage != NIL, Self, NIL )
gdimage.prg104
GDIMAGE:METHODInputWBmp( nHandle, nSize )
   METHOD InputWBmp( nHandle, nSize )      INLINE ::pImage := gdImageCreateFromWBMP( nHandle, nSize ), IIF( ::pImage != NIL, Self, NIL )
gdimage.prg105
GDIMAGE:METHODInputGd( nHandle, nSize )
   METHOD InputGd( nHandle, nSize )        INLINE ::pImage := gdImageCreateFromGD( nHandle, nSize )  , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg106
GDIMAGE:METHODInputGif( nHandle, nSize )
   METHOD InputGif( nHandle, nSize )       INLINE ::pImage := gdImageCreateFromGif( nHandle, nSize ) , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg107
GDIMAGE:METHODCreateFromPng( pImage, nSize )
   METHOD CreateFromPng( pImage, nSize )   INLINE ::pImage := gdImageCreateFromPng( pImage, nSize )  , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg110
GDIMAGE:METHODCreateFromJpeg( pImage, nSize )
   METHOD CreateFromJpeg( pImage, nSize )  INLINE ::pImage := gdImageCreateFromJpeg( pImage, nSize ) , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg111
GDIMAGE:METHODCreateFromWBmp( pImage, nSize )
   METHOD CreateFromWBmp( pImage, nSize )  INLINE ::pImage := gdImageCreateFromWBMP( pImage, nSize ) , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg112
GDIMAGE:METHODCreateFromGd( pImage, nSize )
   METHOD CreateFromGd( pImage, nSize )    INLINE ::pImage := gdImageCreateFromGD( pImage, nSize )   , IIF( ::pImage != NIL, Self, NIL )
gdimage.prg113
GDIMAGE:METHODCreateFromGif( pImage, nSize )
   METHOD CreateFromGif( pImage, nSize )   INLINE ::pImage := gdImageCreateFromGif( pImage, nSize )  , IIF( ::pImage != NIL, Self, NIL )

   METHOD LoadFromFile( cFile )
gdimage.prg114
GDIMAGE:METHODSavePng( cFile, nLevel )
   METHOD SavePng( cFile, nLevel )         INLINE gdImagePng( ::pImage, cFile, nLevel )
gdimage.prg119
GDIMAGE:METHODSaveJpeg( cFile, nLevel )
   METHOD SaveJpeg( cFile, nLevel )        INLINE gdImageJpeg( ::pImage, cFile, nLevel )
gdimage.prg120
GDIMAGE:METHODSaveWBmp( cFile, nFG )
   METHOD SaveWBmp( cFile, nFG )           INLINE gdImageWBmp( ::pImage, cFile, nFG )
gdimage.prg121
GDIMAGE:METHODSaveGd( cFile )
   METHOD SaveGd( cFile )                  INLINE gdImageGd( ::pImage, cFile )
gdimage.prg122
GDIMAGE:METHODSaveGif( cFile )
   METHOD SaveGif( cFile )                 INLINE gdImageGif( ::pImage, cFile )
gdimage.prg123
GDIMAGE:METHODSaveToFile( cFile )
   METHOD SaveToFile( cFile )              INLINE gdImageToFile( Self, cFile )
gdimage.prg125
GDIMAGE:METHODOutputPng( nHandle, nLevel )
   METHOD OutputPng( nHandle, nLevel )     INLINE IIF( nHandle == NIL, nHandle := 1, ), gdImagePng( ::pImage, nHandle, nLevel )
gdimage.prg128
GDIMAGE:METHODOutputJpeg( nHandle, nLevel )
   METHOD OutputJpeg( nHandle, nLevel )    INLINE IIF( nHandle == NIL, nHandle := 1, ), gdImageJpeg( ::pImage, nHandle, nLevel )
gdimage.prg129
GDIMAGE:METHODOutputWBmp( nHandle, nFG )
   METHOD OutputWBmp( nHandle, nFG )       INLINE IIF( nHandle == NIL, nHandle := 1, ), gdImageWBmp( ::pImage, nHandle, nFG )
gdimage.prg130
GDIMAGE:METHODOutputGd( nHandle )
   METHOD OutputGd( nHandle )              INLINE IIF( nHandle == NIL, nHandle := 1, ), gdImageGd( ::pImage, nHandle )
gdimage.prg131
GDIMAGE:METHODOutputGif( nHandle )
   METHOD OutputGif( nHandle )             INLINE IIF( nHandle == NIL, nHandle := 1, ), gdImageGif( ::pImage, nHandle )
gdimage.prg132
GDIMAGE:METHODOutput( nHandle )
   METHOD Output( nHandle )                INLINE gdImageToHandle( ::pImage, nHandle )
gdimage.prg134
GDIMAGE:METHODToStringPng( nLevel )
   METHOD ToStringPng( nLevel )            INLINE gdImagePng( ::pImage, NIL, nLevel )
gdimage.prg137
GDIMAGE:METHODToStringJpeg( nLevel )
   METHOD ToStringJpeg( nLevel )           INLINE gdImageJpeg( ::pImage, NIL, nLevel )
gdimage.prg138
GDIMAGE:METHODToStringWBmp( nFG )
   METHOD ToStringWBmp( nFG )              INLINE gdImageWBmp( ::pImage, NIL, nFG )
gdimage.prg139
GDIMAGE:METHODToStringGd()
   METHOD ToStringGd()                     INLINE gdImageGd( ::pImage, NIL )
gdimage.prg140
GDIMAGE:METHODToStringGif()
   METHOD ToStringGif()                    INLINE gdImageGif( ::pImage, NIL )
gdimage.prg141
GDIMAGE:METHODToString()
   METHOD ToString()                       INLINE gdImageToString( Self )
gdimage.prg143
GDIMAGE:METHODDestroy()
   METHOD Destroy()                        INLINE gdImageDestroy( ::pImage )
   DESTRUCTOR Destruct()
gdimage.prg146
GDIMAGE:METHODSetPixel( x, y, color )
   METHOD SetPixel( x, y, color )          INLINE DEFAULT( color, ::pColor ), gdImageSetPixel( ::pImage, x, y, color )
gdimage.prg152
GDIMAGE:METHODLine( x1, y1, x2, y2, color )
   METHOD Line( x1, y1, x2, y2, color )    INLINE DEFAULT( color, ::pColor ), gdImageLine( ::pImage, x1, y1, x2, y2, color )
gdimage.prg153
GDIMAGE:METHODDashedLine( x1, y1, x2, y2, color )
   METHOD DashedLine( x1, y1, x2, y2, color )    INLINE DEFAULT( color, ::pColor ), gdImageDashedLine( ::pImage, x1, y1, x2, y2, color )

   // Functions usefull for polygons
   METHOD Polygon( aPoints, lFilled, color )
#if ( GD_VERS >= 2033 )
   METHOD OpenPolygon( aPoints, color )
gdimage.prg154
GDIMAGE:METHODAddPoint( x, y )
   METHOD AddPoint( x, y )                 INLINE aAdd( ::aPoints, { x, y } )
gdimage.prg161
GDIMAGE:METHODResetPoints()
   METHOD ResetPoints()                    INLINE ::aPoints := {}
gdimage.prg162
GDIMAGE:METHODPoints()
   METHOD Points()                         INLINE Len( ::aPoints )

   METHOD Rectangle( x1, y1, x2, y2, lFilled, color )
   METHOD Arc( x, y, nWidth, nHeight, nStartDegree, nEndDegree, lFilled, nColor )
   METHOD Ellipse( x, y, nWidth, nHeight, lFilled, nColor )
gdimage.prg163
GDIMAGE:METHODCircle( x, y, nRadius, lFilled, nColor )
   METHOD Circle( x, y, nRadius, lFilled, nColor ) ;
                                           INLINE ::Ellipse( x, y, nRadius, nRadius, lFilled, nColor )
gdimage.prg168
GDIMAGE:METHODFill( x, y, color )
   METHOD Fill( x, y, color )              INLINE DEFAULT( color, ::pColor ), gdImageFill( ::pImage, x, y, color )
gdimage.prg171
GDIMAGE:METHODFillToBorder( x, y, border, color )
   METHOD FillToBorder( x, y, border, color ) ;
                                           INLINE DEFAULT( color, ::pColor ), gdImageFillToBorder( ::pImage, x, y, border, color )
gdimage.prg172
GDIMAGE:METHODSetAntiAliased( color )
   METHOD SetAntiAliased( color )          INLINE DEFAULT( color, ::pColor ), gdImageSetAntiAliased( ::pImage, color )
gdimage.prg174
GDIMAGE:METHODSetAntiAliasedDontBlend( lDontBlend, color )
   METHOD SetAntiAliasedDontBlend( lDontBlend, color ) ;
                                           INLINE DEFAULT( color, ::pColor ), gdImageSetAntiAliasedDontBlend( ::pImage, color, lDontBlend )
gdimage.prg175
GDIMAGE:METHODSetBrush( pBrush )
   METHOD SetBrush( pBrush )               INLINE gdImageSetBrush( ::pImage, pBrush:pImage ), ::pBrush := pBrush
gdimage.prg178
GDIMAGE:METHODSetTile( pTile )
   METHOD SetTile( pTile )                 INLINE gdImageSetTile( ::pImage, pTile:pImage ), ::pTile := pTile
gdimage.prg179
GDIMAGE:METHODSetStyle( aStyle )
   METHOD SetStyle( aStyle )               INLINE DEFAULT( aStyle, ::aStyles ), gdImageSetStyle( ::pImage, aStyle )
gdimage.prg182
GDIMAGE:METHODAddStyle( pColor )
   METHOD AddStyle( pColor )               INLINE aAdd( ::aStyles, pColor )
gdimage.prg183
GDIMAGE:METHODResetStyles()
   METHOD ResetStyles()                    INLINE ::aStyles := {}
gdimage.prg184
GDIMAGE:METHODStyleLenght()
   METHOD StyleLenght()                    INLINE Len( ::aStyles )
gdimage.prg185
GDIMAGE:METHODSetThickness( nThickness )
   METHOD SetThickness( nThickness )       INLINE gdImageSetThickness( ::pImage, nThickness )
gdimage.prg187
GDIMAGE:METHODSetAlphaBlending( lAlphaBlending )
   METHOD SetAlphaBlending( lAlphaBlending )  INLINE gdImageAlphaBlending( ::pImage, lAlphaBlending )
gdimage.prg188
GDIMAGE:METHODSetSaveAlpha( lSaveAlpha )
   METHOD SetSaveAlpha( lSaveAlpha )       INLINE gdImageSaveAlpha( ::pImage, lSaveAlpha )
gdimage.prg189
GDIMAGE:METHODSetClippingArea( x1, y1, x2, y2 )
   METHOD SetClippingArea( x1, y1, x2, y2 )   INLINE gdImageSetClip( ::pImage, x1, y1, x2, y2 )
gdimage.prg190
GDIMAGE:METHODColorsTotal()
   METHOD ColorsTotal()                    INLINE gdImageColorsTotal( ::pImage )
gdimage.prg193
GDIMAGE:METHODAlpha( color )
   METHOD Alpha( color )                   INLINE DEFAULT( color, ::pColor ), gdImageAlpha( ::pImage, color )
gdimage.prg194
GDIMAGE:METHODRed( color )
   METHOD Red( color )                     INLINE DEFAULT( color, ::pColor ), gdImageRed( ::pImage, color )
gdimage.prg195
GDIMAGE:METHODGreen( color )
   METHOD Green( color )                   INLINE DEFAULT( color, ::pColor ), gdImageGreen( ::pImage, color )
gdimage.prg196
GDIMAGE:METHODBlue( color )
   METHOD Blue( color )                    INLINE DEFAULT( color, ::pColor ), gdImageBlue( ::pImage, color )
gdimage.prg197
GDIMAGE:METHODWidth()
   METHOD Width()                          INLINE gdImageSx( ::pImage )
gdimage.prg198
GDIMAGE:METHODHeight()
   METHOD Height()                         INLINE gdImageSy( ::pImage )
gdimage.prg199
GDIMAGE:METHODCenterWidth()
   METHOD CenterWidth()                    INLINE ::Width() / 2
gdimage.prg200
GDIMAGE:METHODCenterHeight()
   METHOD CenterHeight()                   INLINE ::Height() / 2
gdimage.prg201
GDIMAGE:METHODGetPixel( x, y )
   METHOD GetPixel( x, y )                 INLINE gdImageGetPixel( ::pImage, x, y )
gdimage.prg202
GDIMAGE:METHODGetColor()
   METHOD GetColor()                       INLINE ::pColor
gdimage.prg203
GDIMAGE:METHODGetImagePtr()
   METHOD GetImagePtr()                    INLINE ::pImage
gdimage.prg204
GDIMAGE:METHODGetClippingArea()
   METHOD GetClippingArea()                INLINE gdImageGetClip( ::pImage )
gdimage.prg205
GDIMAGE:METHODIsBoundsSafe( x, y )
   METHOD IsBoundsSafe( x, y )             INLINE gdImageBoundsSafe( ::pImage, x, y )
gdimage.prg206
GDIMAGE:METHODIsInterlaced()
   METHOD IsInterlaced()                   INLINE gdImageGetInterlaced( ::pImage )
gdimage.prg207
GDIMAGE:METHODGetTransparent()
   METHOD GetTransparent()                 INLINE gdImageGetTransparent( ::pImage )
gdimage.prg208
GDIMAGE:METHODIsTransparent()
   METHOD IsTransparent()                  INLINE ::GetTransparent() > 0
gdimage.prg209
GDIMAGE:METHODIsTrueColor()
   METHOD IsTrueColor()                    INLINE gdImageTrueColor( ::pImage )
gdimage.prg210
GDIMAGE:METHODConvertFromTrueColorToPalette( lDither, nColorsWanted )
   METHOD ConvertFromTrueColorToPalette( lDither, nColorsWanted ) ;
                                           INLINE gdImageTrueColorToPalette ( ::pImage, lDither, nColorsWanted )
gdimage.prg212
GDIMAGE:METHODCreatePaletteFromTrueColor( lDither, nColorsWanted )
   METHOD CreatePaletteFromTrueColor( lDither, nColorsWanted ) ;
                                           INLINE gdImageCreatePaletteFromTrueColor( ::pImage, lDither, nColorsWanted )
gdimage.prg214
GDIMAGE:METHODGetPalette( x, y )
   METHOD GetPalette( x, y )               INLINE gdImagePalettePixel( ::pImage, x, y )
gdimage.prg216
GDIMAGE:METHODGetTrueColor( x, y )
   METHOD GetTrueColor( x, y )             INLINE gdImageTrueColorPixel( ::pImage, x, y )
gdimage.prg217
GDIMAGE:METHODGetThickness()
   METHOD GetThickness()                   INLINE gdImageGetThickness( ::pImage )
gdimage.prg218
GDIMAGE:METHODSetFontSmall()
   METHOD SetFontSmall()                   INLINE ::pFont := gdFontGetSmall()
gdimage.prg221
GDIMAGE:METHODSetFontLarge()
   METHOD SetFontLarge()                   INLINE ::pFont := gdFontGetLarge()
gdimage.prg222
GDIMAGE:METHODSetFontMediumBold()
   METHOD SetFontMediumBold()              INLINE ::pFont := gdFontGetMediumBold()
gdimage.prg223
GDIMAGE:METHODSetFontGiant()
   METHOD SetFontGiant()                   INLINE ::pFont := gdFontGetGiant()
gdimage.prg224
GDIMAGE:METHODSetFontTiny()
   METHOD SetFontTiny()                    INLINE ::pFont := gdFontGetTiny()
   METHOD Say( x, y, cString, color, nAlign )
gdimage.prg225
GDIMAGE:METHODSayVertical( x, y, cString, color )
   METHOD SayVertical( x, y, cString, color )  INLINE DEFAULT( color, ::pColor ), gdImageStringUp( ::pImage, ::pFont, x, y, cString, color )
gdimage.prg227
GDIMAGE:METHODSetFontName( cFontName )
   METHOD SetFontName( cFontName )         INLINE ::cFontName  := cFontName
gdimage.prg229
GDIMAGE:METHODSetFontPitch( nPitch )
   METHOD SetFontPitch( nPitch )           INLINE ::nFontPitch := nPitch
gdimage.prg230
GDIMAGE:METHODSetFontAngle( nAngle )
   METHOD SetFontAngle( nAngle )           INLINE ::nFontAngle := nAngle
   METHOD SayFreeType( x, y, cString, cFontName, nPitch, nAngle, color, nAlign, ;
                       nLineSpacing, nCharMap, nResolution )
gdimage.prg231
GDIMAGE:METHODSayFreeTypeCircle( x, y, cStringTop, cStringBottom, color, nRadius, nTextRadius, nFillPortion, cFontName, nPitch )
   METHOD SayFreeTypeCircle( x, y, cStringTop, cStringBottom, color, nRadius, nTextRadius, nFillPortion, cFontName, nPitch ) ;
                                           INLINE DEFAULT( color, ::pColor ), gdImageStringFTCircle( ::pImage, x, y, nRadius, ;
                                                           nTextRadius, nFillPortion, cFontName, nPitch, cStringTop, cStringBottom, color )
gdimage.prg235
GDIMAGE:METHODGetFont()
   METHOD GetFont()                        INLINE ::pFont
gdimage.prg239
GDIMAGE:METHODGetFontWidth( pFont )
   METHOD GetFontWidth( pFont )            INLINE DEFAULT( pFont, ::pFont ), gdFontGetWidth( pFont )
gdimage.prg240
GDIMAGE:METHODGetFontHeight( pFont )
   METHOD GetFontHeight( pFont )           INLINE DEFAULT( pFont, ::pFont ), gdFontGetHeight( pFont )
gdimage.prg241
GDIMAGE:METHODGetFTFontWidth( cFontName, nPitch )
   METHOD GetFTFontWidth( cFontName, nPitch )  INLINE DEFAULT( cFontName, ::cFontName ), ;
                                                      DEFAULT( nPitch, ::nFontPitch )  , ;
                                                      gdImageFTWidth( cFontName, nPitch )
gdimage.prg243
GDIMAGE:METHODGetFTFontHeight( cFontName, nPitch )
   METHOD GetFTFontHeight( cFontName, nPitch ) INLINE DEFAULT( cFontName, ::cFontName ), ;
                                                      DEFAULT( nPitch, ::nFontPitch )  , ;
                                                      gdImageFTHeight( cFontName, nPitch )
gdimage.prg247
GDIMAGE:METHODGetFTStringSize( cString, cFontName, nPitch )
   METHOD GetFTStringSize( cString, cFontName, nPitch ) INLINE DEFAULT( cFontName, ::cFontName ), ;
                                                      DEFAULT( nPitch, ::nFontPitch )  , ;
                                                      gdImageFTSize( cString, cFontName, nPitch )
gdimage.prg251
GDIMAGE:METHODSetColor( r, g, b )
   METHOD SetColor( r, g, b )              INLINE IIF( PCount() == 2, ::pColor := r, ::pColor := gdImageColorAllocate( ::pImage, r, g, b ) )
gdimage.prg256
GDIMAGE:METHODDelColor( pColor )
   METHOD DelColor( pColor )               INLINE ::pColor := NIL, gdImageColorDeAllocate( ::pImage, pColor )
gdimage.prg257
GDIMAGE:METHODSetColorAlpha( r, g, b, a )
   METHOD SetColorAlpha( r, g, b, a )      INLINE ::pColor := gdImageColorAllocateAlpha( ::pImage, r, g, b, a)
gdimage.prg258
GDIMAGE:METHODSetColorClosest( r, g, b )
   METHOD SetColorClosest( r, g, b )       INLINE ::pColor := gdImageColorClosest( ::pImage, r, g, b )
gdimage.prg259
GDIMAGE:METHODSetColorClosestAlpha( r, g, b, a )
   METHOD SetColorClosestAlpha( r, g, b, a ) INLINE ::pColor := gdImageColorClosestAlpha( ::pImage, r, g, b, a)
gdimage.prg260
GDIMAGE:METHODSetColorClosestHWB( r, g, b )
   METHOD SetColorClosestHWB( r, g, b )    INLINE ::pColor := gdImageColorClosestHWB( ::pImage, r, g, b )
gdimage.prg261
GDIMAGE:METHODSetColorExact( r, g, b )
   METHOD SetColorExact( r, g, b )         INLINE ::pColor := gdImageColorExact( ::pImage, r, g, b )
gdimage.prg262
GDIMAGE:METHODSetColorResolve( r, g, b )
   METHOD SetColorResolve( r, g, b )       INLINE ::pColor := gdImageColorResolve( ::pImage, r, g, b )
gdimage.prg263
GDIMAGE:METHODSetColorResolveAlpha( r, g, b, a )
   METHOD SetColorResolveAlpha( r, g, b, a ) INLINE ::pColor := gdImageColorResolveAlpha( ::pImage, r, g, b, a)
gdimage.prg264
GDIMAGE:METHODSetTransparent( pColor )
   METHOD SetTransparent( pColor )         INLINE gdImageColorTransparent( ::pImage, pColor )
gdimage.prg265
GDIMAGE:METHODSetSharpen( nPerc )
   METHOD SetSharpen( nPerc )              INLINE gdImageSharpen( ::pImage, nPerc )
gdimage.prg266
GDIMAGE:METHODSetInterlace( lOnOff )
   METHOD SetInterlace( lOnOff )           INLINE gdImageInterlace( ::pImage, lOnOff )
gdimage.prg267
GDIMAGE:METHODSetInterlaceOn()
   METHOD SetInterlaceOn()                 INLINE gdImageInterlace( ::pImage, TRUE )
gdimage.prg268
GDIMAGE:METHODSetInterlaceOff()
   METHOD SetInterlaceOff()                INLINE gdImageInterlace( ::pImage, FALSE )

   /* COPY AND RESIZING FUNCTIONS */
   METHOD Copy()
   METHOD CopyResized()
   METHOD CopyResampled()
   METHOD CopyRotated()
   METHOD CopyMerge()
   METHOD CopyMergeGray()

   /* New implemented */
   METHOD Clone()
   METHOD CopyZoomed()
   METHOD Crop()
   METHOD Zoom()
   METHOD Resize()
   METHOD Rotate()
gdimage.prg269
GDIMAGE:METHODRotateInside( nAngle )
   METHOD RotateInside( nAngle )           INLINE ::Rotate( nAngle, .T. )
gdimage.prg286
GDIMAGE:METHODPaletteCopy( oDestImage )
   METHOD PaletteCopy( oDestImage )        INLINE gdImagePaletteCopy( oDestImage:pImage, ::pImage )
gdimage.prg288
GDIMAGE:METHODSquareToCircle( nRadius )
   METHOD SquareToCircle( nRadius )        INLINE gdImageSquareToCircle( ::pImage, nRadius )
gdimage.prg289
GDIMAGE:METHODCompare( oDestImage )
   METHOD Compare( oDestImage )            INLINE gdImageCompare( oDestImage:pImage, ::pImage )
gdimage.prg290
GDIMAGE:METHODRadians( nAngle )
   METHOD Radians( nAngle )                INLINE PI() * nAngle / 180
gdimage.prg293
GDIMAGE:METHODDegres( nRadians )
   METHOD Degres( nRadians )               INLINE nRadians * 180 / PI()
gdimage.prg294
GDIMAGE:METHODVersion()
   METHOD Version()                        INLINE gdVersion()

   PROTECTED:
   METHOD CloneDataFrom()

ENDCLASS
gdimage.prg296
GDIMAGE:METHODNew( sx, sy ) CLASS GDImage
METHOD New( sx, sy ) CLASS GDImage
   ::Create( sx, sy )
RETURN Self
gdimage.prg303
PROCEDUREDestruct() CLASS GDImage
PROCEDURE Destruct() CLASS GDImage
  //__OutDebug( "Destroyed" )
  IF ::lDestroy
     ::Destroy()
  ENDIF
RETURN
gdimage.prg307
GDIMAGE:METHODPolygon( aPoints, lFilled, color ) CLASS GDImage
METHOD Polygon( aPoints, lFilled, color ) CLASS GDImage
  DEFAULT aPoints TO ::aPoints
  DEFAULT lFilled TO FALSE
  DEFAULT color   TO ::pColor
  IF lFilled
     gdImageFilledPolygon( ::pImage, aPoints, color )
  ELSE
     gdImagePolygon( ::pImage, aPoints, color )
  ENDIF
RETURN Self
gdimage.prg314
GDIMAGE:METHODOpenPolygon( aPoints, color ) CLASS GDImage
METHOD OpenPolygon( aPoints, color ) CLASS GDImage
  DEFAULT aPoints TO ::aPoints
  DEFAULT color   TO ::pColor
  gdImageOpenPolygon( ::pImage, aPoints, color )
RETURN Self
gdimage.prg326
GDIMAGE:METHODRectangle( x1, y1, x2, y2, lFilled, color ) CLASS GDImage
METHOD Rectangle( x1, y1, x2, y2, lFilled, color ) CLASS GDImage
  DEFAULT lFilled TO FALSE
  DEFAULT color   TO ::pColor
  IF lFilled
     gdImageFilledRectangle( ::pImage, x1, y1, x2, y2, color )
  ELSE
     gdImageRectangle( ::pImage, x1, y1, x2, y2, color )
  ENDIF
RETURN Self
gdimage.prg333
GDIMAGE:METHODArc( x, y, nWidth, nHeight, nStartDegree, nEndDegree, lFilled, color, nStyle ) CLASS GDImage
METHOD Arc( x, y, nWidth, nHeight, nStartDegree, nEndDegree, lFilled, color, nStyle ) CLASS GDImage
  DEFAULT lFilled TO FALSE
  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
gdimage.prg343
GDIMAGE:METHODEllipse( x, y, nWidth, nHeight, lFilled, color ) CLASS GDImage
METHOD Ellipse( x, y, nWidth, nHeight, lFilled, color ) CLASS GDImage
  DEFAULT lFilled TO FALSE
  DEFAULT color   TO ::pColor
  IF lFilled
     gdImageFilledEllipse( ::pImage, x, y, nWidth, nHeight, color )
  ELSE
     gdImageEllipse( ::pImage, x, y, nWidth, nHeight, color )
  ENDIF
RETURN Self
gdimage.prg354
GDIMAGE:METHODLoadFromFile( cFile ) CLASS GDImage
METHOD LoadFromFile( cFile ) CLASS GDImage
   LOCAL aLoad
   aLoad := gdImageFromFile( cFile )
   //Self  := aLoad[1]:Clone()
   ::Destroy()
   Self := ::CloneDataFrom( aLoad[1] )
   //Self := __objClone( aLoad[1] )
   aLoad[1]:lDestroy := FALSE
   aLoad[1] := NIL

   ::hFile := aLoad[2]
   ::cType := aLoad[3]
   ::cMime := aLoad[4]
RETURN Self
gdimage.prg364
GDIMAGE:METHODCopy( nSrcX, nSrcY, nWidth, nHeight, nDstX, nDstY, oDestImage ) CLASS GDImage
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

  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
gdimage.prg379
GDIMAGE:METHODCopyResized( nSrcX, nSrcY, nSrcWidth, nSrcHeight, nDstX, nDstY, nDstWidth, nDstHeight, oDestImage ) CLASS GDImage
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()

  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
gdimage.prg398
GDIMAGE:METHODCopyResampled( nSrcX, nSrcY, nSrcWidth, nSrcHeight, nDstX, nDstY, nDstWidth, nDstHeight, oDestImage ) CLASS GDImage
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()

  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
gdimage.prg418
GDIMAGE:METHODCopyRotated( nSrcX, nSrcY, nWidth, nHeight, nDstX, nDstY, nAngle, oDestImage ) CLASS GDImage
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

  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
gdimage.prg438
GDIMAGE:METHODCopyMerge( nSrcX, nSrcY, nWidth, nHeight, nDstX, nDstY, nPerc, oDestImage ) CLASS GDImage
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

  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
gdimage.prg458
GDIMAGE:METHODCopyMergeGray( nSrcX, nSrcY, nWidth, nHeight, nDstX, nDstY, nPerc, oDestImage ) CLASS GDImage
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

  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
gdimage.prg477
GDIMAGE:METHODCopyZoomed( nPerc, nSrcX, nSrcY, nSrcWidth, nSrcHeight ) CLASS GDImage
METHOD CopyZoomed( nPerc, nSrcX, nSrcY, nSrcWidth, nSrcHeight ) CLASS GDImage
  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()

  IF nPerc < 0
     nPerc := 100
  ENDIF

  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 )

RETURN oDestImage
gdimage.prg496
GDIMAGE:METHODRotate( nAngle, lInside ) CLASS GDImage
METHOD Rotate( nAngle, lInside ) CLASS GDImage
  LOCAL oDestImage
  LOCAL nWidth, nHeight
  LOCAL nAngRad := nAngle * PI() / 180

  DEFAULT lInside TO FALSE

  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

  // Move new image to existing one
  // Signal that this image must not be destroyed
  oDestImage:lDestroy := FALSE
  oDestImage := NIL

RETURN Self
gdimage.prg524
GDIMAGE:METHODCrop( nX, nY, nWidth, nHeight ) CLASS GDImage
METHOD Crop( nX, nY, nWidth, nHeight ) CLASS GDImage
  LOCAL oDestImage

  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 := FALSE
  oDestImage := NIL

RETURN Self
gdimage.prg562
GDIMAGE:METHODResize( nWidth, nHeight ) CLASS GDImage
METHOD Resize( nWidth, nHeight ) CLASS GDImage
  LOCAL oDestImage

  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 := FALSE
  oDestImage := NIL

RETURN Self
gdimage.prg577
GDIMAGE:METHODZoom( nPerc ) CLASS GDImage
METHOD Zoom( nPerc ) CLASS GDImage
  LOCAL oDestImage

  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 := FALSE
  oDestImage := NIL

RETURN Self
gdimage.prg592
GDIMAGE:METHODClone() CLASS GDImage
METHOD Clone() CLASS GDImage
  LOCAL oDestImage
  LOCAL pImage

  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
  //// Signal that this image must not be destroyed
  //oDestImage:lDestroy := FALSE
  //oDestImage := NIL
  //oDestImage:pImage := pImage

RETURN oDestImage
gdimage.prg607
GDIMAGE:METHODSay( x, y, cString, color, nAlign ) CLASS GDImage
METHOD Say( x, y, cString, color, nAlign ) CLASS GDImage
  LOCAL nWidth, nLen
  LOCAL nPosX

  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

  gdImageString( ::pImage, ::pFont, nPosX, y, cString, color )
RETURN Self
gdimage.prg632
GDIMAGE:METHODSayFreeType( x, y, cString, cFontName, nPitch, nAngle, color, nAlign, nLineSpacing, nCharMap, nResolution ) CLASS GDImage
METHOD SayFreeType( x, y, cString, cFontName, nPitch, nAngle, color, nAlign, ;
                    nLineSpacing, nCharMap, nResolution )  CLASS GDImage
  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

  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 )

RETURN Self
gdimage.prg654
GDIMAGE:METHODCloneDataFrom( oSrc )
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
gdimage.prg683

Page url: http://www.yourdomain.com/help/index.html?hbgd.htm