Kyuu Primitive Engine Functions
From Spheriki
Kyuu has developed a variety of new graphical primitive functions, intended to simplify more complex drawing procedure with used to be done manually.
Contents |
Use of new functions
In the past, use of these functions has only been available via a branch of sphere exclusively for testing.
As of October 22nd 2007, these functions have been migrated into the sphere CVS source, and is therefore available for compiling. It is not known when they will be officially implemented in the official compilation of sphere (with a new version number).
List of functions
Note: As developing functions, they may be restructured over time.
point2d
A regular JavaScript object with numeric members x and y, e.g. {x: 10, y: 20}. Needed for PointSeries, LineSeries and Polygon.
PointSeries(array, color)
Plots a series of points colored with color onto the video buffer
- @array: an array object, filled with point2d objects
- @color: color object, used to color the points
LineSeries(array, color [, type])
Draws a series of lines onto the video buffer
- @array: an array object, filled with point2d objects
- @color: color object, used to color the lines
- @type: optional, by default 0 (0 = line list; 1 = line strip; 2 = line loop)
BezierCurve(color, step, Ax, Ay, Bx, By, Cx, Cy [, Dx] [, Dy])
Draws a Bezier curve onto the video buffer
- @color: color object, used to color the curve
- @step: a floating point number in the range 0 < step <= 1.0
- @(Ax, Ay): coordinates of the endpoint A
- @(Bx, By): coordinates of A's control point B
- @(Cx, Cy): coordinates of the endpoint C
- @(Dx, Dy): optional, coordinates of C's control point D (if omitted, B is also C's control point)
Polygon(array, color [, invert])
Draws a filled polygon onto the video buffer
- @array: an array object, filled with point2d objects
- @color: color object, used to color the polygon
- @invert: optional, if true (1), the points outside of the polygon are drawn instead
OutlinedRectangle(x, y, width, height, color [, size])
Draws an outlined rectangle with a specified size onto the video buffer
- @(x, y): rectangle's screen position
- @width: rectangle's width
- @height: rectangle's height
- @color: color object, used to color the outline
- @size: optional, by default 1, defines the thickness of the rectangle's outline