From a50119daf92b52951c3a68fe70d8d5bf548adf55 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 3 Aug 2025 03:25:59 -0400 Subject: libgfx: draw: Add gfx_plot_point() pixel plotting Implement mechanism that allows one to plot pixels on the screen with a specific color at specific x/y coordinates. Example: -- struct gfx_point p = { .x = 150, .y = 200, .color = GFX_GREEN }; /* Draw green point at (150,200) */ gfx_plot_point(&ctx, &p); -- Signed-off-by: Ian Moffett --- lib/libgfx/include/libgfx/draw.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/libgfx/include') diff --git a/lib/libgfx/include/libgfx/draw.h b/lib/libgfx/include/libgfx/draw.h index 3bd013a..9f56f6c 100644 --- a/lib/libgfx/include/libgfx/draw.h +++ b/lib/libgfx/include/libgfx/draw.h @@ -89,7 +89,20 @@ struct gfx_shape { dimm_t height; }; +/* + * A point or single pixel that + * may be plotted onto the screen. + * + * @x,y: Position of the point on the screen + * @rgb: Color of the point (RGB) + */ +struct gfx_point { + scrpos_t x, y; + color_t rgb; +}; + int gfx_draw_shape(struct gfx_ctx *ctx, const struct gfx_shape *shape); +int gfx_plot_point(struct gfx_ctx *ctx, const struct gfx_point *point); __always_inline static inline size_t gfx_io_index(struct gfx_ctx *ctx, scrpos_t x, scrpos_t y) -- cgit v1.2.3