flipperzero-firmware/applications/gui/canvas.h

34 lines
1008 B
C
Raw Normal View History

#pragma once
#include <stdint.h>
2020-10-15 15:56:47 +00:00
#include <u8g2.h>
#include <gui/icon.h>
2020-10-15 15:05:28 +00:00
typedef enum {
2020-10-15 15:57:21 +00:00
ColorWhite = 0x00,
ColorBlack = 0x01,
2020-10-15 15:05:28 +00:00
} Color;
2020-10-16 13:34:36 +00:00
typedef enum {
FontPrimary = 0x00,
FontSecondary = 0x01,
} Font;
2020-10-15 15:57:21 +00:00
2020-10-16 13:34:36 +00:00
typedef struct CanvasApi CanvasApi;
struct CanvasApi {
2020-10-15 15:05:28 +00:00
uint8_t (*width)(CanvasApi* canvas);
uint8_t (*height)(CanvasApi* canvas);
2020-10-15 15:05:28 +00:00
void (*clear)(CanvasApi* canvas);
2020-10-15 15:56:47 +00:00
void (*set_color)(CanvasApi* canvas, Color color);
void (*set_font)(CanvasApi* canvas, Font font);
2020-10-15 15:05:28 +00:00
void (*draw_str)(CanvasApi* canvas, uint8_t x, uint8_t y, const char* str);
void (*draw_icon)(CanvasApi* canvas, uint8_t x, uint8_t y, Icon* icon);
void (*draw_dot)(CanvasApi* canvas, uint8_t x, uint8_t y);
void (*draw_box)(CanvasApi* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height);
void (*draw_frame)(CanvasApi* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height);
void (*draw_line)(CanvasApi* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2);
2020-10-15 15:56:47 +00:00
};