Module guih.lib.graphic

GuiH graphics library.

used for drawing and image reading purposes.

Functions

draw_box_tex (terminal, texture, x, y, width, height[, bg[, fg[, offsetx[, offsety[, cache]]]]]) draws a box from a given texture on the screen
get_pixel (x, y, texture, fill_empty) reads a pixel from an texture
build_drawing_char (tbl[, mode]) creates a drawing character out of a table with 6 color values

Tables

pixel the simple pixel table properties
to_color a lookup table for converting blit values into color numbers.
to_blit a lookup table converting color numbers to blit values.


Functions

draw_box_tex (terminal, texture, x, y, width, height[, bg[, fg[, offsetx[, offsety[, cache]]]]])
draws a box from a given texture on the screen

Parameters:

  • terminal term_object the terminal to draw the box on
  • texture gui.texture the texture to draw
  • x number the x position to draw the box at
  • y number the y position to draw the box at
  • width number the width of the drawn sprite
  • height number the height of the drawn sprite
  • bg number the background color to draw empty pixels with (optional)
  • fg number the foreground color to draw empty pixels with (optional)
  • offsetx number the x offset to draw the sprite at (optional)
  • offsety number the y offset to draw the sprite at (optional)
  • cache table the cache to store loaded sprites. can lead to massive performance increase. see guih.main_ui.texture_cache (optional)
get_pixel (x, y, texture, fill_empty)
reads a pixel from an texture

Parameters:

  • x number the x position of the pixel
  • y number the y position of the pixel
  • texture guih.texture the texture to read from
  • fill_empty boolean whether the empty pixel should get set to their nearest neighbor

Returns:

    table the resulting pixel table. properties: graphic.pixel
build_drawing_char (tbl[, mode])
creates a drawing character out of a table with 6 color values

Parameters:

  • tbl table the table with 6 values
  • mode boolean whether the overflow colors should be filled with the first most common or the second most common color (default: most) (optional)

Returns:

  1. string the resulting character
  2. number the resulting foreground color
  3. number the resulting background color

Tables

pixel
the simple pixel table properties

Fields:

  • symbol the symbol stored at this pixel
  • text_color the color of the text
  • background_color the color of the background of this pixel
to_color
a lookup table for converting blit values into color numbers.
to_blit
a lookup table converting color numbers to blit values.
generated by LDoc 1.4.6 Last updated 2022-06-23 16:51:50