"Fossies" - the Fresh Open Source Software Archive

Member "libgd-2.3.2/docs/naturaldocs/html/files/gd-c.html" (5 Mar 2021, 209584 Bytes) of package /linux/www/libgd-2.3.2.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the project site itself.

gd.c

Summary
gd.c
Error Handling
gdSetErrorMethod
gdClearErrorMethod
Creation and Destruction
gdImageCreategdImageCreate is called to create palette-based images, with no more than 256 colors.
gdImageCreateTrueColorgdImageCreateTrueColor is called to create truecolor images, with an essentially unlimited number of colors.
gdImageDestroygdImageDestroy is used to free the memory associated with an image.
Color
gdImageColorClosestGets the closest color of the image
gdImageColorClosestAlphaGets the closest color of the image
gdImageColorClosestHWB
gdImageColorExactGets the exact color of the image
gdImageColorExactAlphaGets the exact color of the image
gdImageColorAllocateAllocates a color
gdImageColorAllocateAlphaAllocates a color
gdImageColorResolvegdImageColorResolve is an alternative for the code fragment
gdImageColorResolveAlpha
gdImageColorDeallocateRemoves a palette entry
gdImageColorTransparentSets the transparent color of the image
gdImagePaletteCopy
gdImageColorReplace
gdImageColorReplaceThreshold
gdImageColorReplaceArray
gdImageColorReplaceCallback
Pixels
gdImageSetPixel
gdImageGetPixelGets a pixel color as stored in the image.
gdImageGetTrueColorPixelGets a pixel color always as truecolor value.
Primitives
gdImageAABlendNO-OP, kept for library compatibility.
gdImageLineBresenham as presented in Foley & Van Dam.
gdImageDashedLine
gdImageBoundsSafe
gdImageCharDraws a single character.
gdImageCharUp
gdImageStringDraws a character string.
gdImageStringUp
gdImageString16
gdImageStringUp16
gdImageArc
gdImageFilledArc
gdImageEllipse
gdImageFilledEllipse
gdImageFillToBorder
gdImageFill
gdImageRectangleDraws a rectangle.
gdImageFilledRectangle
Cloning and Copying
gdImageCloneClones an image
gdImageCopyCopy an area of an image to another image
gdImageCopyMergeCopy an area of an image to another image ignoring alpha
gdImageCopyMergeGrayCopy an area of an image to another image ignoring alpha
gdImageCopyResizedCopy a resized area from an image to another image
gdImageCopyRotatedCopy a rotated area from an image to another image
gdImageCopyResampledCopy a resampled area from an image to another image
Polygons
gdImagePolygonDraws a closed polygon
gdImageOpenPolygonDraws an open polygon
gdImageFilledPolygonDraws a filled polygon
other
gdImageSetStyleSets the style for following drawing operations
gdImageSetThicknessSets the thickness for following drawing operations
gdImageSetBrushSets the brush for following drawing operations
gdImageSetTile
gdImageSetAntiAliasedSet the color for subsequent anti-aliased drawing
gdImageSetAntiAliasedDontBlendSet the color and “dont_blend” color for subsequent anti-aliased drawing
gdImageInterlaceSets whether an image is interlaced
gdImageCompareCompare two images
gdAlphaBlendBlend two colors
gdLayerOverlayOverlay two colors
gdLayerMultiplyOverlay two colors with multiply effect
gdImageAlphaBlendingSet the effect for subsequent drawing operations
gdImageSaveAlphaSets the save alpha flag
gdImageSetClipSets the clipping rectangle
gdImageGetClipGets the current clipping rectangle
gdImageSetResolutionSets the resolution of an image.
gdImagePaletteToTrueColorConvert a palette image to true color

Error Handling

gdSetErrorMethod

void gdSetErrorMethod(gdErrorMethod error_method)

gdClearErrorMethod

void gdClearErrorMethod(void)

Creation and Destruction

gdImageCreate

gdImagePtr gdImageCreate (int sx,
int sy)

