2021-10-03 13:36:05 +03:00
|
|
|
/**
|
|
|
|
* @file canvas_i.h
|
|
|
|
* GUI: internal Canvas API
|
|
|
|
*/
|
|
|
|
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 13:21:55 +03:00
|
|
|
#pragma once
|
|
|
|
|
2020-12-14 13:50:32 +03:00
|
|
|
#include "canvas.h"
|
2021-02-03 12:52:54 +03:00
|
|
|
#include <u8g2.h>
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
/** Canvas structure
|
|
|
|
*/
|
2021-02-03 12:52:54 +03:00
|
|
|
struct Canvas {
|
|
|
|
u8g2_t fb;
|
2021-05-19 12:43:15 +03:00
|
|
|
CanvasOrientation orientation;
|
2021-02-03 12:52:54 +03:00
|
|
|
uint8_t offset_x;
|
|
|
|
uint8_t offset_y;
|
|
|
|
uint8_t width;
|
|
|
|
uint8_t height;
|
|
|
|
};
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 13:21:55 +03:00
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
/** Allocate memory and initialize canvas
|
|
|
|
*
|
|
|
|
* @return Canvas instance
|
2020-12-14 13:50:32 +03:00
|
|
|
*/
|
|
|
|
Canvas* canvas_init();
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 13:21:55 +03:00
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
/** Free canvas memory
|
|
|
|
*
|
|
|
|
* @param canvas Canvas instance
|
2020-12-14 13:50:32 +03:00
|
|
|
*/
|
|
|
|
void canvas_free(Canvas* canvas);
|
2020-10-29 10:11:16 +03:00
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
/** Get canvas buffer.
|
|
|
|
*
|
|
|
|
* @param canvas Canvas instance
|
|
|
|
*
|
|
|
|
* @return pointer to buffer
|
2021-02-13 14:40:20 +03:00
|
|
|
*/
|
|
|
|
uint8_t* canvas_get_buffer(Canvas* canvas);
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
/** Get canvas buffer size.
|
|
|
|
*
|
|
|
|
* @param canvas Canvas instance
|
|
|
|
*
|
|
|
|
* @return size of canvas in bytes
|
2021-02-13 14:40:20 +03:00
|
|
|
*/
|
2023-02-09 07:58:01 +03:00
|
|
|
size_t canvas_get_buffer_size(const Canvas* canvas);
|
2021-02-13 14:40:20 +03:00
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
/** Set drawing region relative to real screen buffer
|
|
|
|
*
|
|
|
|
* @param canvas Canvas instance
|
|
|
|
* @param offset_x x coordinate offset
|
|
|
|
* @param offset_y y coordinate offset
|
|
|
|
* @param width width
|
|
|
|
* @param height height
|
2020-12-14 13:50:32 +03:00
|
|
|
*/
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 13:21:55 +03:00
|
|
|
void canvas_frame_set(
|
2020-12-14 13:50:32 +03:00
|
|
|
Canvas* canvas,
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 13:21:55 +03:00
|
|
|
uint8_t offset_x,
|
|
|
|
uint8_t offset_y,
|
|
|
|
uint8_t width,
|
|
|
|
uint8_t height);
|
2021-05-19 12:43:15 +03:00
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
/** Set canvas orientation
|
|
|
|
*
|
|
|
|
* @param canvas Canvas instance
|
|
|
|
* @param orientation CanvasOrientation
|
2021-05-19 12:43:15 +03:00
|
|
|
*/
|
|
|
|
void canvas_set_orientation(Canvas* canvas, CanvasOrientation orientation);
|
|
|
|
|
2021-10-03 13:36:05 +03:00
|
|
|
/** Get canvas orientation
|
|
|
|
*
|
|
|
|
* @param canvas Canvas instance
|
|
|
|
*
|
|
|
|
* @return CanvasOrientation
|
2021-05-19 12:43:15 +03:00
|
|
|
*/
|
|
|
|
CanvasOrientation canvas_get_orientation(const Canvas* canvas);
|