Difference between revisions of "API"
Jump to navigation
Jump to search
Line 6: | Line 6: | ||
! Parameters | ! Parameters | ||
! Description | ! Description | ||
− | |||
|- | |- | ||
| flush | | flush | ||
Line 12: | Line 11: | ||
| Flush the contents of the framebuffer to the display. | | Flush the contents of the framebuffer to the display. | ||
Optionally you may provide flags (see the table down below) | Optionally you may provide flags (see the table down below) | ||
− | |||
|- | |- | ||
| size | | size | ||
| [window] | | [window] | ||
| Get the size (width, height) of the framebuffer or a window as a tuple | | Get the size (width, height) of the framebuffer or a window as a tuple | ||
− | |||
|- | |- | ||
| width | | width | ||
| [window] | | [window] | ||
| Get the width of the framebuffer or a window as an integer | | Get the width of the framebuffer or a window as an integer | ||
− | |||
|- | |- | ||
| height | | height | ||
| [window] | | [window] | ||
| Get the height of the framebuffer or a window as an integer | | Get the height of the framebuffer or a window as an integer | ||
− | |||
|- | |- | ||
| orientation | | orientation | ||
| [window], [angle] | | [window], [angle] | ||
| Get or set the orientation of the framebuffer or a window | | Get or set the orientation of the framebuffer or a window | ||
− | |||
− | |||
|- | |- | ||
| getPixel | | getPixel | ||
| [window], x, y | | [window], x, y | ||
| Get the color of a pixel in the framebuffer or a window | | Get the color of a pixel in the framebuffer or a window | ||
− | |||
|- | |- | ||
| drawRaw | | drawRaw | ||
Line 45: | Line 37: | ||
The length of the bytes buffer must match the formula width*height*(bitsPerPixel//8). | 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. | This is a direct copy: color format (bitsPerPixel) must match the specific display of the badge this command is used on. | ||
− | |||
|- | |- | ||
| drawPixel | | drawPixel | ||
| [window], x, y, color | | [window], x, y, color | ||
| Draw a pixel in the framebuffer or a window | | Draw a pixel in the framebuffer or a window | ||
− | |||
|- | |- | ||
| drawFill | | drawFill | ||
| [window], color | | [window], color | ||
| Fill the framebuffer or a window | | Fill the framebuffer or a window | ||
− | |||
|- | |- | ||
| drawLine | | drawLine | ||
| [window], x0, y0, x1, y1, color | | [window], x0, y0, x1, y1, color | ||
| Draw a line from (x0, y0) to (x1, y1) | | Draw a line from (x0, y0) to (x1, y1) | ||
− | |||
|- | |- | ||
| drawRect | | drawRect | ||
| [window], x, y, width, height, color | | [window], x, y, width, height, color | ||
| Draw a rectangle at (x, y) with size (width, height) | | Draw a rectangle at (x, y) with size (width, height) | ||
− | |||
|- | |- | ||
| drawCircle | | drawCircle | ||
| [window], x0, y0, radius, a0, a1, fill, color | | [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) | | Draw a circle with center point (x0, y0) with the provided radius from angle a0 to angle a1, optionally filled (boolean) | ||
− | |||
|- | |- | ||
| drawText | | drawText | ||
| [window], x, y, text, [color], [font], [x-scale], [y-scale] | | [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 | | 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 | | drawPng | ||
| [window], x, y, [data or filename] | | [window], x, y, [data or filename] | ||
| Draw a PNG image at (x, y) from either a bytes buffer or a file | | Draw a PNG image at (x, y) from either a bytes buffer or a file | ||
− | |||
|- | |- | ||
| getTextWidth | | getTextWidth | ||
| text, [font] | | text, [font] | ||
| Get the width a string would take if drawn with a certain font | | Get the width a string would take if drawn with a certain font | ||
− | |||
|- | |- | ||
| getTextHeight | | getTextHeight | ||
| text, [font] | | text, [font] | ||
| Get the height a string would take if drawn with a certain font | | Get the height a string would take if drawn with a certain font | ||
− | |||
|- | |- | ||
| pngInfo | | pngInfo | ||
| [data or filename] | | [data or filename] | ||
| Get information about a PNG image | | Get information about a PNG image | ||
− | |||
|- | |- | ||
| windowCreate | | windowCreate | ||
| name, width, height | | name, width, height | ||
− | |||
| | | | ||
|- | |- | ||
| windowRemove | | windowRemove | ||
| name | | name | ||
− | |||
| | | | ||
|- | |- | ||
| windowMove | | windowMove | ||
| name, x, y | | name, x, y | ||
− | |||
| | | | ||
|- | |- | ||
| windowResize | | windowResize | ||
| name, width, height | | name, width, height | ||
− | |||
| | | | ||
|- | |- | ||
| windowVisibility | | windowVisibility | ||
| name, [visible] | | name, [visible] | ||
− | |||
| | | | ||
|- | |- | ||
| windowShow | | windowShow | ||
| name | | name | ||
− | |||
| | | | ||
|- | |- | ||
| windowHide | | windowHide | ||
| name | | name | ||
− | |||
| | | | ||
|- | |- | ||
| windowFocus | | windowFocus | ||
| name | | name | ||
− | |||
| | | | ||
|- | |- | ||
| windowList | | windowList | ||
| - | | - | ||
− | |||
| | | | ||
|- | |- | ||
| windowLoop | | windowLoop | ||
| *DO NOT USE* | | *DO NOT USE* | ||
− | |||
| | | | ||
|- | |- | ||
| frameAdd | | frameAdd | ||
| *DO NOT USE* | | *DO NOT USE* | ||
− | |||
| | | | ||
|- | |- | ||
| frameRemove | | frameRemove | ||
| *DO NOT USE* | | *DO NOT USE* | ||
− | |||
| | | | ||
|- | |- | ||
| frameStep | | frameStep | ||
| *DO NOT USE* | | *DO NOT USE* | ||
− | |||
| | | | ||
|- | |- | ||
| frameSeek | | frameSeek | ||
| *DO NOT USE* | | *DO NOT USE* | ||
− | |||
| | | | ||
|- | |- | ||
| frameCurrent | | frameCurrent | ||
| *DO NOT USE* | | *DO NOT USE* | ||
− | |||
| | | | ||
|- | |- | ||
| frameCount | | frameCount | ||
| *DO NOT USE* | | *DO NOT USE* | ||
− | |||
| | | | ||
|} | |} |
Revision as of 21:29, 16 August 2019
Display
The display API allows you to control the display of your badge.
Command | Parameters | Description |
---|---|---|
flush | [flags] | Flush the contents of the framebuffer to the display.
Optionally you may provide flags (see the table down below) |
size | [window] | Get the size (width, height) of the framebuffer or a window as a tuple |
width | [window] | Get the width of the framebuffer or a window as an integer |
height | [window] | Get the height of the framebuffer or a window as an integer |
orientation | [window], [angle] | Get or set the orientation of the framebuffer or a window |
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.