Muteki
EABI code execution on Besta® RTOS devices.
Loading...
Searching...
No Matches
lcd.h
Go to the documentation of this file.
1/*
2 * Copyright 2024-2026 dogtopus
3 * SPDX-License-Identifier: MIT
4 */
5
12
13#ifndef __MUTEKI_DRAW_LCD_H__
14#define __MUTEKI_DRAW_LCD_H__
15
16#include "types/lcd.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
29extern unsigned short GetFontType(void);
30
38extern unsigned short SetFontType(unsigned short font_type);
39
60extern void WriteAlignString(short x, short y, const void *s, short max_length, int align, unsigned int flags);
61
72extern void WriteChar(short x, short y, UTF16 c, unsigned int flags);
73
86extern void WriteString(short x, short y, const void *s, unsigned int flags);
87
96extern void Printf(const char *format, ...) SYS_IS_PRINTF(1, 2);
97
107extern void PrintfXY(short x, short y, const char *format, ...) SYS_IS_PRINTF(3, 4);
108
122extern int ShowGraphic(short x, short y, lcd_surface_t *surface, unsigned short flags);
123
130extern unsigned int SetCursorSize(unsigned int new_size);
131
138extern unsigned int GetCursorSize(void);
139
147extern void SetCursorPosition(short x, short y);
148
156extern void GetCursorPosition(short *x, short *y);
157
165extern short SetCursorType(short new_type);
166
174extern short GetCursorType(void);
175
181extern void CursorLock(void);
182
188extern void CursorUnlock(void);
189
197extern int SetTransparentColor(int color);
198
205extern int rgbSetBkColor(int color);
206
213extern int rgbSetColor(int color);
214
229short SetPenStyle(short dash, unsigned int *dash_pattern);
230
237short GetPenStyle(unsigned int *dash_pattern);
238
245short GetPenSize(void);
246
253short SetPenSize(short size);
254
263int GetPixel(short x, short y);
264
275int SetPixel(short x, short y, int color);
276
290extern size_t GetImage(short x0, short y0, short x1, short y1, lcd_surface_t *surface);
291
305extern void PutImage(short x, short y, lcd_surface_t *surface, unsigned short flags);
306
319extern void SetDrawArea(short x0, short y0, short x1, short y1);
320
330extern void GetDrawArea(short *x0, short *y0, short *x1, short *y1);
331
342extern void DrawLine(short x0, short y0, short x1, short y1, unsigned int flags);
343
354extern void DrawRect(short x0, short y0, short x1, short y1, unsigned int flags);
355
366extern void FillRect(short x0, short y0, short x1, short y1, unsigned int flags);
367
380extern void DrawRoundRect(short x0, short y0, short x1, short y1, short rx, short ry, unsigned int flags);
381
391extern void DrawCircle(short x, short y, short r, unsigned int flags);
392
403extern void FillCircle(short x, short y, short r, unsigned int flags);
404
415extern void DrawEllipse(short x, short y, short rx, short ry, unsigned int flags);
416
427extern void FillEllipse(short x, short y, short rx, short ry, unsigned int flags);
428
438extern void InverseSetArea(short x0, short y0, short x1, short y1);
439
446extern void ClearScreen(bool fill_with_fg);
447
458extern void ScrollDown(short x0, short y0, short x1, short y1, short amount);
459
470extern void ScrollLeft(short x0, short y0, short x1, short y1, short amount);
471
482extern void ScrollRight(short x0, short y0, short x1, short y1, short amount);
483
494extern void ScrollUp(short x0, short y0, short x1, short y1, short amount);
495
507extern lcd_t *CreateVirtualLCD(short width, short height, short width_bytes);
508
515extern void DeleteVirtualLCD(lcd_t *lcd);
516
523extern lcd_t *SetActiveLCD(lcd_t *new_lcd);
524
531extern lcd_t *GetActiveLCD(void);
532
546
558extern lcd_surface_t *CreateCompatibleImage(const lcd_t *source, short width, short height);
559
567extern bool DeleteLCD(lcd_thread_safe_t *lcd);
568
578
585extern void DeleteLCDObject(lcd_t *lcd);
586
600extern lcd_surface_t *SetDCObject(lcd_t *lcd, lcd_surface_t *new_surface);
601
611extern short GetMaxScrX(void);
612
622extern short GetMaxScrY(void);
623
624#ifdef __cplusplus
625} // extern "C"
626#endif
627
628#endif // __MUTEKI_DRAW_LCD_H__
#define UTF16
"Portable" Besta UTF-16 type used by other headers.
Definition common.h:54
#define SYS_IS_PRINTF(arg_index_str, arg_index_fmt)
Attribute for opting a function in for printf static checking.
Definition common.h:92
void PutImage(short x, short y, lcd_surface_t *surface, unsigned short flags)
Copy pixels from a surface to current active LCD.
void DeleteLCDObject(lcd_t *lcd)
Free a regular LCD descriptor.
bool DeleteLCD(lcd_thread_safe_t *lcd)
Free a thread-safe LCD descriptor.
void GetCursorPosition(short *x, short *y)
Get the cursor position on the current canvas.
void DrawRect(short x0, short y0, short x1, short y1, unsigned int flags)
Stroke a rectangle on the current active LCD.
void Printf(const char *format,...) SYS_IS_PRINTF(1
Format and draw a string.
short GetPenSize(void)
Get the stroke width.
void DrawCircle(short x, short y, short r, unsigned int flags)
Stroke a circle on the current active LCD.
void SetDrawArea(short x0, short y0, short x1, short y1)
Set the drawing area of the current active LCD.
lcd_surface_t * SelectLCDObject(lcd_t *lcd, lcd_surface_t *new_surface)
Checked version of SetDCObject().
short GetPenStyle(unsigned int *dash_pattern)
Get the stroke dash pattern.
int rgbSetColor(int color)
Set display canvas foreground fill color.
void WriteString(short x, short y, const void *s, unsigned int flags)
Draw a string s aligned to the top left corner at (x, y) px.
void DrawRoundRect(short x0, short y0, short x1, short y1, short rx, short ry, unsigned int flags)
Stroke a rounded corner rectangle on the current active LCD.
void ScrollUp(short x0, short y0, short x1, short y1, short amount)
Move a rectangle up by amount pixels.
void InverseSetArea(short x0, short y0, short x1, short y1)
Invert color within a rectangle.
short GetMaxScrY(void)
Get Y coordinate of the bottom-most visible pixels on the current canvas.
void ScrollDown(short x0, short y0, short x1, short y1, short amount)
Move a rectangle down by amount pixels.
int SetPixel(short x, short y, int color)
Set the pixel color on the current active surface with the given pixel.
void FillCircle(short x, short y, short r, unsigned int flags)
Fill a circle on the current active LCD.
void FillRect(short x0, short y0, short x1, short y1, unsigned int flags)
Fill a rectangle on the current active LCD.
void void PrintfXY(short x, short y, const char *format,...) SYS_IS_PRINTF(3
Format and draw a string aligned to the top left corner at (x, y) px.
unsigned int GetCursorSize(void)
Get the size of the cursor on the current canvas.
lcd_surface_t * SetDCObject(lcd_t *lcd, lcd_surface_t *new_surface)
Link a surface (device context) to an LCD descriptor.
size_t GetImage(short x0, short y0, short x1, short y1, lcd_surface_t *surface)
Copy a rectangle of pixels from current active LCD and save it to the specified buffer.
lcd_t * SetActiveLCD(lcd_t *new_lcd)
Set an LCD descriptor as active.
void WriteAlignString(short x, short y, const void *s, short max_length, int align, unsigned int flags)
Draw a string s with specified alignment at (x, y) px.
int rgbSetBkColor(int color)
Set display canvas background fill color.
void FillEllipse(short x, short y, short rx, short ry, unsigned int flags)
Fill an ellipse on the current active LCD.
void WriteChar(short x, short y, UTF16 c, unsigned int flags)
Draw a UTF-16 character c aligned to the top left corner at (x, y) px.
short SetCursorType(short new_type)
Set the type of the cursor on the current canvas.
void CursorUnlock(void)
Unlock the cursor on the current canvas.
short SetPenSize(short size)
Set the stroke width.
lcd_t * CreateVirtualLCD(short width, short height, short width_bytes)
Create a virtual LCD descriptor.
void CursorLock(void)
Lock the cursor on the current canvas.
void ClearScreen(bool fill_with_fg)
Fill the current display canvas with background color, effectively clearing it.
void SetCursorPosition(short x, short y)
Move the cursor position on the current canvas to the specified coordinate.
unsigned short GetFontType(void)
Get the current font type.
short GetMaxScrX(void)
Get X coordinate of the rightmost visible pixels on the current canvas.
int SetTransparentColor(int color)
Set display canvas transparent color.
void void int ShowGraphic(short x, short y, lcd_surface_t *surface, unsigned short flags)
Draw a surface onto the current active LCD.
void ScrollLeft(short x0, short y0, short x1, short y1, short amount)
Move a rectangle left by amount pixels.
void DeleteVirtualLCD(lcd_t *lcd)
Dispose a previously created virtual LCD descriptor.
lcd_surface_t * CreateCompatibleImage(const lcd_t *source, short width, short height)
Create a surface for an LCD descriptor.
lcd_t * GetActiveLCD(void)
Get the current active LCD descriptor.
void DrawLine(short x0, short y0, short x1, short y1, unsigned int flags)
Stroke a line on the current active LCD.
short GetCursorType(void)
Get the type of the cursor on the current canvas.
void GetDrawArea(short *x0, short *y0, short *x1, short *y1)
Get the drawing area of the current active LCD.
lcd_t * CreateCompatibleLCD(lcd_t *source)
Copy an LCD descriptor (excluding surface).
unsigned int SetCursorSize(unsigned int new_size)
Set the size of the cursor on the current canvas.
unsigned short SetFontType(unsigned short font_type)
Set the current font type to font_type.
int GetPixel(short x, short y)
Get the RGB value of a pixel on the current active surface.
void DrawEllipse(short x, short y, short rx, short ry, unsigned int flags)
Stroke an ellipse on the current active LCD.
void ScrollRight(short x0, short y0, short x1, short y1, short amount)
Move a rectangle right by amount pixels.
short SetPenStyle(short dash, unsigned int *dash_pattern)
Set the stroke dash pattern.
Display canvas (LCD) type definitions.
struct lcd_base_s lcd_t
lcd_base_s
Definition lcd.h:155
struct lcd_thread_safe_s lcd_thread_safe_t
lcd_thread_safe_s
Definition lcd.h:146
struct lcd_surface_s lcd_surface_t
Descriptor of an LCD drawing surface or hardware framebuffer.