gdImageCreate is called to create palette-based images, with no more than 256 colors.  The image must eventually be destroyed using gdImageDestroy().

Parameters

sxThe image width.
syThe image height.

Returns

A pointer to the new image or NULL if an error occurred.

Example

gdImagePtr im;
im = gdImageCreate(64, 64);
// ... Use the image ...
gdImageDestroy(im);

See Also

gdImageCreateTrueColor

gdImageCreateTrueColor

gdImagePtr gdImageCreateTrueColor (int sx,
int sy)

gdImageCreateTrueColor is called to create truecolor images, with an essentially unlimited number of colors.  Invoke gdImageCreateTrueColor with the x and y dimensions of the desired image.  gdImageCreateTrueColor returns a gdImagePtr to the new image, or NULL if unable to allocate the image.  The image must eventually be destroyed using <gdImageDestroy>().

Truecolor images are always filled with black at creation time.  There is no concept of a “background” color index.

Parameters

sxThe image width.
syThe image height.

Returns

A pointer to the new image or NULL if an error occurred.

Example

gdImagePtr im;
im = gdImageCreateTrueColor(64, 64);
// ... Use the image ...
gdImageDestroy(im);

See Also

gdImageCreateTrueColor

gdImageDestroy

void gdImageDestroy (gdImagePtr im)

gdImageDestroy is used to free the memory associated with an image.  It is important to invoke gdImageDestroy before exiting your program or assigning a new image to a gdImagePtr variable.

Parameters

imPointer to the gdImage to delete.

Returns

Nothing.

Example

gdImagePtr im;
im = gdImageCreate(10, 10);
// ... Use the image ...
// Now destroy it
gdImageDestroy(im);

Color

gdImageColorClosest

int gdImageColorClosest (gdImagePtr im,
int r,
int g,
int b)

Gets the closest color of the image

This is a simplified variant of gdImageColorClosestAlpha where the alpha channel is always opaque.

Parameters

imThe image.
rThe value of the red component.
gThe value of the green component.
bThe value of the blue component.

Returns

The closest color already available in the palette for palette images; the color value of the given components for truecolor images.

See also

gdImageColorClosestAlpha

int gdImageColorClosestAlpha (gdImagePtr im,
int r,
int g,
int b,
int a)

Gets the closest color of the image

Parameters

imThe image.
rThe value of the red component.
gThe value of the green component.
bThe value of the blue component.
aThe value of the alpha component.

Returns

The closest color already available in the palette for palette images; the color value of the given components for truecolor images.

See also

gdImageColorClosestHWB

int gdImageColorClosestHWB (gdImagePtr im,
int r,
int g,
int b)

gdImageColorExact

int gdImageColorExact (gdImagePtr im,
int r,
int g,
int b)

Gets the exact color of the image

This is a simplified variant of gdImageColorExactAlpha where the alpha channel is always opaque.

Parameters

imThe image.
rThe value of the red component.
gThe value of the green component.
bThe value of the blue component.

Returns

The exact color already available in the palette for palette images; if there is no exact color, -1 is returned.  For truecolor images the color value of the given components is returned.

See also

gdImageColorExactAlpha

int gdImageColorExactAlpha (gdImagePtr im,
int r,
int g,
int b,
int a)

Gets the exact color of the image

Parameters

imThe image.
rThe value of the red component.
gThe value of the green component.
bThe value of the blue component.
aThe value of the alpha component.

Returns

The exact color already available in the palette for palette images; if there is no exact color, -1 is returned.  For truecolor images the color value of the given components is returned.

See also

gdImageColorAllocate

int gdImageColorAllocate (gdImagePtr im,
int r,
int g,
int b)

Allocates a color

This is a simplified variant of gdImageColorAllocateAlpha where the alpha channel is always opaque.

Parameters

imThe image.
rThe value of the red component.
gThe value of the green component.
bThe value of the blue component.

Returns

The color value.

See also

gdImageColorAllocateAlpha

int gdImageColorAllocateAlpha (gdImagePtr im,
int r,
int g,
int b,
int a)

Allocates a color

