summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/canvas.c13
-rw-r--r--libdimension/dimension/canvas.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/libdimension/canvas.c b/libdimension/canvas.c
index 2d0df2e..14bc156 100644
--- a/libdimension/canvas.c
+++ b/libdimension/canvas.c
@@ -95,3 +95,16 @@ dmnsn_set_pixel(dmnsn_canvas *canvas, unsigned int x, unsigned int y,
(*optimizer.optimizer_fn)(canvas, optimizer, x, y);
}
}
+
+/* Fill a canvas with a solid color */
+void
+dmnsn_clear_canvas(dmnsn_canvas *canvas, dmnsn_color color)
+{
+ unsigned int x;
+ for (x = 0; x < canvas->x; ++x) {
+ unsigned int y;
+ for (y = 0; y < canvas->y; ++y) {
+ dmnsn_set_pixel(canvas, x, y, color);
+ }
+ }
+}
diff --git a/libdimension/dimension/canvas.h b/libdimension/dimension/canvas.h
index 67b88df..306b55c 100644
--- a/libdimension/dimension/canvas.h
+++ b/libdimension/dimension/canvas.h
@@ -75,5 +75,6 @@ dmnsn_get_pixel(const dmnsn_canvas *canvas, unsigned int x, unsigned int y)
void dmnsn_set_pixel(dmnsn_canvas *canvas, unsigned int x, unsigned int y,
dmnsn_color color);
+void dmnsn_clear_canvas(dmnsn_canvas *canvas, dmnsn_color color);
#endif /* DIMENSION_CANVAS_H */