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 therasterlibrary 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 therasterrender buffer.raster.units.charToBraille(x: number, y: number): number, numberConvertsxandyin text characters toxandyin pixels and returns them.raster.units.brailleToChar(x: number, y: number): number, numberConvertsxandyin pixels toxandyin text characters and returns them.raster.set(x: number, y: number, color: number): booleanSets a pixel atxandyto be ofcolor.colormust be in hex. Returns false ifxandyare out of bounds.raster.get(x: number, y: number): numberReturns the color atxandyin pixel coordinates.raster.drawLine(x1: number, y1: number, x2: number, y2: number, color: number)Draws a straight line of color betweenx1``, y1andx2``, y2with a color ofcolor.raster.drawRect(x1: number, y1: number, x2: number, y2: number, color: number)Draws an unfilled rectangle betweenx1, y1andx2, y2with a color ofcolor.raster.fillRect(x1: number, y1: number, x2: number, y2: number, color: number)Draws a filled rectangle betweenx1, y1andx2, y2with a color ofcolor.raster.drawCircle(x: number, y: number, radius: number, color: number)Draws an unfilled circle with the center being atx, ywith a radius ofradiusand a color ofcolor.raster.fillCircle(x: number, y: number, radius: number, color: number)Draws a filled circle with the center being atx, ywith a radius ofradiusand a color ofcolor.raster.drawEllipse(x1: number, y1: number, x2: number, y2: number, color: number)Draws an unfilled ellipse with one corner being atx1, y1and the other being atx2, y2and a color ofcolor.raster.fillEllipse(x1: number, y1: number, x2: number, y2: number, color: number)Draws a filled ellipse with one corner being atx1, y1and the other being atx2, y2and a color ofcolor.raster.update()Renders everything from therasterrender buffer.raster.free()Uninitializes therasterlibrary and frees the render buffer.
Last updated