This is typically used for palette images, but can be used for truecolor images as well.

Parameters

imThe image.
rThe value of the red component.
gThe value of the green component.
bThe value of the blue component.

Returns

The color value.

See also

gdImageColorResolve

int gdImageColorResolve (gdImagePtr im,
int r,
int g,
int b)

gdImageColorResolve is an alternative for the code fragment

if ((color=gdImageColorExact(im,R,G,B)) < 0)
  if ((color=gdImageColorAllocate(im,R,G,B)) < 0)
    color=gdImageColorClosest(im,R,G,B);

in a single function.  Its advantage is that it is guaranteed to return a color index in one search over the color table.

gdImageColorResolveAlpha

int gdImageColorResolveAlpha (gdImagePtr im,
int r,
int g,
int b,
int a)

gdImageColorDeallocate

void gdImageColorDeallocate (gdImagePtr im,
int color)

Removes a palette entry

This is a no-op for truecolor images.

Parameters

imThe image.
colorThe palette index.

See also

gdImageColorTransparent

void gdImageColorTransparent (gdImagePtr im,
int color)

Sets the transparent color of the image

Parameter

imThe image.
colorThe color.

See also

gdImagePaletteCopy

void gdImagePaletteCopy (gdImagePtr to,
gdImagePtr from)

gdImageColorReplace

int gdImageColorReplace (gdImagePtr im,
int src,
int dst)

gdImageColorReplaceThreshold

int gdImageColorReplaceThreshold (gdImagePtr im,
int src,
int dst,
float threshold)

gdImageColorReplaceArray

int gdImageColorReplaceArray (gdImagePtr im,
int len,
int *src,
int *dst)

gdImageColorReplaceCallback

int gdImageColorReplaceCallback (gdImagePtr im,
gdCallbackImageColor callback)

Pixels

gdImageSetPixel

void gdImageSetPixel (gdImagePtr im,
int x,
int y,
int color)

gdImageGetPixel

int gdImageGetPixel (gdImagePtr im,
int x,
int y)

Gets a pixel color as stored in the image.

Parameters

imThe image.
xThe x-coordinate.
yThe y-coordinate.

See also

gdImageGetTrueColorPixel

int gdImageGetTrueColorPixel (gdImagePtr im,
int x,
int y)

Gets a pixel color always as truecolor value.

Parameters

imThe image.
xThe x-coordinate.
yThe y-coordinate.

See also

Primitives

gdImageAABlend

void gdImageAABlend (gdImagePtr im)

NO-OP, kept for library compatibility.

gdImageLine

void gdImageLine (gdImagePtr im,
int x1,
int y1,
int x2,
int y2,
int color)

Bresenham as presented in Foley & Van Dam.

gdImageDashedLine

void gdImageDashedLine (gdImagePtr im,
int x1,
int y1,
int x2,
int y2,
int color)

gdImageBoundsSafe

int gdImageBoundsSafe (gdImagePtr im,
int x,
int y)

gdImageChar

void gdImageChar (gdImagePtr im,
gdFontPtr f,
int x,
int y,
int c,
int color)

Draws a single character.

Parameters

imThe image to draw onto.
fThe raster font.
xThe x coordinate of the upper left pixel.
yThe y coordinate of the upper left pixel.
cThe character.
colorThe color.

Variants

See also

gdImageCharUp

void gdImageCharUp (gdImagePtr im,
gdFontPtr f,
int x,
int y,
int c,
int color)

gdImageString

void gdImageString (gdImagePtr im,
gdFontPtr f,
int x,
int y,
unsigned char *s,
int color)

Draws a character string.

Parameters

imThe image to draw onto.
fThe raster font.
xThe x coordinate of the upper left pixel.
yThe y coordinate of the upper left pixel.
cThe character string.
colorThe color.

Variants

See also

gdImageStringUp

void gdImageStringUp (gdImagePtr im,
gdFontPtr f,
int x,
int y,
unsigned char *s,
int color)

gdImageString16

