CLIP home page

## Class GDIMAGE

Class GDIMAGE drawing grpahpics primitives( rectangle, oval, lines...) and working with PNG,JPEG,... formats. Original introduction the libgd
and see introduction for a gd* functions
and business graphics
Simple example:

    im=GdImageNew(200, 200)
    // creating colors
    white=im:newColor(255, 255, 255) // white
    black=im:newColor() // black
    red=im:newColor(255) // red
    blue=im:newColor(,,255) // blue
    yellow=im:newColor(255, 255) // yellow
    fon=im:newColor(0xDE,0xEF,0xF5) // gray
    // fills image to white color
    im:fill(0, 0, fon)
    im:filledArc(100, 100, 45, 45, yellow)
    // creating brush
    luch=GdImageNew(3, 3)
    luch:fill(0, 0, luch:newColor(255, 255))
    im:setBrush(luch)
    cx =100
    cy = 100
    for i=0 to 180 step 45
    	x1 = cos(PI*i/180) * 60 + cx
    	y1 = sin(PI*i/180) * 60 + cy
    	x2 = cos(PI*(i+180)/180) * 60 + cx
    	y2 = sin(PI*(i+180)/180) * 60 + cy
    	im:line(x1, y1, x2, y2, GDSTYLE_BRUSHED)
    next
    im:filledArc(93, 90, 6, 6, blue)
    im:filledArc(107, 90, 6, 6, blue)
    im:string("Hello world!", 50, 50, GDFONT_LARGE, black)
    im:stringVector("Привет мир!", 50, 150, 300, 0, black)
    im:filledTruncSector(100, 100, 30, 30, 26, 26, 40, 140, red)
    im:toPNG("asdf.png")

Well picture!

### Attributes

Attributes name | Attributes value
fileName | string
fileType | GDFILE_PNG | GDFILE_GD | GDFILE_GD2 | GDFILE_XBM | GDFILE_JPEG
sizeX | numeric
sizeY | numeric
color | numeric
image | numeric

### Methods/Functions

#### gd:create(sizeX, sizeY)

Create new image sizes sizeX x sizeY

#### gd:fromFile(fileName[, fileType=GDFILE_PNG])

create new image from file fileName and types fileType (by default fileType=GDFILE_PNG)

#### gd:fromPNG(fileName)

create new image from file fileName and types GDFILE_PNG

#### gd:fromGD(fileName)

create new image from file fileName and types GDFILE_GD

#### gd:fromGD2(fileName)

create new image from file fileName and types GDFILE_GD2

#### gd:fromXBM(fileName)

create new image from file fileName and types GDFILE_XBM

#### gd:fromJPEG(fileName)

create new image from file fileName and types GDFILE_JPEG

#### метод gd:destroy()

destroyed image

#### gd:toFile(fileName[, fileType=GDFILE_PNG])

Writing image to fileName and types fileType

#### gd:toPNG(fileName)

Writing image to fileName and types GDFILE_PNG

#### gd:toGD(fileName)

Writing image to fileName and types GDFILE_GD

#### gd:toGD2(fileName)

Writing image to fileName and types GDFILE_GD2

#### gd:toJPEG(fileName)

Writing image to fileName and types GDFILE_JPEG

#### gd:setColor(color)

Sets foreground color.

#### color_index=gd:getColor(color)

Get foreground color.

#### color_index=gd:newColor([Red], [Green], [Blue])

Create and allocate new color.
By default Red=0, Green=0, Blue=0

#### gd:transparent(color_index)

Sets transparent color

#### gd:interlace(interlace)

Sets image interlace

#### gd:compare(imageCmp)

Compare image with imageCmp bit by bit. imageCmp - it's image or object GDIMAGE class.

#### gd:info(index, color_Index)

Get informations about index:
GDINFO_COLORSTOTAL
GDINFO_TRANSPARENT
GDINFO_INTERLACED
GDINFO_COLORRED
GDINFO_COLORGREEN
GDINFO_COLORBLUE
GDINFO_SIZEX
GDINFO_SIZEY

#### gd:getPixel(x, y)

Gets color_index in point x, y

#### gd:setPixel(x, y[, color])

Draws a point in x, y, using color color. If color==NIL, using foregroud color

#### gd:bound(x, y)

Return .t. if point x, y belong image

#### gd:line(x1, y1, x2, y2[, color])

Draws a line, using color color. If color==NIL, using foregroud color

#### gd:dashedLine(x1, y1, x2, y2[, color])

Draws dashed line, using color color. If color==NIL, using foregroud color

#### gd:rectagle(x1, y1, x2, y2[, color])

Draws rectangle, using color color. If color==NIL, using foregroud color

#### gd:filledRectagle(x1, y1, x2, y2[, color])

Draws filled rectangle, using color color. If color==NIL, using foregroud color

#### gd:arc(cx, cy, width[, high, begangle, endangle, color])

Draws an arc, using color color. If color==NIL, using foregroud color 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
By default: high=width, begangle=0, endangle=360

#### gd:filledArc(cx, cy, width[, high, color])

Draws filled arc, using color color. If color==NIL, using foregroud color
By default: high=width

#### gd:sector(cx, cy, width[, high, begangle, endangle, color])

Draws a sector, using color color. If color==NIL, using foregroud color 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
By default: high=width, begangle=0, endangle=360

#### gd:filledSector(cx, cy, width[, high, begangle, endangle, color])

Draws filled sector, using color color. If color==NIL, using foregroud color
By default: high=width, begangle=0, endangle=360

#### gd:truncSector(cx, cy, width, high, widthtrunc, hightrunc, begangle, endangle, color)

Draws truncated sector, using color color. If color==NIL, using foregroud color 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
By default: high=width, begangle=0, endangle=360

#### метод gd:filledTruncSector(cx, cy, width, high, widthtrunc, hightrunc, begangle, endangle, color)

Draws filled truncated sector, using color color. If color==NIL, using foregroud color
By default: high=width, begangle=0, endangle=360

#### gd:polygon(bounds[, color])

Draws a polygon, using color color. If color==NIL, using foregroud color
bounds = {{x1, y1}, {x2, y2}, ..., {xn, yn}} - points of polygon

#### gd:filledPolygon(bounds[, color])

Darws filled polygon, using color color. If color==NIL, using foregroud color
bounds = {{x1, y1}, {x2, y2}, ..., {xn, yn}} - points og polygon

#### gd:fill(x, y[, color])

Fills image using color color. If color==NIL, using foregroud color begining with x, y in colors bounds.

#### gd:fillToBorder(x, y, bordercolor[, color])

Fills image to color bounds, using color color. If color==NIL, using foregroud color

#### gd:setBrush(imagePtrBrush)

Sets image brush imagePtrBrush - it's simple image or object of GDIMAGE class.

#### gd:setTile(imagePtrTile)

Sets image tile.
imagePtrTile - it's image or object of GDIMAGE class.

#### gd:setStyle(colorsArray)

Sets lines style

#### gd:char(str, x, y, font[, color])
gd:charUp(str, x, y, font[, color])
gd:string(str, x, y, font[, color])
gd:stringUp(str, x, y, font[, color])

Draws symbol or string, using color color and font font. If color==NIL, using foregroud color
font: GDFONT_GIANT
GDFONT_LARGE
GDFONT_NEDIUMBOLD
GDFONT_SMALL
GDFONT_TINY
Methods charUp() и stringUp() drawing rotateted symbol or string an 270

#### gd:charRotate(str, x, y, font[, angle, color])
gd:stringRotate(str, x, y, font[, angle, color])

Draws rotateted an angle symbol or string, using color color and font font. If color==NIL, using foregroud color
By default: angle=0

#### gd:charVector(str, x, y, fontSize[, angle, color])
gd:stringVector(str, x, y, fontSize[, angle, color])

Draws rotateted an angle symbol or string in vectors graphics, using color color and size font fontSize. If color==NIL, using foregroud color
By default: angle=0

CLIP home page

© Ю.Хныкин, uri@itk.ru, 2000