Raster
Documentation of the raster library.
The raster
library is a library for creating pixel-based graphics in Halyde. Since OpenComputers graphics are text mode only, raster
uses braille characters to represent pixels. The limitation of this is that there can only be 2 colors per character (or 2x4 pixel chunk): the foreground color and the background color.
raster.init(width: number, height: number, bgcolor: number)
Initializes theraster
library and a render buffer for it.width
: The width of the render buffer.height
: The height of the render buffer.bgcolor
: The background color of the render buffer.raster.clear()
Clears theraster
render buffer.raster.units.charToBraille(x: number, y: number): number, number
Convertsx
andy
in text characters tox
andy
in pixels and returns them.raster.units.brailleToChar(x: number, y: number): number, number
Convertsx
andy
in pixels tox
andy
in text characters and returns them.raster.set(x: number, y: number, color: number): boolean
Sets a pixel atx
andy
to be ofcolor
.color
must be in hex. Returns false ifx
andy
are out of bounds.raster.get(x: number, y: number): number
Returns the color atx
andy
in pixel coordinates.raster.drawLine(x1: number, y1: number, x2: number, y2: number, color: number)
Draws a straight line of color betweenx1``, y1
andx2``, y2
with a color ofcolor
.raster.drawRect(x1: number, y1: number, x2: number, y2: number, color: number)
Draws an unfilled rectangle betweenx1, y1
andx2, y2
with a color ofcolor
.raster.fillRect(x1: number, y1: number, x2: number, y2: number, color: number)
Draws a filled rectangle betweenx1, y1
andx2, y2
with a color ofcolor
.raster.drawCircle(x: number, y: number, radius: number, color: number)
Draws an unfilled circle with the center being atx, y
with a radius ofradius
and a color ofcolor
.raster.fillCircle(x: number, y: number, radius: number, color: number)
Draws a filled circle with the center being atx, y
with a radius ofradius
and a color ofcolor
.raster.drawEllipse(x1: number, y1: number, x2: number, y2: number, color: number)
Draws an unfilled ellipse with one corner being atx1, y1
and the other being atx2, y2
and a color ofcolor
.raster.fillEllipse(x1: number, y1: number, x2: number, y2: number, color: number)
Draws a filled ellipse with one corner being atx1, y1
and the other being atx2, y2
and a color ofcolor
.raster.update()
Renders everything from theraster
render buffer.raster.free()
Uninitializes theraster
library and frees the render buffer.
Last updated