gd_interpolation.c | |
gdImageScale | Scale an image |
gdImageRotateInterpolated | Rotate an image |
Affine Transformation | |
gdTransformAffineGetImage | Applies an affine transformation to a region and return an image containing the complete transformation. |
getPixelRgbInterpolated | get the index of the image’s colors |
gdTransformAffineCopy | Applies an affine transformation to a region and copy the result in a destination to the given position. |
gdTransformAffineBoundingBox | Returns the bounding box of an affine transformation applied to a rectangular area gdRect |
Interpolation Method | |
gdImageSetInterpolationMethod | Set the interpolation method for subsequent operations |
gdImageGetInterpolationMethod | Get the current interpolation method |
gdImagePtr gdImageScale( const gdImagePtr src, const unsigned int new_width, const unsigned int new_height )
Scale an image
Creates a new image, scaled to the requested size using the current gdInterpolationMethod.
Note that GD_WEIGHTED4 is not yet supported by this function.
src | The source image. |
new_width | The new width. |
new_height | The new height. |
The scaled image on success, NULL on failure.
gdImagePtr gdImageRotateInterpolated( const gdImagePtr src, const float angle, int bgcolor )
Rotate an image
Creates a new image, counter-clockwise rotated by the requested angle using the current gdInterpolationMethod. Non-square angles will add a border with bgcolor.
src | The source image. |
angle | The angle in degrees. |
bgcolor | The color to fill the added background with. |
The rotated image on success, NULL on failure.
int gdTransformAffineGetImage( gdImagePtr * dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6] )
Applies an affine transformation to a region and return an image containing the complete transformation.
dst | Pointer to a gdImagePtr to store the created image, NULL when the creation or the transformation failed |
src | Source image |
src_area | rectangle defining the source region to transform |
dstY | Y position in the destination image |
affine | The desired affine transformation |
GD_TRUE if the affine is rectilinear or GD_FALSE
int gdTransformAffineCopy( gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6] )
Applies an affine transformation to a region and copy the result in a destination to the given position.
dst | Image to draw the transformed image |
src | Source image |
dstX | X position in the destination image |
dstY | Y position in the destination image |
src_area | Rectangular region to rotate in the src image |
GD_TRUE on success or GD_FALSE on failure
int gdTransformAffineBoundingBox( gdRectPtr src, const double affine[6], gdRectPtr bbox )
Returns the bounding box of an affine transformation applied to a rectangular area gdRect
src | Rectangular source area for the affine transformation |
affine | the affine transformation |
bbox | the resulting bounding box |
GD_TRUE if the affine is rectilinear or GD_FALSE
gdInterpolationMethod gdImageGetInterpolationMethod( gdImagePtr im )
Get the current interpolation method
This is here so that the value can be read via a language or VM with an FFI but no (portable) way to extract the value from the struct.
im | The image. |
The current interpolation method.
Scale an image
gdImagePtr gdImageScale( const gdImagePtr src, const unsigned int new_width, const unsigned int new_height )
Rotate an image
gdImagePtr gdImageRotateInterpolated( const gdImagePtr src, const float angle, int bgcolor )
Applies an affine transformation to a region and return an image containing the complete transformation.
int gdTransformAffineGetImage( gdImagePtr * dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6] )
get the index of the image’s colors
static int getPixelRgbInterpolated( gdImagePtr im, const int tcolor )
Applies an affine transformation to a region and copy the result in a destination to the given position.
int gdTransformAffineCopy( gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6] )
Returns the bounding box of an affine transformation applied to a rectangular area gdRect
int gdTransformAffineBoundingBox( gdRectPtr src, const double affine[6], gdRectPtr bbox )
Set the interpolation method for subsequent operations
int gdImageSetInterpolationMethod( gdImagePtr im, gdInterpolationMethod id )
Get the current interpolation method
gdInterpolationMethod gdImageGetInterpolationMethod( gdImagePtr im )
Copy a resized area from an image to another image
void gdImageCopyResized ( 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 gdImageCopyResampled ( gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH )
Copy a rotated 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 )