LibGd 2.4.0-dev
GD Graphics library
Loading...
Searching...
No Matches
Functions
Clone, copy and image properties

Functions

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 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 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.
 
gdImagePtr gdImageClone (gdImagePtr src)
 Clones an image.
 
void gdImageInterlace (gdImagePtr im, int interlaceArg)
 Sets whether an image is interlaced.
 

Detailed Description

Function Documentation

◆ 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.

Group: Cloning and Copying

◆ 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
dst- The destination image.
src- The source image.
dstX- The x-coordinate of the upper left corner to copy to.
dstY- The y-coordinate of the upper left corner to copy to.
srcX- The x-coordinate of the upper left corner to copy from.
srcY- The y-coordinate of the upper left corner to copy from.
w- The width of the area to copy.
h- The height of the area to copy.
See also
gdImageCopyMerge gdImageCopyMergeGray gdImageCopyResized gdImageCopyResampled gdImageCopyRotated gdImageScale gdImageScaleWithOptions

◆ 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
gdImageCopy gdImageCopyMergeGray

◆ 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
dst- The destination image.
src- The source image.
dstX- The x-coordinate of the upper left corner to copy to.
dstY- The y-coordinate of the upper left corner to copy to.
srcX- The x-coordinate of the upper left corner to copy from.
srcY- The y-coordinate of the upper left corner to copy from.
w- The width of the area to copy.
h- The height of the area to copy.
pct- The percentage of the source color intensity in range 0..100.
See also
gdImageCopy gdImageCopyMerge

◆ 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
gdImageCopyResized gdImageScale

◆ 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
gdImageCopyResampled gdImageScale

◆ 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
gdImageRotateInterpolated

◆ 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
gdImageGetInterlaced