Module display

Display and bmp drawing functions

Info:

  • Copyright: 2014
  • License: GPL
  • Author: Magic Lantern Team

Functions

on () Turn the display on
off () Turn the display off
screenshot ([filename[, mode]]) Take a screenshot
clear () Clear the screen
print (text, x, y[, font[, fg[, bg[, max_width]]]]) Print text to the screen.
pixel (x, y[, color]) Set a pixel to a color (omit color param to read the current color)
line (x1, y1, x2, y2, color) Draw a line
rect (x, y, w, h, stroke[, fill]) Draw a rect
circle (x, y, r, stroke[, fill]) Draw a circle
load (filename) Loads a bitmap file so it can be drawn on the screen
draw (draw_func) Runs the given function and double-buffers all the drawing done by the function Then copies the buffer back to the actual screen buffer when the function returns Use this to avoid flickering when drawing
notify_box (text[, timeout=1000]) Prints a message on the screen for a period of time

Fields

width The width of the display (720)
height The height of the display (480)

Class bitmap

bitmap:draw (x, y[, w[, h]]) Draws this bitmap image to the screen
bitmap.bits_per_pixel Get the bits per pixel
bitmap.width Get the image width
bitmap.height Get the image height
bitmap.num_colors Get the number of colors
bitmap.size Get the image size
bitmap.signature Get the image signature
bitmap.hpix_per_meter Get the image horizontal resolution
bitmap.vpix_per_meter Get the image vertical resolution


Functions

on ()
Turn the display on
off ()
Turn the display off
screenshot ([filename[, mode]])
Take a screenshot

Parameters:

  • filename string (optional)
  • mode int (optional)
clear ()
Clear the screen
print (text, x, y[, font[, fg[, bg[, max_width]]]])
Print text to the screen.

Parameters:

Returns:

    string any remaining characters that wouldn't fit on the screen
pixel (x, y[, color])
Set a pixel to a color (omit color param to read the current color)

Parameters:

Returns:

    color constants.COLOR
line (x1, y1, x2, y2, color)
Draw a line

Parameters:

rect (x, y, w, h, stroke[, fill])
Draw a rect

Parameters:

circle (x, y, r, stroke[, fill])
Draw a circle

Parameters:

load (filename)
Loads a bitmap file so it can be drawn on the screen

Parameters:

Returns:

    bitmap
draw (draw_func)
Runs the given function and double-buffers all the drawing done by the function Then copies the buffer back to the actual screen buffer when the function returns Use this to avoid flickering when drawing

Parameters:

  • draw_func func
notify_box (text[, timeout=1000])
Prints a message on the screen for a period of time

Parameters:

  • text string
  • timeout int in ms (default 1000)

Fields

width
The width of the display (720)
  • width int
height
The height of the display (480)
  • height int

Class bitmap

Represents a bitmap file that has been loaded
bitmap:draw (x, y[, w[, h]])
Draws this bitmap image to the screen

Parameters:

  • x int
  • y int
  • w int (optional)
  • h int (optional)
bitmap.bits_per_pixel
Get the bits per pixel
  • bits_per_pixel int
bitmap.width
Get the image width
  • width int
bitmap.height
Get the image height
  • height int
bitmap.num_colors
Get the number of colors
  • num_colors int
bitmap.size
Get the image size
  • size int
bitmap.signature
Get the image signature
  • signature int
bitmap.hpix_per_meter
Get the image horizontal resolution
  • hpix_per_meter int
bitmap.vpix_per_meter
Get the image vertical resolution
  • vpix_per_meter int
generated by LDoc 1.4.3 Last updated 2016-04-23 15:53:20