Module guih.lib.pixelbox

Drawing chararacter utilities to make precision drawing easier

Functions

new (terminal[, background[, existing]]) creates a new pixelbox canvas in an term object
canvas:push_updates () procceses the canvas and pushes the updates into the draw buffer
canvas:draw () draws the current canvas to the screen from the draw buffer
canvas:clear (background) clears the canvas with set background color
canvas:get_pixel (x, y) reads a pixel from a specific cordinate in the canvas.
canvas:set_pixel (x, y, color[, thickness]) writes a pixel to the canvas with a set color
canvas:set_box (start_x, start_y, end_x, end_y, color) draws a box between 2 sets of cordinates
canvas:set_ellipse (x, y, radius_x, radius_y, color[, filled[, thickness]]) draws an ellipse ellipse with set vertical and horizonal radius
canvas:set_circle (x, y, radius, color[, filled[, thickness]]) draws an circle with set radius
canvas:set_triangle (x1, y1, x2, y2, x3, y3, color[, filled[, thickness]]) draws a triangle from 3 sets of points
canvas:set_line (x1, y1, x2, y2, color[, thickness]) draws a line between 2 points


Functions

new (terminal[, background[, existing]])
creates a new pixelbox canvas in an term object

Parameters:

  • terminal terminal the terminal to draw the canvas on
  • background number the background color to fill the new canvas with (optional)
  • existing table have the new canvas be made from an existing one (optional)

Returns:

    table the resulting pixelbox canvas
canvas:push_updates ()
procceses the canvas and pushes the updates into the draw buffer
canvas:draw ()
draws the current canvas to the screen from the draw buffer
canvas:clear (background)
clears the canvas with set background color

Parameters:

  • background number color to fill the canvas with
canvas:get_pixel (x, y)
reads a pixel from a specific cordinate in the canvas. not the draw buffer

Parameters:

  • x number the x position of the pixel
  • y number the y position of the pixel

Returns:

    number the color of the pixel
canvas:set_pixel (x, y, color[, thickness])
writes a pixel to the canvas with a set color

Parameters:

  • x number the x position of the pixel
  • y number the y position of the pixel
  • color number the color to write to the pixel
  • thickness number the thickness of the pixel (optional)
canvas:set_box (start_x, start_y, end_x, end_y, color)
draws a box between 2 sets of cordinates

Parameters:

  • start_x number the x position for the start of the rectangle
  • start_y number the y position for the start of the rectangle
  • end_x number the x position for the end of the rectangle
  • end_y number the y position for the end of the rectangle
  • color number the color to draw the rectangle with
canvas:set_ellipse (x, y, radius_x, radius_y, color[, filled[, thickness]])
draws an ellipse ellipse with set vertical and horizonal radius

Parameters:

  • x number the x position of the center of the ellipse
  • y number the y position of the center of the ellipse
  • radius_x number the horizontal radius of the ellipse
  • radius_y number the vertical radius of the ellipse
  • color number the color to draw the ellipse with
  • filled boolean whether the ellipse should be filled or not (optional)
  • thickness number the thickness of the ellipses points (optional)
canvas:set_circle (x, y, radius, color[, filled[, thickness]])
draws an circle with set radius

Parameters:

  • x number the x position of the center of the circle
  • y number the y position of the center of the circle
  • radius number the radius of the circle
  • color number the color to draw the circle with
  • filled boolean whether the circle should be filled or not (optional)
  • thickness number the thickness of the circle points (optional)
canvas:set_triangle (x1, y1, x2, y2, x3, y3, color[, filled[, thickness]])
draws a triangle from 3 sets of points

Parameters:

  • x1 number the x position of the first point
  • y1 number the y position of the first point
  • x2 number the x position of the second point
  • y2 number the y position of the second point
  • x3 number the x position of the third point
  • y3 number the y position of the third point
  • color number the color to draw the triangle with
  • filled boolean whether the triangle should be filled or not (optional)
  • thickness number the thickness of the triangle points (optional)
canvas:set_line (x1, y1, x2, y2, color[, thickness])
draws a line between 2 points

Parameters:

  • x1 number the x position of the first point
  • y1 number the y position of the first point
  • x2 number the x position of the second point
  • y2 number the y position of the second point
  • color number the color to draw the line with
  • thickness number the thickness of the line (optional)
generated by LDoc 1.4.6 Last updated 2022-06-23 16:51:50