void gdImageString16 (gdImagePtr im,
gdFontPtr f,
int x,
int y,
unsigned short *s,
int color)

gdImageStringUp16

void gdImageStringUp16 (gdImagePtr im,
gdFontPtr f,
int x,
int y,
unsigned short *s,
int color)

gdImageArc

void gdImageArc (gdImagePtr im,
int cx,
int cy,
int w,
int h,
int s,
int e,
int color)

gdImageFilledArc

void gdImageFilledArc (gdImagePtr im,
int cx,
int cy,
int w,
int h,
int s,
int e,
int color,
int style)

gdImageEllipse

void gdImageEllipse(gdImagePtr im,
int mx,
int my,
int w,
int h,
int c)

gdImageFilledEllipse

void gdImageFilledEllipse (gdImagePtr im,
int mx,
int my,
int w,
int h,
int c)

gdImageFillToBorder

void gdImageFillToBorder (gdImagePtr im,
int x,
int y,
int border,
int color)

gdImageFill

void gdImageFill(gdImagePtr im,
int x,
int y,
int nc)

gdImageRectangle

void gdImageRectangle (gdImagePtr im,
int x1,
int y1,
int x2,
int y2,
int color)

Draws a rectangle.

Parameters

imThe image.
x1The x-coordinate of one of the corners.
y1The y-coordinate of one of the corners.
x2The x-coordinate of another corner.
y2The y-coordinate of another corner.
colorThe color.

See also

gdImageFilledRectangle

void gdImageFilledRectangle (gdImagePtr im,
int x1,
int y1,
int x2,
int y2,
int color)

Cloning and Copying

gdImageClone

gdImagePtr gdImageClone (gdImagePtr src)

Clones an image

Creates an exact duplicate of the given image.

Parameters

srcThe source image.

Returns

The cloned image on success, NULL on failure.

gdImageCopy

void gdImageCopy (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h)

Copy an area of an image to another image

Parameters

dstThe destination image.
srcThe source image.
dstXThe x-coordinate of the upper left corner to copy to.
dstYThe y-coordinate of the upper left corner to copy to.
srcXThe x-coordinate of the upper left corner to copy from.
srcYThe y-coordinate of the upper left corner to copy from.
wThe width of the area to copy.
hThe height of the area to copy.

See also

gdImageCopyMerge

void gdImageCopyMerge (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h,
int pct)

Copy an area of an image to another image ignoring alpha

The source area will be copied to the destination are by merging the pixels.

Note

This function is a substitute for real alpha channel operations, so it doesn’t pay attention to the alpha channel.

Parameters

dstThe destination image.
srcThe source image.
dstXThe x-coordinate of the upper left corner to copy to.
dstYThe y-coordinate of the upper left corner to copy to.
srcXThe x-coordinate of the upper left corner to copy from.
srcYThe y-coordinate of the upper left corner to copy from.
wThe width of the area to copy.
hThe height of the area to copy.
pctThe percentage in range 0..100.

See also

gdImageCopyMergeGray

void gdImageCopyMergeGray (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h,
int pct)

Copy an area of an image to another image ignoring alpha

The source area will be copied to the grayscaled destination area by merging the pixels.

Note

This function is a substitute for real alpha channel operations, so it doesn’t pay attention to the alpha channel.

Parameters

dstThe destination image.
srcThe source image.
dstXThe x-coordinate of the upper left corner to copy to.
dstYThe y-coordinate of the upper left corner to copy to.
srcXThe x-coordinate of the upper left corner to copy from.
srcYThe y-coordinate of the upper left corner to copy from.
wThe width of the area to copy.
hThe height of the area to copy.
pctThe percentage of the source color intensity in range 0..100.

See also

gdImageCopyResized

void gdImageCopyResized (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int dstW,
int dstH,
int srcW,
int srcH)

Copy a resized area from an image to another image

If the source and destination area differ in size, the area will be resized using nearest-neighbor interpolation.

Parameters

