Difference between revisions of "API"
Jump to navigation
Jump to search
(Created page with "= Display = The display API allows you to control the display of your badge. = WiFi = The wifi API allows you to connect to WiFi networks.") |
|||
Line 1: | Line 1: | ||
= Display = | = Display = | ||
The display API allows you to control the display of your badge. | The display API allows you to control the display of your badge. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Command | ||
+ | ! Parameters | ||
+ | ! Description | ||
+ | ! Example | ||
+ | |- | ||
+ | | flush | ||
+ | | [flags] | ||
+ | | Flush the contents of the framebuffer to the display. | ||
+ | Optionally you may provide flags (see the table down below) | ||
+ | | flush() | ||
+ | |- | ||
+ | | size | ||
+ | | [window] | ||
+ | | Get the size (width, height) of the framebuffer or a window as a tuple | ||
+ | | size() | ||
+ | |- | ||
+ | | width | ||
+ | | [window] | ||
+ | | Get the width of the framebuffer or a window as an integer | ||
+ | | width() | ||
+ | |- | ||
+ | | height | ||
+ | | [window] | ||
+ | | Get the height of the framebuffer or a window as an integer | ||
+ | | height() | ||
+ | |- | ||
+ | | orientation | ||
+ | | [window], [angle] | ||
+ | | Get or set the orientation of the framebuffer or a window | ||
+ | | GET: orientation() | ||
+ | SET: orientation(90) | ||
+ | |- | ||
+ | | getPixel | ||
+ | | [window], x, y | ||
+ | | Get the color of a pixel in the framebuffer or a window | ||
+ | | | ||
+ | |- | ||
+ | | drawRaw | ||
+ | | [window], x, y, width, height, data | ||
+ | | Copy a raw bytes buffer directly to the framebuffer or the current frame of a window. | ||
+ | The length of the bytes buffer must match the formula width*height*(bitsPerPixel//8). | ||
+ | This is a direct copy: color format (bitsPerPixel) must match the specific display of the badge this command is used on. | ||
+ | | - | ||
+ | |- | ||
+ | | drawPixel | ||
+ | | [window], x, y, color | ||
+ | | Draw a pixel in the framebuffer or a window | ||
+ | | | ||
+ | |- | ||
+ | | drawFill | ||
+ | | [window], color | ||
+ | | Fill the framebuffer or a window | ||
+ | | | ||
+ | |- | ||
+ | | drawLine | ||
+ | | [window], x0, y0, x1, y1, color | ||
+ | | Draw a line from (x0, y0) to (x1, y1) | ||
+ | | | ||
+ | |- | ||
+ | | drawRect | ||
+ | | [window], x, y, width, height, color | ||
+ | | Draw a rectangle at (x, y) with size (width, height) | ||
+ | | | ||
+ | |- | ||
+ | | drawCircle | ||
+ | | [window], x0, y0, radius, a0, a1, fill, color | ||
+ | | Draw a circle with center point (x0, y0) with the provided radius from angle a0 to angle a1, optionally filled (boolean) | ||
+ | | | ||
+ | |- | ||
+ | | drawText | ||
+ | | [window], x, y, text, [color], [font], [x-scale], [y-scale] | ||
+ | | Draw text at (x, y) with a certain color and font. Can be scaled (drawn with rects instead of pixels) in both the x and y direction | ||
+ | | | ||
+ | |- | ||
+ | | drawPng | ||
+ | | [window], x, y, [data or filename] | ||
+ | | Draw a PNG image at (x, y) from either a bytes buffer or a file | ||
+ | | | ||
+ | |- | ||
+ | | getTextWidth | ||
+ | | text, [font] | ||
+ | | Get the width a string would take if drawn with a certain font | ||
+ | | | ||
+ | |- | ||
+ | | getTextHeight | ||
+ | | text, [font] | ||
+ | | Get the height a string would take if drawn with a certain font | ||
+ | | | ||
+ | |- | ||
+ | | pngInfo | ||
+ | | [data or filename] | ||
+ | | Get information about a PNG image | ||
+ | | | ||
+ | |- | ||
+ | | windowCreate | ||
+ | | name, width, height | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | windowRemove | ||
+ | | name | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | windowMove | ||
+ | | name, x, y | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | windowResize | ||
+ | | name, width, height | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | windowVisibility | ||
+ | | name, [visible] | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | windowShow | ||
+ | | name | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | windowHide | ||
+ | | name | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | windowFocus | ||
+ | | name | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | windowList | ||
+ | | - | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | windowLoop | ||
+ | | *DO NOT USE* | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | frameAdd | ||
+ | | *DO NOT USE* | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | frameRemove | ||
+ | | *DO NOT USE* | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | frameStep | ||
+ | | *DO NOT USE* | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | frameSeek | ||
+ | | *DO NOT USE* | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | frameCurrent | ||
+ | | *DO NOT USE* | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | frameCount | ||
+ | | *DO NOT USE* | ||
+ | | | ||
+ | | | ||
+ | |} | ||
= WiFi = | = WiFi = | ||
The wifi API allows you to connect to WiFi networks. | The wifi API allows you to connect to WiFi networks. |
Revision as of 21:27, 16 August 2019
Display
The display API allows you to control the display of your badge.
Command | Parameters | Description | Example |
---|---|---|---|
flush | [flags] | Flush the contents of the framebuffer to the display.
Optionally you may provide flags (see the table down below) |
flush() |
size | [window] | Get the size (width, height) of the framebuffer or a window as a tuple | size() |
width | [window] | Get the width of the framebuffer or a window as an integer | width() |
height | [window] | Get the height of the framebuffer or a window as an integer | height() |
orientation | [window], [angle] | Get or set the orientation of the framebuffer or a window | GET: orientation()
SET: orientation(90) |
getPixel | [window], x, y | Get the color of a pixel in the framebuffer or a window | |
drawRaw | [window], x, y, width, height, data | Copy a raw bytes buffer directly to the framebuffer or the current frame of a window.
The length of the bytes buffer must match the formula width*height*(bitsPerPixel//8). This is a direct copy: color format (bitsPerPixel) must match the specific display of the badge this command is used on. |
- |
drawPixel | [window], x, y, color | Draw a pixel in the framebuffer or a window | |
drawFill | [window], color | Fill the framebuffer or a window | |
drawLine | [window], x0, y0, x1, y1, color | Draw a line from (x0, y0) to (x1, y1) | |
drawRect | [window], x, y, width, height, color | Draw a rectangle at (x, y) with size (width, height) | |
drawCircle | [window], x0, y0, radius, a0, a1, fill, color | Draw a circle with center point (x0, y0) with the provided radius from angle a0 to angle a1, optionally filled (boolean) | |
drawText | [window], x, y, text, [color], [font], [x-scale], [y-scale] | Draw text at (x, y) with a certain color and font. Can be scaled (drawn with rects instead of pixels) in both the x and y direction | |
drawPng | [window], x, y, [data or filename] | Draw a PNG image at (x, y) from either a bytes buffer or a file | |
getTextWidth | text, [font] | Get the width a string would take if drawn with a certain font | |
getTextHeight | text, [font] | Get the height a string would take if drawn with a certain font | |
pngInfo | [data or filename] | Get information about a PNG image | |
windowCreate | name, width, height | ||
windowRemove | name | ||
windowMove | name, x, y | ||
windowResize | name, width, height | ||
windowVisibility | name, [visible] | ||
windowShow | name | ||
windowHide | name | ||
windowFocus | name | ||
windowList | - | ||
windowLoop | *DO NOT USE* | ||
frameAdd | *DO NOT USE* | ||
frameRemove | *DO NOT USE* | ||
frameStep | *DO NOT USE* | ||
frameSeek | *DO NOT USE* | ||
frameCurrent | *DO NOT USE* | ||
frameCount | *DO NOT USE* |
WiFi
The wifi API allows you to connect to WiFi networks.