gd.h

Summary
gd.h
Transform
gdInterpolationMethod
Types
gdImage
gdImagePtrThe data structure in which gd stores images.
Types
gdPointFDefines a point in a 2D coordinate system using floating point values.
gdPointFPtrPointer to a gdPointF
Types
gdFont
gdFontPtrA font structure, containing the bitmaps of all characters in a font.
Types
gdSource
gdSourcePtrNote: This interface is obsolete and kept only for *compatibility.
Types
gdFTStringExtra
gdFTStringExtraPtrA structure and associated pointer type used to pass additional parameters to the gdImageStringFTEx function.
Types
gdPoint
gdPointPtrRepresents a point in the coordinate space of the image; used by <gdImagePolygon>, <gdImageOpenPolygon> and <gdImageFilledPolygon> for polygon drawing.
GifAnimLegal values for Disposal.
gdImageGifAnim
Types
gdSink
gdSinkPtrNote: This interface is obsolete and kept only for *compatibility.
Crop
gdCropMode

Transform

gdInterpolationMethod

GD_BELLBell
GD_BESSELBessel
GD_BILINEAR_FIXEDfixed point bilinear
GD_BICUBICBicubic
GD_BICUBIC_FIXEDfixed point bicubic integer
GD_BLACKMANBlackman
GD_BOXBox
GD_BSPLINEBSpline
GD_CATMULLROMCatmullrom
GD_GAUSSIANGaussian
GD_GENERALIZED_CUBICGeneralized cubic
GD_HERMITEHermite
GD_HAMMINGHamming
GD_HANNINGHannig
GD_MITCHELLMitchell
GD_NEAREST_NEIGHBOURNearest neighbour interpolation
GD_POWERPower
GD_QUADRATICQuadratic
GD_SINCSinc
GD_TRIANGLETriangle
GD_WEIGHTED44 pixels weighted bilinear interpolation

See also

<gdSetInterpolationMethod>

Types

gdImage

gdImagePtr

The data structure in which gd stores images.  gdImageCreate, gdImageCreateTrueColor and the various image file-loading functions return a pointer to this type, and the other functions expect to receive a pointer to this type as their first argument.

gdImagePtr is a pointer to gdImage.

(Previous versions of this library encouraged directly manipulating the contents ofthe struct but we are attempting to move away from this practice so the fields are no longer documented here.  If you need to poke at the internals of this struct, feel free to look at gd.h.)

Types

gdPointF

Defines a point in a 2D coordinate system using floating point values. x - Floating point position (increase from left to right) y - Floating point Row position (increase from top to bottom)

gdPointFPtr

Types

gdFont

gdFontPtr

A font structure, containing the bitmaps of all characters in a font.  Used to declare the characteristics of a font.  Text-output functions expect these as their second argument, following the gdImagePtr argument.  <gdFontSmall> and <gdFontGetLarge> both return one.

You can provide your own font data by providing such a structure and the associated pixel array.  You can determine the width and height of a single character in a font by examining the w and h members of the structure.  If you will not be creating your own fonts, you will not need to concern yourself with the rest of the components of this structure.

Please see the files gdfontl.c and gdfontl.h for an example of the proper declaration of this structure.

typedef struct {
  // # of characters in font
  int nchars;
  // First character is numbered... (usually 32 = space)
  int offset;
  // Character width and height
  int w;
  int h;
  // Font data; array of characters, one row after another.
  // Easily included in code, also easily loaded from
  // data files.
  char *data;
} gdFont;

gdFontPtr is a pointer to gdFont.

Types

gdSource

gdSourcePtr

Note: This interface is obsolete and kept only for *compatibility.  Use gdIOCtx instead.

Represents a source from which a PNG can be read.  Programmers who do not wish to read PNGs from a file can provide their own alternate input mechanism, using the gdImageCreateFromPngSource function.  See the documentation of that function for an example of the proper use of this type.

typedef struct {
        int (*source) (void *context, char *buffer, int len);
        void *context;
} gdSource, *gdSourcePtr;

The source function must return -1 on error, otherwise the number of bytes fetched.  0 is EOF, not an error!

’context’ will be passed to your source function.

Types

gdFTStringExtra

gdFTStringExtraPtr

A structure and associated pointer type used to pass additional parameters to the gdImageStringFTEx function.  See gdImageStringFTEx for the structure definition.

Thanks to Wez Furlong.

Types

gdPoint

gdPointPtr

Represents a point in the coordinate space of the image; used by <gdImagePolygon>, <gdImageOpenPolygon> and <gdImageFilledPolygon> for polygon drawing.

typedef struct {
    int x, y;
} gdPoint, *gdPointPtr;

GifAnim

Legal values for Disposal. gdDisposalNone is always used by the built-in optimizer if previm is passed.

gdImageGifAnim

gdDisposalUnknownNot recommended
gdDisposalNonePreserve previous frame
gdDisposalRestoreBackgroundFirst allocated color of palette
gdDisposalRestorePreviousRestore to before start of frame

See also: gdImageGifAnimAdd

Types

gdSink

gdSinkPtr

Note: This interface is obsolete and kept only for *compatibility.  Use gdIOCtx instead.

Represents a “sink” (destination) to which a PNG can be written.  Programmers who do not wish to write PNGs to a file can provide their own alternate output mechanism, using the <gdImagePngToSink> function.  See the documentation of that function for an example of the proper use of this type.

typedef struct {
    int (*sink) (void *context, char *buffer, int len);
    void *context;
} gdSink, *gdSinkPtr;

The sink function must return -1 on error, otherwise the number of bytes written, which must be equal to len.

context will be passed to your sink function.

Crop

gdCropMode

GD_CROP_DEFAULTDefault crop mode (4 corners or background)
GD_CROP_TRANSPARENTCrop using the transparent color
GD_CROP_BLACKCrop black borders
GD_CROP_WHITECrop white borders
GD_CROP_SIDESCrop using colors of the 4 corners

See also

<gdImageAutoCrop>

Defines a point in a 2D coordinate system using floating point values.
gdImageStringFTEx extends the capabilities of gdImageStringFT by providing a way to pass additional parameters.
gdImagePtr gdImageCreate (int sx,
int sy)
gdImageCreate is called to create palette-based images, with no more than 256 colors.
gdImagePtr gdImageCreateTrueColor (int sx,
int sy)
gdImageCreateTrueColor is called to create truecolor images, with an essentially unlimited number of colors.
The data structure in which gd stores images.
gdIOCtx structures hold function pointers for doing image IO.
gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
See gdImageCreateFromPng for documentation.
void gdImageGifAnimAdd(gdImagePtr im,
FILE *outFile,
int LocalCM,
int LeftOfs,
int TopOfs,
int Delay,
int Disposal,
gdImagePtr previm)
This function writes GIF animation frames to GIF animation, which was initialized with gdImageGifAnimBegin.
Close