dstThe destination image.
srcThe source image.
dstXThe x-coordinate of the upper left corner to copy to.
dstYThe y-coordinate of the upper left corner to copy to.
srcXThe x-coordinate of the upper left corner to copy from.
srcYThe y-coordinate of the upper left corner to copy from.
dstWThe width of the area to copy to.
dstHThe height of the area to copy to.
srcWThe width of the area to copy from.
srcHThe height of the area to copy from.

See also

gdImageCopyRotated

void gdImageCopyRotated (gdImagePtr dst,
gdImagePtr src,
double dstX,
double dstY,
int srcX,
int srcY,
int srcWidth,
int srcHeight,
int angle)

Copy a rotated area from an image to another image

The area is counter-clockwise rotated using nearest-neighbor interpolation.

Parameters

dstThe destination image.
srcThe source image.
dstXThe x-coordinate of the center of the area to copy to.
dstYThe y-coordinate of the center of the area to copy to.
srcXThe x-coordinate of the upper left corner to copy from.
srcYThe y-coordinate of the upper left corner to copy from.
srcWThe width of the area to copy from.
srcHThe height of the area to copy from.
angleThe angle in degrees.

See also

gdImageCopyResampled

void gdImageCopyResampled (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int dstW,
int dstH,
int srcW,
int srcH)

Copy a resampled area from an image to another image

If the source and destination area differ in size, the area will be resized using bilinear interpolation for truecolor images, and nearest-neighbor interpolation for palette images.

Parameters

dstThe destination image.
srcThe source image.
dstXThe x-coordinate of the upper left corner to copy to.
dstYThe y-coordinate of the upper left corner to copy to.
srcXThe x-coordinate of the upper left corner to copy from.
srcYThe y-coordinate of the upper left corner to copy from.
dstWThe width of the area to copy to.
dstHThe height of the area to copy to.
srcWThe width of the area to copy from.
srcHThe height of the area to copy from.

See also

Polygons

gdImagePolygon

void gdImagePolygon (gdImagePtr im,
gdPointPtr p,
int n,
int c)

Draws a closed polygon

Parameters

imThe image.
pThe vertices as array of gdPoints.
nThe number of vertices.
cThe color.

See also

gdImageOpenPolygon

void gdImageOpenPolygon (gdImagePtr im,
gdPointPtr p,
int n,
int c)

Draws an open polygon

Parameters

imThe image.
pThe vertices as array of gdPoints.
nThe number of vertices.
cThe color

See also

gdImageFilledPolygon

void gdImageFilledPolygon (gdImagePtr im,
gdPointPtr p,
int n,
int c)

Draws a filled polygon

The polygon is filled using the even-odd fillrule what can leave unfilled regions inside of self-intersecting polygons.  This behavior might change in a future version.

Parameters

imThe image.
pThe vertices as array of gdPoints.
nThe number of vertices.
cThe color

See also

other

gdImageSetStyle

void gdImageSetStyle (gdImagePtr im,
int *style,
int noOfPixels)

Sets the style for following drawing operations

Parameters

imThe image.
styleAn array of color values.
noOfPixelThe number of color values.

gdImageSetThickness

void gdImageSetThickness (gdImagePtr im,
int thickness)

Sets the thickness for following drawing operations

Parameters

imThe image.
thicknessThe thickness in pixels.

gdImageSetBrush

void gdImageSetBrush (gdImagePtr im,
gdImagePtr brush)

Sets the brush for following drawing operations

Parameters

imThe image.
brushThe brush image.

gdImageSetTile

void gdImageSetTile (gdImagePtr im,
gdImagePtr tile)

gdImageSetAntiAliased

void gdImageSetAntiAliased (gdImagePtr im,
int c)

Set the color for subsequent anti-aliased drawing

If gdAntiAliased is passed as color to drawing operations that support anti-aliased drawing (such as gdImageLine and gdImagePolygon), the actual color to be used can be set with this function.

Example: draw an anti-aliased blue line

gdImageSetAntiAliased(im, gdTrueColorAlpha(0, 0, gdBlueMax, gdAlphaOpaque));
gdImageLine(im, 10,10, 20,20, gdAntiAliased);

