CLIP home page

## Functions gd*()

Functions gd* drawing grpahpics primitives( rectangle, oval, lines...) and working with PNG,JPEG,... formats. Original introduction the libgd

#### imagePtr=gdImageCreate(xSize, ySize)

Creating graphics image with size xSize x ySize, return pointer to image imagePtr

#### imagePtr=gdImageCreateFromPNG(filename)
imagePtr=gdImageCreateFromGD(filename)
imagePtr=gdImageCreateFromGD2(filename)
imagePtr=gdImageCreateFromXBM(filename)
imagePtr=gdImageCreateFromJPEG(filename)

Creating graphics image from file.

#### imagePtr=gdImageCreateFromXPM(filename)
Not worked in this time, because required more X11 library...

#### imagePtr=gdImageCreateFromFILE(filename[, typeFile])

Creating graphics image from file
typeFile is the type file - one from:

    	#define	GDFILE_PNG	1
    	#define	GDFILE_GD	2
    	#define GDFILE_GD2	3
    	#define GDFILE_XBM	4
    	#define GDFILE_JPEG	6

By default GDFILE_PNG.(see include/gdinfo.ch) gdImageCreateFromFILE("-|",<typeFile>) -reading the stdin

#### gdImageDestroy(imagePtr)

Destroyed image.

#### gdImagePNG(imagePtr, filename)
gdImageGD(imagePtr, filename)
gdImageGD2(imagePtr, filename)
gdImageJPEG(imagePtr, filename)

Writing image imagePtr to filename
gdImage...(imagePtr, "|-") writing image to stdout

#### gdImageToFile(imagePtr, filename[, typeFile])

Writing image imagePtr to filename
typeFile is the files type (see types in include/gdinfo.ch) By default typeFile = GDFILE_PNG gdImage...(imagePtr, "|-") writing image to stdout

#### color_index=gdColorCreate(imagePtr, Red, Green, Blue)

Exacting and allocating RGB colors and return colors index

#### gdColorTransparent(imagePtr, color_index)

Set transparent color.

#### gdImageInterlace(imagePtr, interlaced)

Set image interlace

#### gdImageCompare(imagePtr1, imagePtr2)

Compare imagePtr1 and imagePtr2 bit by bit.

#### gdColorInfo(imagePtr, infoIndex, color_index)

Return image info by index infoIndex:
GDINFO_COLORSTOTAL
GDINFO_TRANSPARENT
GDINFO_INTERLACED
GDINFO_COLORRED
GDINFO_COLORGREEN
GDINFO_COLORBLUE
GDINFO_SIZEX
GDINFO_SIZEY
see gdinfo.ch

#### gdImageGetPixel(imagePtr, x, y)

Return color index in point x,y

#### gdImageSetPixel(imagePtr, x, y, color_index)

Draws a point in x, y using the color color_index

#### gdImageBoundsSafe(imagePtr, x, y)

#### gdImageLine(imagePtr, x1, y1, x2, y2, color_index)

Draws line using the color color_index

#### gdImageDashedLine(imagePtr, x1, y1, x2, y2, color_index)

Draws dashed line, using the color color_index

#### gdImageRectangle(imagePtr, x1, y1, x2, y2, color_index)

Draws a rectangle, using the color color_index

#### gdImageFilledRectangle(imagePtr, x1, y1, x2, y2, color_index)

Draws filled rectangle, using the color color_index

#### gdImageArc(imagePtr, cx, cy, width, high, startangle, endangle, color_index)

Draws an arc using color color_index. The arc is defined by the bounding rectangle of the entire ellipse, and the start and end angles of the part of the ellipse to be drawn.
cx the x coordinate
cy the y coordinate
width the width of the bounding rectangle. height the height of the bounding rectangle. startangle the start angle of the arc endangle the end angle of the arc

#### gdImageFilledArc(imagePtr, cx, cy, width, high, color_index)

Draws an arc using color color_index.

#### gdImageFill(imagePtr, x, y, color_index)

Fills the image using color color_indexbegining with point (x,y) in colors bounds

#### gdImageFillToBorder(imagePtr, x, y, bordercolor, color_index)

Fills the image using color color_indexbegining with point (x,y) in <bordercolor> bounds

