GD
view release on metacpan or search on metacpan
#ifdef PERL_CAPI
#define WIN32IO_IS_STDIO
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <gd.h>
#include <gdfontg.h>
#include <gdfontl.h>
#include <gdfontmb.h>
#include <gdfonts.h>
#include <gdfontt.h>
#include <errno.h>
/* no xbm writer, no gdImageXbmPtr() */
/* 2.0.x: < 2.1.0-alpha */
#ifndef GD_VERSION_STRING
# if defined(GD2_VERS) && (GD2_VERS==2)
# ifdef VERSION_33
# define GD_VERSION 20033
# define GD_VERSION_STRING "2.0.33"
# else
# define GD_VERSION 20032
# define GD_VERSION_STRING "2.0.x"
# endif
# else
# define GD_VERSION 10000
# define GD_VERSION_STRING "?"
# endif
#else
# define GD_VERSION ((GD_MAJOR_VERSION * 10000) +\
(GD_MINOR_VERSION * 100) +\
GD_RELEASE_VERSION)
#endif
/* libgd implements and exports gdImageBoundsSafe() (gd.c), but at least the
* 2.4.0 gd.h no longer declares it publicly (gdImageBoundsSafeMacro in
* gd_intern.h is internal-only). Redeclare it here; this is harmless even
* against a gd.h that does declare it, since the signature is identical. */
#if GD_VERSION >= 20400
extern int gdImageBoundsSafe(gdImagePtr im, int x, int y);
#endif
/* gdPaletteQuantizationMethod and gdUhdrFormat are plain C enums, not
* preprocessor macros, so the #ifdef checks generated by ExtUtils::Constant
* would never see them. Paint them blue with harmless self-referential
* macros so #ifdef succeeds while the enumerator value still resolves
* normally when the macro is expanded. Do NOT do this for names libgd
* already #defines (e.g. GD_UHDR_SUCCESS) - that would hide their numeric
* value behind an unresolvable self-reference. */
#ifdef HAVE_IMAGEQUANT
# define GD_QUANT_DEFAULT GD_QUANT_DEFAULT
# define GD_QUANT_JQUANT GD_QUANT_JQUANT
# define GD_QUANT_NEUQUANT GD_QUANT_NEUQUANT
# define GD_QUANT_LIQ GD_QUANT_LIQ
#endif
#ifdef HAVE_UHDR
# define GD_UHDR_FORMAT_JPEG GD_UHDR_FORMAT_JPEG
# define GD_UHDR_FORMAT_WEBP GD_UHDR_FORMAT_WEBP
# define GD_UHDR_FORMAT_HEIF GD_UHDR_FORMAT_HEIF
#endif
/* gdAffineStandardMatrix (libgd >= 2.1.0) is the same story: a plain
* enum, never itself passed to any gd function, but documented as the
* index into a 6-element affine[] array for each named component. */
#if GD_VERSION >= 20100
# define GD_AFFINE_TRANSLATE GD_AFFINE_TRANSLATE
# define GD_AFFINE_SCALE GD_AFFINE_SCALE
# define GD_AFFINE_ROTATE GD_AFFINE_ROTATE
# define GD_AFFINE_SHEAR_HORIZONTAL GD_AFFINE_SHEAR_HORIZONTAL
# define GD_AFFINE_SHEAR_VERTICAL GD_AFFINE_SHEAR_VERTICAL
#endif
/* gdCropMode (libgd >= 2.1.0) is a plain enum too; gdImageCropAuto()
* takes its value as a plain unsigned int parameter. */
#if GD_VERSION >= 20100
# define GD_CROP_DEFAULT GD_CROP_DEFAULT
# define GD_CROP_TRANSPARENT GD_CROP_TRANSPARENT
# define GD_CROP_BLACK GD_CROP_BLACK
# define GD_CROP_WHITE GD_CROP_WHITE
# define GD_CROP_SIDES GD_CROP_SIDES
# define GD_CROP_THRESHOLD GD_CROP_THRESHOLD
#endif
/* gdTiffColorSpace/gdTiffCompression/gdTiffResolutionUnit/gdTiffAlphaType
* (libgd >= 2.4.0) are plain enums too, used as plain int fields in
* gdTiffWriteOptions. */
#if GD_VERSION >= 20400 && defined(HAVE_TIFF)
# define GD_TIFF_RGB GD_TIFF_RGB
# define GD_TIFF_RGBA GD_TIFF_RGBA
# define GD_TIFF_GRAY GD_TIFF_GRAY
# define GD_TIFF_BILEVEL GD_TIFF_BILEVEL
# define GD_TIFF_COMPRESSION_NONE GD_TIFF_COMPRESSION_NONE
# define GD_TIFF_COMPRESSION_CCITT_RLE GD_TIFF_COMPRESSION_CCITT_RLE
# define GD_TIFF_COMPRESSION_CCITT_FAX3 GD_TIFF_COMPRESSION_CCITT_FAX3
# define GD_TIFF_COMPRESSION_CCITT_FAX4 GD_TIFF_COMPRESSION_CCITT_FAX4
# define GD_TIFF_COMPRESSION_LZW GD_TIFF_COMPRESSION_LZW
# define GD_TIFF_COMPRESSION_JPEG GD_TIFF_COMPRESSION_JPEG
# define GD_TIFF_COMPRESSION_ADOBE_DEFLATE GD_TIFF_COMPRESSION_ADOBE_DEFLATE
# define GD_TIFF_COMPRESSION_DEFLATE GD_TIFF_COMPRESSION_DEFLATE
( run in 1.598 second using v1.01-cache-2.11-cpan-1236ad508bc )