Class screen

Screen class subset of cairo drawing functions.

see https://www.cairographics.org/tutorial/

Methods

screen:update_default () copy buffer to screen.
screen:ping () restart screen saver timer
screen:update_low_battery () low battery screen update
screen:aa (state) enable/disable anti-aliasing.
screen:clear () clear.
screen:level (value) set level (color/brightness).
screen:line_width (w) set line width.
screen:line_cap (style) set line cap style.
screen:line_join (style) set line join style.
screen:miter_limit (limit) set miter limit.
screen:move (x, y) move drawing position.
screen:move_rel (x, y) move drawing position relative to current position.
screen:line (x, y) draw line to specified point.
screen:line_rel (x, y) draw line to specified point relative to current position.
screen:arc (x, y, r, angle1, angle2) draw arc.
screen:circle (x, y, r) draw circle.
screen:rect (x, y, w, h) draw rectangle.
screen:curve (x1, y1, x2, y2, x3, y3) draw curve (cubic Bézier spline).
screen:curve_rel (x1, y1, x2, y2, x3, y3) draw curve (cubic Bézier spline) relative coordinates.
screen:close () close current path.
screen:stroke () stroke current path.
screen:fill () fill current path.
screen:text (str) draw text (left aligned).
screen:text_right (str) draw text, right aligned.
screen:text_center (str) draw text, center aligned.
screen:text_extents (str) calculate width of text.
screen:font_face (index) select font face.
screen:font_size (size) set font size.
screen:pixel (x, y) draw single pixel (requires integer x/y, fill afterwards).
screen:display_png (filename, x, y) display png.


Methods

screen:update_default ()
copy buffer to screen.
screen:ping ()
restart screen saver timer
screen:update_low_battery ()
low battery screen update
screen:aa (state)
enable/disable anti-aliasing.

Parameters:

  • state on(1) or off(0)
screen:clear ()
clear.
screen:level (value)
set level (color/brightness).

Parameters:

  • value number 0-15 (0=off, 15=white)
screen:line_width (w)
set line width.

Parameters:

  • w number line width (in pixels, floats permitted)
screen:line_cap (style)
set line cap style.

Parameters:

  • style line cap style string ("butt", "round" or "square"). default is "butt".
screen:line_join (style)
set line join style.

Parameters:

  • style line join style string ("miter", "round" or "bevel"). default is "miter"
screen:miter_limit (limit)
set miter limit.

Parameters:

  • limit if the current line join style is set to "miter", the miter limit is used to determine whether the lines should be joined with a bevel instead of a miter. if the length of the miter divided by the line width is greater than the miter limit, the style is converted to a bevel. default value 10.
screen:move (x, y)
move drawing position.

Parameters:

  • x number position x
  • y number position y
screen:move_rel (x, y)
move drawing position relative to current position.

Parameters:

  • x number relative position x
  • y number relative position y
screen:line (x, y)
draw line to specified point.

Parameters:

  • x number destination x
  • y number destination y
screen:line_rel (x, y)
draw line to specified point relative to current position.

Parameters:

  • x number relative destination x
  • y number relative destination y
screen:arc (x, y, r, angle1, angle2)
draw arc.

Parameters:

  • x number circle center x
  • y number circle center y
  • r number radius
  • angle1 number start angle
  • angle2 number end angle
screen:circle (x, y, r)
draw circle.

Parameters:

  • x number origin x
  • y number origin y
  • r number radius
screen:rect (x, y, w, h)
draw rectangle.

Parameters:

  • x number x position
  • y number y position
  • w number width
  • h number height
screen:curve (x1, y1, x2, y2, x3, y3)
draw curve (cubic Bézier spline).

Parameters:

  • x1 number destination x
  • y1 number destination y
  • x2 number handle 1 x
  • y2 number handle 1 y
  • x3 number handle 2 x
  • y3 number handle 2 y
screen:curve_rel (x1, y1, x2, y2, x3, y3)
draw curve (cubic Bézier spline) relative coordinates.

Parameters:

  • x1 number relative destination x
  • y1 number relative destination y
  • x2 number handle 1 x
  • y2 number handle 1 y
  • x3 number handle 2 x
  • y3 number handle 2 y
screen:close ()
close current path.
screen:stroke ()
stroke current path. uses currently selected color.
screen:fill ()
fill current path. uses currently selected color.
screen:text (str)
draw text (left aligned). uses currently selected font.

Parameters:

screen:text_right (str)
draw text, right aligned. uses currently selected font

Parameters:

screen:text_center (str)
draw text, center aligned. uses currently selected font.

Parameters:

screen:text_extents (str)
calculate width of text. uses currently selected font.

Parameters:

  • str string : text to calculate width of
screen:font_face (index)
select font face.

Parameters:

  • index font face (see list)

    1 04B_03 (norns default)

    2 ALEPH

    3 Roboto Thin

    4 Roboto Light

    5 Roboto Regular

    6 Roboto Medium

    7 Roboto Bold

    8 Roboto Black

    9 Roboto Thin Italic

    10 Roboto Light Italic

    11 Roboto Italic

    12 Roboto Medium Italic

    13 Roboto Bold Italic

    14 Roboto Black Italic

screen:font_size (size)
set font size.

Parameters:

  • size number in pixel height.
screen:pixel (x, y)
draw single pixel (requires integer x/y, fill afterwards).

Parameters:

  • x number position
  • y number position
screen:display_png (filename, x, y)
display png.

Parameters:

  • filename
  • x number x position
  • y number y position
generated by LDoc 1.4.6 Last updated 2020-03-28 23:45:19