aboutsummaryrefslogtreecommitdiffstats
path: root/rtgrpblib_fill_shapes.c
diff options
context:
space:
mode:
Diffstat (limited to 'rtgrpblib_fill_shapes.c')
-rw-r--r--rtgrpblib_fill_shapes.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/rtgrpblib_fill_shapes.c b/rtgrpblib_fill_shapes.c
new file mode 100644
index 0000000..285a1fd
--- /dev/null
+++ b/rtgrpblib_fill_shapes.c
@@ -0,0 +1,38 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+#ifndef TEST
+
+
+void
+rtgrpblib_fill_shapes(double *restrict image, size_t rowsize, const RASTER *raster)
+{
+ const CELL *cells = raster->cells;
+ double inklevel;
+ size_t x, y;
+
+#ifndef ROWWISE_RESET_INKLEVEL
+ inklevel = 0;
+#endif
+ for (y = 0; y < raster->height; y++) {
+#ifdef ROWWISE_RESET_INKLEVEL
+ inklevel = 0;
+#endif
+ for (x = 0; x < raster->width; x++) {
+ image[x] = fmin(fabs(inklevel + cells[x].cell_coverage), 1.0);
+ inklevel += cells[x].opposite_coverage;
+ }
+ image = &image[rowsize];
+ cells = &cells[raster->width];
+ }
+}
+
+
+#else
+
+int
+main(void)
+{
+ return 0; /* TODO add test */
+}
+
+#endif