2022-06-07 16:37:06 +01:00
|
|
|
#include "py/runtime.h"
|
|
|
|
#include "py/objstr.h"
|
|
|
|
|
|
|
|
enum PicoGraphicsDisplay {
|
|
|
|
DISPLAY_LCD_240X240=0,
|
|
|
|
DISPLAY_ROUND_LCD_240X240,
|
|
|
|
DISPLAY_PICO_DISPLAY,
|
|
|
|
DISPLAY_PICO_DISPLAY_2,
|
|
|
|
DISPLAY_PICO_EXPLORER,
|
|
|
|
DISPLAY_TUFTY_2040,
|
|
|
|
DISPLAY_ENVIRO_PLUS,
|
2022-06-16 09:23:29 +01:00
|
|
|
DISPLAY_LCD_160X80,
|
2022-06-23 15:48:45 +01:00
|
|
|
DISPLAY_I2C_OLED_128X128,
|
2022-06-14 09:57:00 +01:00
|
|
|
DISPLAY_INKY_PACK,
|
2022-09-29 13:46:48 +01:00
|
|
|
DISPLAY_INKY_FRAME,
|
2022-07-27 18:09:27 +01:00
|
|
|
DISPLAY_INKY_FRAME_4,
|
2022-11-03 13:30:07 +00:00
|
|
|
DISPLAY_GALACTIC_UNICORN,
|
2022-12-16 20:53:16 +00:00
|
|
|
DISPLAY_GFX_PACK,
|
|
|
|
DISPLAY_INTERSTATE75_32X32,
|
|
|
|
DISPLAY_INTERSTATE75_64X32,
|
|
|
|
DISPLAY_INTERSTATE75_96X32,
|
|
|
|
DISPLAY_INTERSTATE75_128X32,
|
|
|
|
DISPLAY_INTERSTATE75_64X64,
|
|
|
|
DISPLAY_INTERSTATE75_128X64,
|
|
|
|
DISPLAY_INTERSTATE75_192X64,
|
2023-02-03 12:37:02 +00:00
|
|
|
DISPLAY_INTERSTATE75_256X64,
|
|
|
|
DISPLAY_INKY_FRAME_7,
|
2023-03-16 13:24:53 +00:00
|
|
|
DISPLAY_COSMIC_UNICORN,
|
2023-05-30 10:32:25 +01:00
|
|
|
DISPLAY_STELLAR_UNICORN,
|
2023-03-16 16:59:31 +00:00
|
|
|
DISPLAY_UNICORN_PACK,
|
|
|
|
DISPLAY_SCROLL_PACK
|
2022-06-07 16:37:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum PicoGraphicsPenType {
|
2022-06-16 09:23:29 +01:00
|
|
|
PEN_1BIT = 0,
|
2022-06-30 15:24:58 +01:00
|
|
|
PEN_3BIT,
|
2022-06-16 09:23:29 +01:00
|
|
|
PEN_P2,
|
2022-06-07 16:37:06 +01:00
|
|
|
PEN_P4,
|
|
|
|
PEN_P8,
|
|
|
|
PEN_RGB332,
|
2022-07-27 18:09:27 +01:00
|
|
|
PEN_RGB565,
|
2023-02-03 12:37:02 +00:00
|
|
|
PEN_RGB888,
|
|
|
|
PEN_INKY7,
|
2022-06-07 16:37:06 +01:00
|
|
|
};
|
|
|
|
|
2022-06-27 17:32:30 +01:00
|
|
|
enum PicoGraphicsBusType {
|
|
|
|
BUS_I2C,
|
|
|
|
BUS_SPI,
|
2022-07-27 18:09:27 +01:00
|
|
|
BUS_PARALLEL,
|
|
|
|
BUS_PIO
|
2022-06-27 17:32:30 +01:00
|
|
|
};
|
|
|
|
|
2022-06-07 16:37:06 +01:00
|
|
|
// Type
|
|
|
|
extern const mp_obj_type_t ModPicoGraphics_type;
|
|
|
|
|
|
|
|
// Module functions
|
2022-06-09 16:52:06 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_module_RGB_to_RGB332(mp_obj_t r, mp_obj_t g, mp_obj_t b);
|
|
|
|
extern mp_obj_t ModPicoGraphics_module_RGB_to_RGB565(mp_obj_t r, mp_obj_t g, mp_obj_t b);
|
|
|
|
extern mp_obj_t ModPicoGraphics_module_RGB332_to_RGB(mp_obj_t rgb332);
|
|
|
|
extern mp_obj_t ModPicoGraphics_module_RGB565_to_RGB(mp_obj_t rgb565);
|
2022-06-08 17:14:28 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_get_required_buffer_size(mp_obj_t display_in, mp_obj_t pen_type_in);
|
2022-06-07 16:37:06 +01:00
|
|
|
|
|
|
|
// Class methods
|
|
|
|
extern mp_obj_t ModPicoGraphics_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
|
|
|
|
|
|
|
|
extern mp_obj_t ModPicoGraphics_update(mp_obj_t self_in);
|
2022-06-27 17:32:30 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_partial_update(size_t n_args, const mp_obj_t *args);
|
2022-06-07 16:37:06 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_set_backlight(mp_obj_t self_in, mp_obj_t brightness);
|
2022-06-27 17:32:30 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_set_update_speed(mp_obj_t self_in, mp_obj_t update_speed);
|
2022-06-07 16:37:06 +01:00
|
|
|
|
|
|
|
// Palette management
|
|
|
|
extern mp_obj_t ModPicoGraphics_update_pen(size_t n_args, const mp_obj_t *args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_reset_pen(mp_obj_t self_in, mp_obj_t pen);
|
2022-06-07 20:19:16 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_set_palette(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
2023-02-09 16:13:37 +00:00
|
|
|
extern mp_obj_t ModPicoGraphics_hsv_to_rgb(size_t n_args, const mp_obj_t *args);
|
2022-06-07 16:37:06 +01:00
|
|
|
|
|
|
|
// Pen
|
|
|
|
extern mp_obj_t ModPicoGraphics_set_pen(mp_obj_t self_in, mp_obj_t pen);
|
|
|
|
extern mp_obj_t ModPicoGraphics_create_pen(size_t n_args, const mp_obj_t *args);
|
2023-02-09 16:13:37 +00:00
|
|
|
extern mp_obj_t ModPicoGraphics_create_pen_hsv(size_t n_args, const mp_obj_t *args);
|
2023-01-24 21:10:43 +00:00
|
|
|
extern mp_obj_t ModPicoGraphics_set_thickness(mp_obj_t self_in, mp_obj_t thickness);
|
2022-06-07 16:37:06 +01:00
|
|
|
|
|
|
|
// Primitives
|
|
|
|
extern mp_obj_t ModPicoGraphics_set_clip(size_t n_args, const mp_obj_t *args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_remove_clip(mp_obj_t self_in);
|
|
|
|
extern mp_obj_t ModPicoGraphics_clear(mp_obj_t self_in);
|
|
|
|
extern mp_obj_t ModPicoGraphics_pixel(mp_obj_t self_in, mp_obj_t x, mp_obj_t y);
|
|
|
|
extern mp_obj_t ModPicoGraphics_pixel_span(size_t n_args, const mp_obj_t *args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_rectangle(size_t n_args, const mp_obj_t *args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_circle(size_t n_args, const mp_obj_t *args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_character(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_text(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_measure_text(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_polygon(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_triangle(size_t n_args, const mp_obj_t *args);
|
|
|
|
extern mp_obj_t ModPicoGraphics_line(size_t n_args, const mp_obj_t *args);
|
|
|
|
|
2022-06-13 17:54:12 +01:00
|
|
|
// Sprites
|
|
|
|
extern mp_obj_t ModPicoGraphics_set_spritesheet(mp_obj_t self_in, mp_obj_t spritedata);
|
2022-06-14 14:15:27 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_load_spritesheet(mp_obj_t self_in, mp_obj_t filename);
|
2022-06-13 17:54:12 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_sprite(size_t n_args, const mp_obj_t *args);
|
|
|
|
|
2022-06-07 16:37:06 +01:00
|
|
|
// Utility
|
2022-06-10 00:58:54 +01:00
|
|
|
//extern mp_obj_t ModPicoGraphics_set_scanline_callback(mp_obj_t self_in, mp_obj_t cb_in);
|
2022-06-07 20:19:16 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_set_font(mp_obj_t self_in, mp_obj_t font);
|
2022-06-07 16:37:06 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_get_bounds(mp_obj_t self_in);
|
2022-06-09 16:52:06 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics_set_framebuffer(mp_obj_t self_in, mp_obj_t framebuffer);
|
|
|
|
|
2022-06-16 17:38:57 +01:00
|
|
|
extern mp_int_t ModPicoGraphics_get_framebuffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags);
|
|
|
|
|
2022-06-14 09:57:00 +01:00
|
|
|
extern mp_obj_t ModPicoGraphics__del__(mp_obj_t self_in);
|