From 41927aec1fb132dfe2f165b24d8cf294b67f3247 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Thu, 2 Dec 2021 16:06:15 -0500 Subject: [PATCH] Add dot mode. For single-point plots, like for paint pens. --- stipple_gen.pde | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/stipple_gen.pde b/stipple_gen.pde index 0bfef7b..40307b9 100644 --- a/stipple_gen.pde +++ b/stipple_gen.pde @@ -113,6 +113,7 @@ public class Config { public float gamma = 1.0; public boolean fill = false; + public boolean dot = false; public float line = 1.0; public String mode = "stipple"; //tsp @@ -286,6 +287,9 @@ public class Config { case "fill" : fill = boolOrDie(name, val); break; + case "dot" : + dot = boolOrDie(name, val); + break; case "line" : line = floatOrDie(name, val); break; @@ -1285,6 +1289,15 @@ void draw () { canvas.strokeWeight(1.0); } + if (!FileModeTSP && config.dot) { + canvas.noStroke(); + if (config.invert) { + canvas.fill(255); + } else { + canvas.fill(0); + } + } + if (FileModeTSP) { OptimizePlotPath(); canvas.background(config.invert ? 0 : 255); @@ -1317,7 +1330,7 @@ void draw () { dotDiam = config.minDotSize; } canvas.ellipse(px, py, dotDiam, dotDiam); - if (config.fill) { + if (!config.dot && config.fill) { hatchLines = fillCircle(px, py, dotDiam, 45.0, config.line * config.canvasScalar); if (hatchLines.size() > 0) { for (float[] linePoints : hatchLines) { @@ -1437,11 +1450,16 @@ void draw () { float xTemp = SVGscale * p1.x + xOffset; float yTemp = SVGscale * p1.y + yOffset; - - rowTemp = ""; + } else { + rowTemp = ""; // Typ: - if (config.fill) { + } + + if (!config.dot && config.fill) { hatchLines = fillCircle(xTemp, yTemp, dotRad * 2.0, 45.0, config.line); if (hatchLines.size() > 0) { for (float[] linePoints : hatchLines) {