#### gdImagePolygon(imagePtr, {{x1,y1}, {x2,y2}, ...{xn,yn}}, color_index)

Draws a polygon, using color color_index
{x1,y1}, {x2,y2}, ...{xn,yn} - points of polygon.

#### gdImageFilledPolygon(imagePtr, {{x1,y1}, {x2,y2}, ...{xn,yn}}, color_index)

Draws a filled polygon, using color color_index

#### gdImageSetBrush(imagePtr, imagePtrBrush)

Set image brush.

#### gdImageSetTile(imagePtr, imagePtrTile)

Set image tile (it may bu using for filling functions)

#### gdImageSetStYle(imagePtr, colorsArray)

Set the style a drawing lines. see gdinfo.ch
GDSTYLE_STYLED
GDSTYLE_BRUSHED
GDSTYLE_STYLEDBRUSHED
GDSTYLE_TILED
GDSTYLE_TRANSPARENT

#### gdImageChar(imagePtr, str, x, y, color_index, fontPtr)
gdImageCharUP(imagePtr, str, x, y, color_index, fontPtr)
gdImageString(imagePtr, str, x, y, color_index, fontPtr)
gdImageStringUP(imagePtr, str, x, y, color_index, fontPtr)

Draws a character or string str using color color_index and font fontPtr(see gdinfo.ch)
GDFONT_GIANT
GDFONT_LARGE
GDFONT_NEDIUMBOLD
GDFONT_SMALL
GDFONT_TINY
Functions gdImageCharUp() É gdImageStringUp() draws symbol or string rotateted on 270

#### gdImageCharRotate(imagePtr, str, x, y, color_index, fontPtr, angle)
gdImageStringRotate(imagePtr, str, x, y, color_index, fontPtr, angle)

Draws symbol or string rotateted an angel angel, using color color_index and font fontPtr

#### gdImageCharVector(imagePtr, str, x, y, angle, color_index, fontSize)
gdImageStringVector(imagePtr, str, x, y, angle, color_index, fontSize)

Draws symbol or string rotateted an angel angel in vector graphics, using color color_index and size fontSize

#### gdImageSector(imagePtr, cx, cy, width, high, startangle, endangle, color_index)
gdImageFilledSector(imagePtr, cx, cy, width, high, startangle, endangle, color_index)

Draws a sector and filled sector, using color color_index.
cx the x coordinate
cy the y coordinate
width the width of the bounding rectangle. height the height of the bounding rectangle. startangle the start angle of the sector endangle the end angle of the sector

#### gdImageTruncSector(imagePtr, cx, cy, width, high, widthtr, hightr, startangle, endangle, color_index)
gdImageFilledTruncSector(imagePtr, cx, cy, width, high, widthtr, hightr, startangle, endangle, color_index)

Draws a truncated sector and filled truncated sector, using color color_index.
cx the x coordinate
cy the y coordinate
width the external width of the bounding rectangle. height the external height of the bounding rectangle. widthtr the internal width of the bounding rectangle. heighttr the internal height of the bounding rectangle. startangle the start angle of the sector endangle the end angle of the sector

#### Color index

Color index:
- color_index

    For example:
    	#include <gdinfo.ch>
    	.....
    	image=gdImageCreate(100, 100)
    	.....
    	color=gdColorCreate(brush, 255, 255)

    	gdImageLine(image, 10, 10, 90, 90, color)
    	....

- imageBrush

    For example:
    	#include <gdinfo.ch>
    	.....
    	image=gdImageCreate(100, 100)
    	.....
    	brush=gdImageCreate(3, 3)
    	gdImageFill(brush, 0, 0, gdColorCreate(brush, 255, 255))

    	gdImageSetBrush(image, brush)

    	gdImageLine(image, 10, 10, 90, 90, GDSTYLE_BRUSHED)
    	....

- imageTile

    For example:
    	#include <gdinfo.ch>
    	.....
    	image=gdImageCreate(100, 100)
    	.....
    	tile=gdImageCreateFromFile("tile.png", GDFILE_PNG)

    	gdImageSetTile(image, tile)

    	gdImageFill(image, 0, 0, GDSTYLE_TILED)
    	....

CLIP home page

© à.èÎÙËÉÎ, uri@itk.ru, 2000