summaryrefslogtreecommitdiff
path: root/lib/libgfx/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-08-03 03:25:59 -0400
committerIan Moffett <ian@osmora.org>2025-08-03 03:25:59 -0400
commita50119daf92b52951c3a68fe70d8d5bf548adf55 (patch)
tree6489cea3332ed6739f9cbeaf859de79005dd7a13 /lib/libgfx/include
parent96d4341a01c9b935d309ccc4b6d31d852a76257b (diff)
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 <ian@osmora.org>
Diffstat (limited to 'lib/libgfx/include')
-rw-r--r--lib/libgfx/include/libgfx/draw.h13
1 files changed, 13 insertions, 0 deletions
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)