Parameters

imThe image.
cThe color.

See also

gdImageSetAntiAliasedDontBlend

void gdImageSetAntiAliasedDontBlend (gdImagePtr im,
int c,
int dont_blend)

Set the color and “dont_blend” color for subsequent anti-aliased drawing

This extended variant of gdImageSetAntiAliased allows to also specify a (background) color that will not be blended in anti-aliased drawing operations.

Parameters

imThe image.
cThe color.
dont_blendWhether to blend.

gdImageInterlace

void gdImageInterlace (gdImagePtr im,
int interlaceArg)

Sets whether an image is interlaced

This is relevant only when saving the image in a format that supports interlacing.

Parameters

imThe image.
interlaceArgWhether the image is interlaced.

See also

gdImageCompare

int gdImageCompare (gdImagePtr im1,
gdImagePtr im2)

Compare two images

Parameters

im1An image.
im2Another image.

Returns

A bitmask of Image Comparison flags where each set flag signals which attributes of the images are different.

gdAlphaBlend

int gdAlphaBlend (int dst,
int src)

Blend two colors

Parameters

dstThe color to blend onto.
srcThe color to blend.

See also

gdLayerOverlay

int gdLayerOverlay (int dst,
int src)

Overlay two colors

Parameters

dstThe color to overlay onto.
srcThe color to overlay.

See also

gdLayerMultiply

int gdLayerMultiply (int dst,
int src)

Overlay two colors with multiply effect

Parameters

dstThe color to overlay onto.
srcThe color to overlay.

See also

gdImageAlphaBlending

void gdImageAlphaBlending (gdImagePtr im,
int alphaBlendingArg)

Set the effect for subsequent drawing operations

Note that the effect is used for truecolor images only.

Parameters

imThe image.
alphaBlendingArgThe effect.

See also

gdImageSaveAlpha

void gdImageSaveAlpha (gdImagePtr im,
int saveAlphaArg)

Sets the save alpha flag

The save alpha flag specifies whether the alpha channel of the pixels should be saved.  This is supported only for image formats that support full alpha transparency, e.g.  PNG.

gdImageSetClip

void gdImageSetClip (gdImagePtr im,
int x1,
int y1,
int x2,
int y2)

Sets the clipping rectangle

The clipping rectangle restricts the drawing area for following drawing operations.

Parameters

imThe image.
x1The x-coordinate of the upper left corner.
y1The y-coordinate of the upper left corner.
x2The x-coordinate of the lower right corner.
y2The y-coordinate of the lower right corner.

See also

gdImageGetClip

void gdImageGetClip (gdImagePtr im,
int *x1P,
int *y1P,
int *x2P,
int *y2P)

Gets the current clipping rectangle

Parameters

imThe image.
x1P(out) The x-coordinate of the upper left corner.
y1P(out) The y-coordinate of the upper left corner.
x2P(out) The x-coordinate of the lower right corner.
y2P(out) The y-coordinate of the lower right corner.

See also

gdImageSetResolution

void gdImageSetResolution(gdImagePtr im,
const unsigned int res_x,
const unsigned int res_y)

Sets the resolution of an image.

Parameters

imThe image.
res_xThe horizontal resolution in DPI.
res_yThe vertical resolution in DPI.

See also

gdImagePaletteToTrueColor

int gdImagePaletteToTrueColor(gdImagePtr src)

Convert a palette image to true color

Parameters

srcThe image.

Returns

Non-zero if the conversion succeeded, zero otherwise.

See also

