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().
sx | The image width. |
sy | The image height. |
A pointer to the new image or NULL if an error occurred.
gdImagePtr im; im = gdImageCreate(64, 64); // ... Use the image ... gdImageDestroy(im);
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.
sx | The image width. |
sy | The image height. |
A pointer to the new image or NULL if an error occurred.
gdImagePtr im; im = gdImageCreateTrueColor(64, 64); // ... Use the image ... gdImageDestroy(im);
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.
im | Pointer to the gdImage to delete. |
Nothing.
gdImagePtr im; im = gdImageCreate(10, 10); // ... Use the image ... // Now destroy it gdImageDestroy(im);
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.
void gdSetErrorMethod( gdErrorMethod error_method )
void gdClearErrorMethod( void )
int gdImageGetTrueColorPixel ( gdImagePtr im, int x, int y )
gdImageCreate is called to create palette-based images, with no more than 256 colors.
gdImagePtr gdImageCreate ( int sx, int sy )
gdImageCreateTrueColor is called to create truecolor images, with an essentially unlimited number of colors.
gdImagePtr gdImageCreateTrueColor ( int sx, int sy )
gdImageDestroy is used to free the memory associated with an image.
void gdImageDestroy ( gdImagePtr im )
int gdImageColorClosest ( gdImagePtr im, int r, int g, int b )
int gdImageColorClosestAlpha ( gdImagePtr im, int r, int g, int b, int a )
int gdImageColorClosestHWB ( gdImagePtr im, int r, int g, int b )
int gdImageColorExact ( gdImagePtr im, int r, int g, int b )
int gdImageColorExactAlpha ( gdImagePtr im, int r, int g, int b, int a )
int gdImageColorAllocate ( gdImagePtr im, int r, int g, int b )
int gdImageColorAllocateAlpha ( gdImagePtr im, int r, int g, int b, int a )
gdImageColorResolve is an alternative for the code fragment
int gdImageColorResolve ( gdImagePtr im, int r, int g, int b )
int gdImageColorResolveAlpha ( gdImagePtr im, int r, int g, int b, int a )
void gdImageColorDeallocate ( gdImagePtr im, int color )
void gdImageColorTransparent ( gdImagePtr im, int color )
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 )
NO-OP, kept for library compatibility.
void gdImageAABlend ( gdImagePtr im )
Bresenham as presented in Foley & Van Dam.
void gdImageLine ( gdImagePtr im, int x1, int y1, int x2, int y2, int color )
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 )
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 )
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 )
void gdImageFilledRectangle ( gdImagePtr im, int x1, int y1, int x2, int y2, int color )
gdImagePtr gdImageClone ( gdImagePtr src )
void gdImageCopy ( gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h )
This function is a substitute for real alpha channel operations, so it doesn’t pay attention to the alpha channel.
void gdImageCopyMerge ( gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct )
This function is a substitute for real alpha channel operations, so it doesn’t pay attention to the alpha channel.
void gdImageCopyMergeGray ( gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct )
void gdImageCopyResized ( gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH )
void gdImageCopyRotated ( gdImagePtr dst, gdImagePtr src, double dstX, double dstY, int srcX, int srcY, int srcWidth, int srcHeight, int angle )
void gdImageCopyResampled ( gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH )
void gdImagePolygon ( gdImagePtr im, gdPointPtr p, int n, int c )
void gdImageOpenPolygon ( gdImagePtr im, gdPointPtr p, int n, int c )
void gdImageFilledPolygon ( gdImagePtr im, gdPointPtr p, int n, int c )
void gdImageSetStyle ( gdImagePtr im, int * style, int noOfPixels )
void gdImageSetThickness ( gdImagePtr im, int thickness )
void gdImageSetBrush ( gdImagePtr im, gdImagePtr brush )
void gdImageSetTile ( gdImagePtr im, gdImagePtr tile )
void gdImageSetAntiAliased ( gdImagePtr im, int c )
void gdImageSetAntiAliasedDontBlend ( gdImagePtr im, int c, int dont_blend )
void gdImageInterlace ( gdImagePtr im, int interlaceArg )
int gdImageCompare ( gdImagePtr im1, gdImagePtr im2 )
int gdAlphaBlend ( int dst, int src )
int gdLayerOverlay ( int dst, int src )
Apply ‘multiply’ effect.
int gdLayerMultiply ( int dst, int src )
void gdImageAlphaBlending ( gdImagePtr im, int alphaBlendingArg )
void gdImageSaveAlpha ( gdImagePtr im, int saveAlphaArg )
void gdImageSetClip ( gdImagePtr im, int x1, int y1, int x2, int y2 )
void gdImageGetClip ( gdImagePtr im, int * x1P, int * y1P, int * x2P, int * y2P )
void gdImageSetResolution( gdImagePtr im, const unsigned int res_x, const unsigned int res_y )
Convert a palette image to true color.
int gdImagePaletteToTrueColor( gdImagePtr src )