Loading...
Searching...
No Matches
canvas_i.h File Reference

GUI: internal Canvas API. More...

#include "canvas.h"
#include <u8g2.h>
#include <toolbox/compress.h>
#include <m-array.h>
#include <m-algo.h>
#include <furi.h>

Go to the source code of this file.

Data Structures

struct  CanvasCallbackPair
 
struct  Canvas
 Canvas structure. More...
 

Macros

#define ICON_DECOMPRESSOR_BUFFER_SIZE   (128u * 64 / 8)
 
#define M_OPL_CanvasCallbackPairArray_t()
 

Typedefs

typedef void(* CanvasCommitCallback) (uint8_t *data, size_t size, CanvasOrientation orientation, void *context)
 

Functions

 ARRAY_DEF (CanvasCallbackPairArray, CanvasCallbackPair, M_POD_OPLIST)
 
 ALGO_DEF (CanvasCallbackPairArray, CanvasCallbackPairArray_t)
 
Canvascanvas_init (void)
 Allocate memory and initialize canvas.
 
void canvas_free (Canvas *canvas)
 Free canvas memory.
 
uint8_t * canvas_get_buffer (Canvas *canvas)
 Get canvas buffer.
 
size_t canvas_get_buffer_size (const Canvas *canvas)
 Get canvas buffer size.
 
void canvas_frame_set (Canvas *canvas, int32_t offset_x, int32_t offset_y, size_t width, size_t height)
 Set drawing region relative to real screen buffer.
 
void canvas_set_orientation (Canvas *canvas, CanvasOrientation orientation)
 Set canvas orientation.
 
CanvasOrientation canvas_get_orientation (const Canvas *canvas)
 Get canvas orientation.
 
void canvas_draw_u8g2_bitmap (u8g2_t *u8g2, int32_t x, int32_t y, size_t width, size_t height, const uint8_t *bitmap, IconRotation rotation)
 Draw a u8g2 bitmap.
 
void canvas_add_framebuffer_callback (Canvas *canvas, CanvasCommitCallback callback, void *context)
 Add canvas commit callback.
 
void canvas_remove_framebuffer_callback (Canvas *canvas, CanvasCommitCallback callback, void *context)
 Remove canvas commit callback.
 

Detailed Description

GUI: internal Canvas API.

Macro Definition Documentation

◆ M_OPL_CanvasCallbackPairArray_t

#define M_OPL_CanvasCallbackPairArray_t ( )
Value:
ARRAY_OPLIST(CanvasCallbackPairArray, M_POD_OPLIST)

Function Documentation

◆ canvas_add_framebuffer_callback()

void canvas_add_framebuffer_callback ( Canvas * canvas,
CanvasCommitCallback callback,
void * context )

Add canvas commit callback.

This callback will be called upon Canvas commit.

Parameters
canvasCanvas instance
callbackCanvasCommitCallback
contextCanvasCommitCallback context

◆ canvas_draw_u8g2_bitmap()

void canvas_draw_u8g2_bitmap ( u8g2_t * u8g2,
int32_t x,
int32_t y,
size_t width,
size_t height,
const uint8_t * bitmap,
IconRotation rotation )

Draw a u8g2 bitmap.

Parameters
u8g2u8g2 instance
xx coordinate
yy coordinate
widthwidth
heightheight
bitmapbitmap
rotationrotation

◆ canvas_frame_set()

void canvas_frame_set ( Canvas * canvas,
int32_t offset_x,
int32_t offset_y,
size_t width,
size_t height )

Set drawing region relative to real screen buffer.

Parameters
canvasCanvas instance
offset_xx coordinate offset
offset_yy coordinate offset
widthwidth
heightheight

◆ canvas_free()

void canvas_free ( Canvas * canvas)

Free canvas memory.

Parameters
canvasCanvas instance

◆ canvas_get_buffer()

uint8_t * canvas_get_buffer ( Canvas * canvas)

Get canvas buffer.

Parameters
canvasCanvas instance
Returns
pointer to buffer

◆ canvas_get_buffer_size()

size_t canvas_get_buffer_size ( const Canvas * canvas)

Get canvas buffer size.

Parameters
canvasCanvas instance
Returns
size of canvas in bytes

◆ canvas_get_orientation()

CanvasOrientation canvas_get_orientation ( const Canvas * canvas)

Get canvas orientation.

Parameters
canvasCanvas instance
Returns
CanvasOrientation

◆ canvas_init()

Canvas * canvas_init ( void )

Allocate memory and initialize canvas.

Returns
Canvas instance

◆ canvas_remove_framebuffer_callback()

void canvas_remove_framebuffer_callback ( Canvas * canvas,
CanvasCommitCallback callback,
void * context )

Remove canvas commit callback.

Parameters
canvasCanvas instance
callbackCanvasCommitCallback
contextCanvasCommitCallback context

◆ canvas_set_orientation()

void canvas_set_orientation ( Canvas * canvas,
CanvasOrientation orientation )

Set canvas orientation.

Parameters
canvasCanvas instance
orientationCanvasOrientation