void gdSetErrorMethod(gdErrorMethod error_method)
void gdClearErrorMethod(void)
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.
void gdImageDestroy (gdImagePtr im)
gdImageDestroy is used to free the memory associated with an image.
int gdImageColorClosest (gdImagePtr im,
int r,
int g,
int b)
Gets the closest color of the image
int gdImageColorClosestAlpha (gdImagePtr im,
int r,
int g,
int b,
int a)
Gets the closest color of the image
int gdImageColorClosestHWB (gdImagePtr im,
int r,
int g,
int b)
int gdImageColorExact (gdImagePtr im,
int r,
int g,
int b)
Gets the exact color of the image
int gdImageColorExactAlpha (gdImagePtr im,
int r,
int g,
int b,
int a)
Gets the exact color of the image
int gdImageColorAllocate (gdImagePtr im,
int r,
int g,
int b)
Allocates a color
int gdImageColorAllocateAlpha (gdImagePtr im,
int r,
int g,
int b,
int a)
Allocates a color
int gdImageColorResolve (gdImagePtr im,
int r,
int g,
int b)
gdImageColorResolve is an alternative for the code fragment
int gdImageColorResolveAlpha (gdImagePtr im,
int r,
int g,
int b,
int a)
void gdImageColorDeallocate (gdImagePtr im,
int color)
Removes a palette entry
void gdImageColorTransparent (gdImagePtr im,
int color)
Sets the transparent color of the image
void gdImagePaletteCopy (gdImagePtr to,
gdImagePtr from)
int gdImageColorReplace (gdImagePtr im,
int src,
int dst)
int gdImageColorReplaceThreshold (gdImagePtr im,
int src,
int dst,
float threshold)
int gdImageColorReplaceArray (gdImagePtr im,
int len,
int *src,
int *dst)
int gdImageColorReplaceCallback (gdImagePtr im,
gdCallbackImageColor callback)
void gdImageSetPixel (gdImagePtr im,
int x,
int y,
int color)
int gdImageGetPixel (gdImagePtr im,
int x,
int y)
Gets a pixel color as stored in the image.
int gdImageGetTrueColorPixel (gdImagePtr im,
int x,
int y)
Gets a pixel color always as truecolor value.
void gdImageAABlend (gdImagePtr im)
NO-OP, kept for library compatibility.
void gdImageLine (gdImagePtr im,
int x1,
int y1,
int x2,
int y2,
int color)
Bresenham as presented in Foley & Van Dam.
void gdImageDashedLine (gdImagePtr im,
int x1,
int y1,
int x2,
int y2,
int color)
int gdImageBoundsSafe (gdImagePtr im,
int x,
int y)
void gdImageChar (gdImagePtr im,
gdFontPtr f,
int x,
int y,
int c,
int color)
Draws a single character.
void gdImageCharUp (gdImagePtr im,
gdFontPtr f,
int x,
int y,
int c,
int color)
void gdImageString (gdImagePtr im,
gdFontPtr f,
int x,
int y,
unsigned char *s,
int color)
Draws a character string.
void gdImageStringUp (gdImagePtr im,
gdFontPtr f,
int x,
int y,
unsigned char *s,
int color)
void gdImageString16 (gdImagePtr im,
gdFontPtr f,
int x,
int y,
unsigned short *s,
int color)
void gdImageStringUp16 (gdImagePtr im,
gdFontPtr f,
int x,
int y,
unsigned short *s,
int color)
void gdImageArc (gdImagePtr im,
int cx,
int cy,
int w,
int h,
int s,
int e,
int color)
void gdImageFilledArc (gdImagePtr im,
int cx,
int cy,
int w,
int h,
int s,
int e,
int color,
int style)
void gdImageEllipse(gdImagePtr im,
int mx,
int my,
int w,
int h,
int c)
void gdImageFilledEllipse (gdImagePtr im,
int mx,
int my,
int w,
int h,
int c)
void gdImageFillToBorder (gdImagePtr im,
int x,
int y,
int border,
int color)
void gdImageFill(gdImagePtr im,
int x,
int y,
int nc)
void gdImageRectangle (gdImagePtr im,
int x1,
int y1,
int x2,
int y2,
int color)
Draws a rectangle.
void gdImageFilledRectangle (gdImagePtr im,
int x1,
int y1,
int x2,
int y2,
int color)
gdImagePtr gdImageClone (gdImagePtr src)
Clones an image
void gdImageCopy (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h)
Copy an area of an image to another image
void gdImageCopyMerge (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h,
int pct)
Copy an area of an image to another image ignoring alpha
void gdImageCopyMergeGray (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int w,
int h,
int pct)
Copy an area of an image to another image ignoring alpha
void gdImageCopyResized (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int dstW,
int dstH,
int srcW,
int srcH)
Copy a resized area from an image to another image
void gdImageCopyRotated (gdImagePtr dst,
gdImagePtr src,
double dstX,
double dstY,
int srcX,
int srcY,
int srcWidth,
int srcHeight,
int angle)
Copy a rotated area from an image to another image
void gdImageCopyResampled (gdImagePtr dst,
gdImagePtr src,
int dstX,
int dstY,
int srcX,
int srcY,
int dstW,
int dstH,
int srcW,
int srcH)
Copy a resampled area from an image to another image
void gdImagePolygon (gdImagePtr im,
gdPointPtr p,
int n,
int c)
Draws a closed polygon
void gdImageOpenPolygon (gdImagePtr im,
gdPointPtr p,
int n,
int c)
Draws an open polygon
void gdImageFilledPolygon (gdImagePtr im,
gdPointPtr p,
int n,
int c)
Draws a filled polygon
void gdImageSetStyle (gdImagePtr im,
int *style,
int noOfPixels)
Sets the style for following drawing operations
void gdImageSetThickness (gdImagePtr im,
int thickness)
Sets the thickness for following drawing operations
void gdImageSetBrush (gdImagePtr im,
gdImagePtr brush)
Sets the brush for following drawing operations
void gdImageSetTile (gdImagePtr im,
gdImagePtr tile)
void gdImageSetAntiAliased (gdImagePtr im,
int c)
Set the color for subsequent anti-aliased drawing
void gdImageSetAntiAliasedDontBlend (gdImagePtr im,
int c,
int dont_blend)
Set the color and “dont_blend” color for subsequent anti-aliased drawing
void gdImageInterlace (gdImagePtr im,
int interlaceArg)
Sets whether an image is interlaced
int gdImageCompare (gdImagePtr im1,
gdImagePtr im2)
Compare two images
int gdAlphaBlend (int dst,
int src)
Blend two colors
int gdLayerOverlay (int dst,
int src)
Overlay two colors
int gdLayerMultiply (int dst,
int src)
Overlay two colors with multiply effect
void gdImageAlphaBlending (gdImagePtr im,
int alphaBlendingArg)
Set the effect for subsequent drawing operations
void gdImageSaveAlpha (gdImagePtr im,
int saveAlphaArg)
Sets the save alpha flag
void gdImageSetClip (gdImagePtr im,
int x1,
int y1,
int x2,
int y2)
Sets the clipping rectangle
void gdImageGetClip (gdImagePtr im,
int *x1P,
int *y1P,
int *x2P,
int *y2P)
Gets the current clipping rectangle
void gdImageSetResolution(gdImagePtr im,
const unsigned int res_x,
const unsigned int res_y)
Sets the resolution of an image.
int gdImagePaletteToTrueColor(gdImagePtr src)
Convert a palette image to true color
The data structure in which gd stores images.
Compose a truecolor value from its components
Gets the transparent color of the image.
Gets the color of a pixel.
Gets the color of a pixel.
A font structure, containing the bitmaps of all characters in a font.
char * gdImageStringTTF (gdImage *im,
int *brect,
int fg,
const char *fontlist,
double ptsize,
double angle,
int x,
int y,
const char *string)
Alias of gdImageStringFT.
gdImagePtr gdImageScale(const gdImagePtr src,
const unsigned int new_width,
const unsigned int new_height)
Scale an image
gdImagePtr gdImageRotateInterpolated(const gdImagePtr src,
const float angle,
int bgcolor)
Rotate an image
draw anti aliased
Whether an image is interlaced.
The layering effect
Gets the horizontal resolution in DPI.
Gets the vertical resolution in DPI.
int gdImageTrueColorToPalette (gdImagePtr im,
int dither,
int colorsWanted)
Converts a truecolor image to a palette image
Close