All graphics functions.
Methods
-
inner Box(x1, y1, x2, y2, c)
-
draw a box.
Parameters:
Name Type Description x1number start x coordinate. y1number start y coordinate. x2number end x coordinate. y2number end y coordinate. cColor color. -
inner Circle(x, y, r, c)
-
draw a circle.
Parameters:
Name Type Description xnumber x coordinate. ynumber y coordinate. rnumber radius. cColor color. -
inner CircleArc(x, y, r, start, end, style, c) → {ArcInfo}
-
Draw a circle arc.
Parameters:
Name Type Description xnumber x coordinate. ynumber y coordinate. rnumber radius. startnumber start angle in tenths of degrees. endnumber end angle in tenths of degrees. style* value from ARC. cColor color. Returns:
ArcInfo - detailed info about the drawn arc. -
inner ClearScreen(c)
-
clear the screen with given color.
Parameters:
Name Type Description cColor the color. -
inner Ellipse(x, y, xr, yr, c)
-
draw a ellipse.
Parameters:
Name Type Description xnumber x coordinate. ynumber y coordinate. xrnumber radius. yrnumber radius. cColor color. -
inner EllipseArc(x, y, xr, yr, start, end, style, c) → {ArcInfo}
-
Draw an ellipse arc.
Parameters:
Name Type Description xnumber x coordinate. ynumber y coordinate. xrnumber radius. yrnumber radius. startnumber start angle in tenths of degrees. endnumber end angle in tenths of degrees. style* value from ARC. cColor color. Returns:
ArcInfo - detailed info about the drawn arc. -
inner FilledBox(x1, y1, x2, y2, c)
-
draw a filled box.
Parameters:
Name Type Description x1number start x coordinate. y1number start y coordinate. x2number end x coordinate. y2number end y coordinate. cColor color. -
inner FilledCircle(x, y, r, c)
-
draw a filled circle.
Parameters:
Name Type Description xnumber x coordinate. ynumber y coordinate. rnumber radius. cColor color. -
inner FilledCircleArc(x, y, r, start, end, style, c) → {ArcInfo}
-
Draw a filled circle arc.
Parameters:
Name Type Description xnumber x coordinate. ynumber y coordinate. rnumber radius. startnumber start angle in tenths of degrees. endnumber end angle in tenths of degrees. style* value from ARC. cColor color. Returns:
ArcInfo - detailed info about the drawn arc. -
inner FilledConvexPolygon(c, points)
-
draw a filled convex polygon.
Parameters:
Name Type Description cColor color. pointsArray.<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 xnumber x coordinate. ynumber y coordinate. xrnumber radius. yrnumber radius. cColor color. -
inner FilledEllipseArc(x, y, xr, yr, start, end, style, c) → {ArcInfo}
-
Draw a filled ellipse arc.
Parameters:
Name Type Description xnumber x coordinate. ynumber y coordinate. xrnumber radius. yrnumber radius. startnumber start angle in tenths of degrees. endnumber end angle in tenths of degrees. style* value from ARC. cColor color. Returns:
ArcInfo - detailed info about the drawn arc. -
inner FilledPolygon(c, points)
-
draw a filled polygon.
Parameters:
Name Type Description cColor color. pointsArray.<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 xnumber x coordinate. ynumber y coordinate. boundColor bound color. cColor fill color. -
inner FloodSpill(x1, y1, x2, y2, old, c)
-
replace a color with another in given area.
Parameters:
Name Type Description x1number start x coordinate. y1number start y coordinate. x2number end x coordinate. y2number 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 x1number start x coordinate. y1number start y coordinate. x2number end x coordinate. y2number 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 x1number start x coordinate. y1number start y coordinate. x2number end x coordinate. y2number end y coordinate. wdtnumber border width. colorsArray.<Color> [intcolor, topcolor, rightcolor, bottomcolor, leftcolor] -
inner Line(x1, y1, x2, y2, c)
-
draw a line.
Parameters:
Name Type Description x1number start x coordinate. y1number start y coordinate. x2number end x coordinate. y2number end y coordinate. cColor 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 threshnumber threshold accelnumber acceleration. -
inner MouseSetColors(fg, bg)
-
Set mouse pointer colors.
-
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. cColor color. x1number start x coordinate. y1number start y coordinate. x2number end x coordinate. y2number end y coordinate. xanchornumber anchor x coordinate. yanchornumber 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 x1number start x coordinate. y1number start y coordinate. x2number end x coordinate. y2number end y coordinate. -
inner MouseSetSpeed(spmul, spdiv)
-
Set mouse speed by multiplying by spmult and dividing by spdiv.
Parameters:
Name Type Description spmulnumber multiplicator. spdivnumber divider. -
inner MouseShowCursor(b)
-
Show hide mouse cursor.
Parameters:
Name Type Description bboolean true or false. -
inner MouseWarp(x, y)
-
Move mouse cursor.
Parameters:
Name Type Description xnumber x coordinate. ynumber 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 xnumber x coordinate. ynumber y coordinate. cColor color. -
inner Polygon(c, points)
-
draw a polygon.
Parameters:
Name Type Description cColor color. pointsArray.<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 cColor color. pointsArray.<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 fnamestring filename. -
inner SavePngImage(fname)
-
Save current screen to PNG file.
Parameters:
Name Type Description fnamestring 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 xnumber x coordinate. ynumber y coordinate. text* the text to display. fgColor foreground color. bgColor background color.