Appendix D. GD SDK Language Reference

This appendix is the language reference for Boutell’s GD graphics library. Each function is listed with the parameters it receives, what the function returns, and a short description of what the function does. GD Functions

Function Returns Description
GetImageSize(filename, [image_info) Array Gets the size of the image.
Image2wbmp(image, [filename], [threshold]) Integer Saves the image as a WBMP.
ImageAlphaBlending(image, blendmode) Integer Switches alpha blending on or off by setting blendmode to true or false, respectively.
ImageArc(image, cx, cy, width, height, start, end, col) Integer Draws a partial ellipse in the specified image. The center point of the arc is at cx, cy.
ImageChar(image, font, x, y, c, col) Integer Draws a character horizontally on the specified image.
ImageCharUp(image, font, x, y, c, col) Integer Draws a character vertically on the specified image.
ImageColorAllocate(img, red, green, blue) Integer Allocates the specified RGB color value for the image.
ImageColorAt(img, x, y) Integer Returns the index of the color at x, y.
ImageColorClosest(img, red, green, blue) Integer Returns the index to the closest color in the color palette for the image.
ImageColorClosestAlpha(image, red, green, blue, alpha) Integer Returns the index of the closest color to the specified color plus the alpha palette for the specified image.
ImageColorClosestHwb(image, red, green, blue) Integer Returns the index of the color with the hue, white, and blackness closest to the RGB value specified.
ImageColorDeallocate(image, index) Integer Deallocates a color in the specified image.
ImageColorExact(img, red, green, blue) Integer Returns the index of the specified color in the color palette of the image.
ImageColorExactAlpha(image, red, green, blue, alpha) Integer Returns the index of the specified color in the color palette plus the alpha channel for the image.
ImageColorResolve(img, red, green, blue) Integer Finds the specified color in the palette. If it doesn’t exist, it returns the index to the closest color in the palette.
ImageColorResolveAlpha(img, red, green, blue, alpha) Integer Finds the specified color in the palette. If it doesn’t exist, it returns the index to the closest color in the palette plus the images alpha channel.
ImageColorSet(img, index, red, green, blue) Boolean Sets the specified index to the RGB color value.
ImageColorsForIndex(img, index) Array Returns an array containing the RGB values for the specified index in the color palette.
ImageColorsTotal(img) Integer Returns the number of colors in the specified images color palette.
ImageTrueColorToPalette(image, dither, colors) void Converts a true-color image into a palletized image.
ImageColorTransparent(img, [color]) Integer Sets the transparent color in the palette.
ImageCopy(dest_image, src_image, dest_x, dest_y, src_x, src_y, src_w, src_h) Integer Copies an area from the source image to the destination image.
ImageCopyMerge(dest_image, src_image, dest_x, dest_y, src_x, src_y, src_w, src_h, pct) Integer Copies an area from the source image to the destination image. The amount of the merge is specified by the value pct (0–100).
ImageCopyMergeGray(dest_image, src_image, dest_x, dest_y, src_x, src_y, src_w, src_h, pct)Integer Works exactly like ImageCopyMerge() but the area being copied is first converted to grayscale.
ImageCopyResampled(dest_image, src_image, dest_x, dest_y, src_x, src_y, dest_w, dest_h, src_w, src_h)Integer Copies and resamples the area from the source image.
ImageCopyResized(dest_img, src_img, destX, destY, srcX, srcY, destWidth, destHeight, srcWidth, srcHeight) Integer Copies an area from the source image to an array of the destination image. If the heights are different then the destination image is resized.
ImageCreate(width, height) Integer Creates a new image.
ImageCreateFromGif(filename) Integer Creates a new image from the specified file.
ImageCreateFromJpeg(filename) Integer Creates a new image from the specified file.
ImageCreateFromPng(filename) Integer Creates a new image from the specified file.
ImageCreateFromString(string) Integer Creates a new image from the data in the string.
ImageCreateFromWbmp(filename) Integer Creates a new image from the file.
ImageCreateFromXbm(filename) Integer Creates a new image from the file.
ImageCreateFromXpm(filename) Integer Creates a new image from the file.
ImageCreateTrueColor(width, height) Integer Creates a new true color image of width by height.
ImageDashedLine(img, x1, y1, x2, y2, color) Integer Draws a dashed line in the image from point x1, y1 to point x2, y2.
ImageDestroy(img) Integer Destroys the specified image.
ImageEllipse(image, x, y, width, height, color)Integer Draws an ellipse with the center point at x, y.
ImageFill(img, x, y, color) Integer Fills the image starting at point x, y.
ImageFilledArc(image, x, y, width, height, start, end, color, style)Integer Draws a filled-in arc centered at point x, y.
ImageFilledEllipse(image, x, y, width, height, color) Integer Draws a filled ellipse in the image with its center point at x, y.
ImageFilledPolygon(img, points, num_points, color) Integer Draws a filled polygon in the image between the points.
ImageFilledRectangle(img, x1, y1, x2, y2, color)Integer Draws a filled rectangle in the specified image.
ImageFillToBorder(img, x, y, border, color) Integer Performs a flood-fill between the specified border color starting at point x, y.
ImageFontHeight(font) Integer Returns the height of the specified font in pixels.
ImageFontWidth(font) Integer Returns the width of the specified font in pixels.
ImageGammaCorrect(image,inputgamma, outputgamma)Integer Corrects the gamma to the specified image.
ImageGif(img, [filename]) Integer Sends the image to a file or to the browser.
ImageInterlace(img, [interlace]) Integer Turns interlacing on or off in the image.
ImageJpeg(image, [filename], [quality]) Integer Sends the image to a file or to the browser.
ImageLine(img, x1, y1, x2, y2, color) Integer Draws a line in the image from point x1, y1 to point x2, y2.
ImagePng(image, [filename]) Integer Sends the image to a file or to the browser.
ImageSetPixel(image, x, y, color) Integer Draws a pixel at point x, y in the specified color.
ImagePolygon(img, points, num_points, color) Integer Draws a polygon in the image, much like polygon fill except it doesn’t fill the image.
ImageRectangle(img, x1, y1, x2, y2, color) Integer Draws a rectangle to the image. Acts much like ImageRectangleFill() but the rectangle is not filled when it is drawn.
ImageString(img, font, x, y, string, color) Integer Draws a string starting at x, y to the image.
ImageTTFString(image, size, angle, x, y, color, fontfile, text) Array Draws the text starting at point x, y in the specified TrueType font.
ImageTTFText(image, size, angle, x, y, color, fontfile, text) Array Draws the text starting at point x, y in the specified TrueType font.
ImageWbmp(image, [filename], [foreground]) Integer Creates a WBMP file from the specified image.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset