Module

gfx

All graphics functions.

Methods

# inner Box(x1, y1, x2, y2, c)

draw a box.

Parameters:
Name Type Description
x1 number

start x coordinate.

y1 number

start y coordinate.

x2 number

end x coordinate.

y2 number

end y coordinate.

c number

color.

# inner Circle(x, y, r, c)

draw a circle.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

r number

radius.

c number

color.

# inner CircleArc(x, y, r, start, end, style, c) → {ArcInfo}

Draw a circle arc.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

r number

radius.

start number

start angle with 256 representing a full circle.

end number

end angle with 256 representing a full circle.

style *

value from ARC.

c number

color.

detailed info about the drawn arc.

ArcInfo

# inner ClearScreen(c)

clear the screen with given color.

Parameters:
Name Type Description
c number

the color.

# inner CustomCircle(x, y, r, w, c)

draw a circle with given width.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

r number

radius.

w number

line width.

c number

color.

# inner CustomCircleArc(x, y, r, start, end, style, w, c) → {ArcInfo}

Draw a circle arc with given width.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

r number

radius.

start number

start angle with 256 representing a full circle.

end number

end angle with 256 representing a full circle.

style *

value from ARC.

w number

line width.

c number

color.

detailed info about the drawn arc.

ArcInfo

# inner CustomEllipse(x, y, xr, yr, w, c)

draw a ellipse with given width.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

xr number

radius.

yr number

radius.

w number

line width.

c number

color.

# inner CustomLine(x1, y1, x2, y2, w, c)

draw a line with given width.

Parameters:
Name Type Description
x1 number

start x coordinate.

y1 number

start y coordinate.

x2 number

end x coordinate.

y2 number

end y coordinate.

w number

line width.

c number

color.

# inner Ellipse(x, y, xr, yr, c)

draw a ellipse.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

xr number

radius.

yr number

radius.

c number

color.

# inner FilledBox(x1, y1, x2, y2, c)

draw a filled box.

Parameters:
Name Type Description
x1 number

start x coordinate.

y1 number

start y coordinate.

x2 number

end x coordinate.

y2 number

end y coordinate.

c number

color.

# inner FilledCircle(x, y, r, c)

draw a filled circle.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

r number

radius.

c number

color.

# inner FilledEllipse(x, y, rx, ry, c)

draw a filled ellipse.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

rx number

radius.

ry number

radius.

c number

color.

# inner FilledPolygon(points, c)

draw a filled polygon.

Parameters:
Name Type Description
points Array.<Array.<number>>

an array of arrays with two coordinates (e.g. [[1, 1], [1, 10], [10, 10], [10, 1]]).

c number

color.

# inner FloodFill(x, y, bound, c)

do a flood fill.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

bound number

bound color.

c number

fill color.

# inner GetPixel(x, y) → {number}

get color of on-screen pixel.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

pixel color.

number

# inner GetScreenMode() → {number}

Get color depth info.

bits per pixel.

number

# inner Line(x1, y1, x2, y2, c)

draw a line.

Parameters:
Name Type Description
x1 number

start x coordinate.

y1 number

start y coordinate.

x2 number

end x coordinate.

y2 number

end y coordinate.

c number

color.

# inner Plot(x, y, c)

draw a point.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

c number

color.

# inner SaveBmpImage(fname)

Save current screen to BMP file.

Parameters:
Name Type Description
fname string

filename.

# inner SavePcxImage(fname)

Save current screen to PCX file.

Parameters:
Name Type Description
fname string

filename.

# inner SavePngImage(fname)

Save current screen to PNG file.

Note: PNG module must be loaded by calling LoadLibrary("png") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# inner SaveTgaImage(fname)

Save current screen to TGA file.

Parameters:
Name Type Description
fname string

filename.

# inner SetRenderBitmap(bm)

set the current render destination.

Parameters:
Name Type Description
bm Bitmap

A Bitmap to render on or null to use the screen as rendering destination.

# inner SizeX() → {number}

get the width of the drawing area.

the width of the drawing area.

number

# inner SizeY() → {number}

get the height of the drawing area.

the height of the drawing area.

number

# inner TextXY(x, y, text, fg, bg)

Draw a text with the default font.

Parameters:
Name Type Description
x number

x coordinate.

y number

y coordinate.

text *

the text to display.

fg number

foreground color.

bg number

background color.

# inner TransparencyEnabled(mode)

Set the blend mode for drawing.

Parameters:
Name Type Description
mode number

one of the blend modes, e.g. BLEND.ALPHA or BLEND.REPLACE.

See:
  • BLEND in the color module