This repository has been archived by the owner on Mar 31, 2018. It is now read-only.
API
taggon edited this page May 25, 2011
·
6 revisions
For exact documentation, see GD reference.
Creation methods return new Image object which is represented by image.
image is an instance of Image object.
Most of Image’s methods return self object, so you can use function chaning like this:
var black = image.colorAllocate(0,0,0);
image.line(0,0,10,20,black).filledRectangle(10,20,50,60,black);
Image openJpeg(filepath) // synchronous way
void openJpeg(filepath, callback) // asynchronous way
Image openPng(filepath)
void openPng(filepath, callback)
Image openGif(filepath)
void openGif(filepath, callback)
Image openGd(filepath)
void openGd(filepath, callback)
Image openGd2Part(filepath, srcX, srcY, width, height)
void openGd2Part(filepath, srcX, srcY, width, height, callback)
Image openWBMP(filepath)
void openWBMP(filepath, callback)
Image create(width, height)
Image createTrueColor(width, height)
Image createFromJpeg(filepath)
Image createFromJpegPtr(data)
Image createFromPng(filepath)
Image createFromPngPtr(data)
Image createFromGif(filepath)
Image createFromGifPtr(data)
Image createFromGd2(filepath)
Image createFromGd2Ptr(data)
Image createFromGd2Part(filepath, srcX, srcY, width, height)
Image createFromGd2Part(data, srcX, srcY, width, height)
Image createFromWBMP(filepath)
Image createFromWBMPtr(data)
Image image.setPixel(x, y, color)
Image image.line(x1, y1, x2, y2, color)
Draw a line between two endpoints(x1,y1 and x2,y2).
var black = image.colorAllocate(0, 0, 0);
image.line(0, 0, 100, 100);
Image image.dashedLine(x1, y1, x2, y2, color)
Draw a dashed line between two endpoints(x1,y1 and x2,y2).
Image image.polygon(points, color)
Draw a polygon with the array of points(at least 3).
var points = [
{x:0, y:100},
{x:100, y:100},
{x:0, y:100}
];
image.polygon(points, black);
Image image.filledPolygon(points, color);
Draw a filled polygon with the array of points(at least 3).