ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_gfx.h
Go to the documentation of this file.
1
23
24#pragma once
25
26#include <stdint.h>
27
28#include "ra8_err.h"
29#include "ra8_gfx_font.h"
30
44
49typedef enum : uint16_t {
53
76[[nodiscard]] ra8_err_t
77ra8_gfx_init(void* fb, uint16_t width, uint16_t height, ra8_gfx_format_t format);
78
98[[nodiscard]] ra8_err_t ra8_gfx_clear(uint32_t color);
99
129[[nodiscard]] ra8_err_t ra8_gfx_set_clip(int32_t x, int32_t y, int32_t w, int32_t h);
130
145[[nodiscard]] ra8_err_t ra8_gfx_reset_clip(void);
146
164[[nodiscard]] ra8_err_t ra8_gfx_pixel(int32_t x, int32_t y, uint32_t color);
165
197[[nodiscard]] ra8_err_t
198ra8_gfx_blit_gray8(const uint8_t* src, int32_t w, int32_t h, int32_t dst_x, int32_t dst_y);
199
251[[nodiscard]] ra8_err_t ra8_gfx_blit_gray4_zoom(const uint8_t* src,
252 int32_t src_w,
253 int32_t src_h,
254 int32_t sx,
255 int32_t sy,
256 int32_t sw,
257 int32_t sh,
258 int32_t zoom,
259 int32_t dst_x,
260 int32_t dst_y);
261
277[[nodiscard]] ra8_err_t
278ra8_gfx_line(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color);
279
297[[nodiscard]] ra8_err_t
298ra8_gfx_rect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color, bool filled);
299
318[[nodiscard]] ra8_err_t
319ra8_gfx_circle(int32_t cx, int32_t cy, int32_t r, uint32_t color, bool filled);
320
341[[nodiscard]] ra8_err_t ra8_gfx_text_out(int32_t x,
342 int32_t y,
343 const char* str,
344 const ra8_gfx_font_t* font,
345 uint32_t fg_color,
346 uint32_t bg_color);
347
365[[nodiscard]] ra8_err_t
366ra8_gfx_text_size(const char* str, const ra8_gfx_font_t* font, uint32_t* out_w, uint32_t* out_h);
367
387[[nodiscard]] ra8_err_t ra8_gfx_blit(const void* src_buf,
388 uint16_t src_w,
389 uint16_t src_h,
390 ra8_gfx_format_t src_format,
391 int32_t dst_x,
392 int32_t dst_y);
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_err_t ra8_gfx_circle(int32_t cx, int32_t cy, int32_t r, uint32_t color, bool filled)
Draw a circle using midpoint algorithm.
ra8_gfx_format_t
Pixel format of the framebuffer bound by ra8_gfx_init().
Definition ra8_gfx.h:39
@ k_ra8_gfx_format_rgb565
16-bit RGB565, little-endian in memory.
Definition ra8_gfx.h:40
@ k_ra8_gfx_format_argb8888
32-bit ARGB, A in MSB.
Definition ra8_gfx.h:42
@ k_ra8_gfx_format_rgb888
24-bit packed R,G,B bytes.
Definition ra8_gfx.h:41
ra8_err_t ra8_gfx_line(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color)
Draw a line from (x0,y0) to (x1,y1) with Bresenham's algorithm.
ra8_err_t ra8_gfx_reset_clip(void)
Reset the clip rectangle to the whole framebuffer.
ra8_err_t ra8_gfx_blit_gray4_zoom(const uint8_t *src, int32_t src_w, int32_t src_h, int32_t sx, int32_t sy, int32_t sw, int32_t sh, int32_t zoom, int32_t dst_x, int32_t dst_y)
Nearest-neighbour integer-zoom blit of a sub-rectangle of a packed 4-bit grayscale image into the fra...
ra8_err_t ra8_gfx_blit(const void *src_buf, uint16_t src_w, uint16_t src_h, ra8_gfx_format_t src_format, int32_t dst_x, int32_t dst_y)
Copy a sub-image from src_buf into the framebuffer at (dst_x,dst_y).
ra8_gfx_dim_limits_t
Bounds on framebuffer dimensions accepted by ra8_gfx_init().
Definition ra8_gfx.h:49
@ k_ra8_gfx_min_dim
Minimum width or height in pixels.
Definition ra8_gfx.h:50
@ k_ra8_gfx_max_dim
Maximum supported edge length.
Definition ra8_gfx.h:51
ra8_err_t ra8_gfx_set_clip(int32_t x, int32_t y, int32_t w, int32_t h)
Restrict all subsequent drawing to a rectangle (dirty-region updates).
ra8_err_t ra8_gfx_clear(uint32_t color)
Fill the bound framebuffer's clip region with a single colour.
ra8_err_t ra8_gfx_text_size(const char *str, const ra8_gfx_font_t *font, uint32_t *out_w, uint32_t *out_h)
Compute rendered pixel dimensions of a string.
ra8_err_t ra8_gfx_pixel(int32_t x, int32_t y, uint32_t color)
Set a single pixel.
ra8_err_t ra8_gfx_text_out(int32_t x, int32_t y, const char *str, const ra8_gfx_font_t *font, uint32_t fg_color, uint32_t bg_color)
Render a NUL-terminated ASCII string.
ra8_err_t ra8_gfx_init(void *fb, uint16_t width, uint16_t height, ra8_gfx_format_t format)
Bind ra8_gfx to a caller-owned framebuffer.
ra8_err_t ra8_gfx_blit_gray8(const uint8_t *src, int32_t w, int32_t h, int32_t dst_x, int32_t dst_y)
Blit an 8-bit grayscale image to a framebuffer rectangle.
ra8_err_t ra8_gfx_rect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color, bool filled)
Draw an axis-aligned rectangle.
Bitmap font descriptor + bundled font handles for ra8_gfx.
Monochrome, fixed-width bitmap font descriptor.