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 Color 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 Color 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 in tenths of degrees.
end number end angle in tenths of degrees.
style * value from ARC.
c Color color.
Returns:
ArcInfo - detailed info about the drawn arc.

inner ClearScreen(c)

clear the screen with given color.
Parameters:
Name Type Description
c Color the 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 Color color.

inner EllipseArc(x, y, xr, yr, start, end, style, c) → {ArcInfo}

Draw an ellipse arc.
Parameters:
Name Type Description
x number x coordinate.
y number y coordinate.
xr number radius.
yr number radius.
start number start angle in tenths of degrees.
end number end angle in tenths of degrees.
style * value from ARC.
c Color color.
Returns:
ArcInfo - detailed info about the drawn arc.

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 Color 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 Color color.

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

Draw a filled circle arc.
Parameters:
Name Type Description
x number x coordinate.
y number y coordinate.
r number radius.
start number start angle in tenths of degrees.
end number end angle in tenths of degrees.
style * value from ARC.
c Color color.
Returns:
ArcInfo - detailed info about the drawn arc.

inner FilledConvexPolygon(c, points)

draw a filled convex polygon.
Parameters:
Name Type Description
c Color color.
points Array.<Array.<number>> an array of arrays with two coordinates (e.g. [[1, 1], [1, 10], [10, 10], [10, 1]]).

inner FilledEllipse(x, y, xr, yr, c)

draw a filled ellipse.
Parameters:
Name Type Description
x number x coordinate.
y number y coordinate.
xr number radius.
yr number radius.
c Color color.

inner FilledEllipseArc(x, y, xr, yr, start, end, style, c) → {ArcInfo}

Draw a filled ellipse arc.
Parameters:
Name Type Description
x number x coordinate.
y number y coordinate.
xr number radius.
yr number radius.
start number start angle in tenths of degrees.
end number end angle in tenths of degrees.
style * value from ARC.
c Color color.
Returns:
ArcInfo - detailed info about the drawn arc.

inner FilledPolygon(c, points)

draw a filled polygon.
Parameters:
Name Type Description
c Color color.
points Array.<Array.<number>> an array of arrays with two coordinates (e.g. [[1, 1], [1, 10], [10, 10], [10, 1]]).

inner FloodFill(x, y, bound, c)

do a flood fill.
Parameters:
Name Type Description
x number x coordinate.
y number y coordinate.
bound Color bound color.
c Color fill color.

inner FloodSpill(x1, y1, x2, y2, old, c)

replace a color with another in given area.
Parameters:
Name Type Description
x1 number start x coordinate.
y1 number start y coordinate.
x2 number end x coordinate.
y2 number end y coordinate.
old * color to replace.
c * new color.

inner FloodSpill2(x1, y1, x2, y2, old1, c1, old2, c2)

replace two colors with another in given area.
Parameters:
Name Type Description
x1 number start x coordinate.
y1 number start y coordinate.
x2 number end x coordinate.
y2 number end y coordinate.
old1 * color to replace.
c1 * new color.
old2 * color to replace.
c2 * new color.

inner FramedBox(x1, y1, x2, y2, wdt, colors)

draw a framed box (3D effect 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.
wdt number border width.
colors Array.<Color> [intcolor, topcolor, rightcolor, bottomcolor, leftcolor]

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 Color color.

inner MaxX() → {number}

get the max X coordinate on the drawing area.
Returns:
number - the max X coordinate on the drawing area.

inner MaxY() → {number}

get the max Y coordinate on the drawing area.
Returns:
number - the max Y coordinate on the drawing area.

inner MouseCursorIsDisplayed() → {boolean}

Check if the cursor is visible
Returns:
boolean - true or false.

inner MouseGetLimits() → {MouseLimits}

Get mouse limits.
Returns:
MouseLimits - current mouse limits.

inner MouseSetAccel(thresh, accel)

Set mouse acceleration. If a mouse coordinate changes between two samplings by more than the thresh parameter, the change is multiplied by the accel parameter.
Parameters:
Name Type Description
thresh number threshold
accel number acceleration.

inner MouseSetColors(fg, bg)

Set mouse pointer colors.
Parameters:
Name Type Description
fg Color foreground color.
bg Color background color.

inner MouseSetCursorMode(mode, c, x1, y1, x2, y2, xanchor, yanchor)

Change mode of the mouse cursor.
Parameters:
Name Type Description
mode * a mode from MOUSE.
c Color color.
x1 number start x coordinate.
y1 number start y coordinate.
x2 number end x coordinate.
y2 number end y coordinate.
xanchor number anchor x coordinate.
yanchor number anchor y coordinate.
Examples
MouseSetCursorMode(MOUSE.Mode.NORMAL)
MouseSetCursorMode(MOUSE.Mode.RUBBER,xanchor,yanchor,c)
MouseSetCursorMode(MOUSE.Mode.LINE,xanchor,yanchor,c)
MouseSetCursorMode(MOUSE.Mode.BOX,x1,y1,x2,y2,c)

inner MouseSetLimits(x1, y1, x2, y2)

Limit mouse movement.
Parameters:
Name Type Description
x1 number start x coordinate.
y1 number start y coordinate.
x2 number end x coordinate.
y2 number end y coordinate.

inner MouseSetSpeed(spmul, spdiv)

Set mouse speed by multiplying by spmult and dividing by spdiv.
Parameters:
Name Type Description
spmul number multiplicator.
spdiv number divider.

inner MouseShowCursor(b)

Show hide mouse cursor.
Parameters:
Name Type Description
b boolean true or false.

inner MouseWarp(x, y)

Move mouse cursor.
Parameters:
Name Type Description
x number x coordinate.
y number y coordinate.

inner NumColors() → {number}

Get number of possible colors.
Returns:
number - number of possible colors.

inner NumFreeColors() → {number}

Get number of remaining free colors.
Returns:
number - number of remaining free colors.

inner Plot(x, y, c)

draw a point.
Parameters:
Name Type Description
x number x coordinate.
y number y coordinate.
c Color color.

inner Polygon(c, points)

draw a polygon.
Parameters:
Name Type Description
c Color color.
points Array.<Array.<number>> an array of arrays with two coordinates (e.g. [[1, 1], [1, 10], [10, 10], [10, 1]]).

inner PolyLine(c, points)

draw a polyline.
Parameters:
Name Type Description
c Color color.
points Array.<Array.<number>> an array of arrays with two coordinates (e.g. [[1, 1], [1, 10], [10, 10], [10, 1]]).

inner SaveBmpImage(fname)

Save current screen to BMP file.
Parameters:
Name Type Description
fname string filename.

inner SavePngImage(fname)

Save current screen to PNG file.
Parameters:
Name Type Description
fname string filename.

inner SizeX() → {number}

get the width of the drawing area.
Returns:
number - the width of the drawing area.

inner SizeY() → {number}

get the height of the drawing area.
Returns:
number - the height of the drawing area.

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 Color foreground color.
bg Color background color.