Add dot mode. For single-point plots, like for paint pens.
This commit is contained in:
parent
0ccd0643f3
commit
41927aec1f
|
@ -113,6 +113,7 @@ public class Config {
|
||||||
public float gamma = 1.0;
|
public float gamma = 1.0;
|
||||||
|
|
||||||
public boolean fill = false;
|
public boolean fill = false;
|
||||||
|
public boolean dot = false;
|
||||||
public float line = 1.0;
|
public float line = 1.0;
|
||||||
|
|
||||||
public String mode = "stipple"; //tsp
|
public String mode = "stipple"; //tsp
|
||||||
|
@ -286,6 +287,9 @@ public class Config {
|
||||||
case "fill" :
|
case "fill" :
|
||||||
fill = boolOrDie(name, val);
|
fill = boolOrDie(name, val);
|
||||||
break;
|
break;
|
||||||
|
case "dot" :
|
||||||
|
dot = boolOrDie(name, val);
|
||||||
|
break;
|
||||||
case "line" :
|
case "line" :
|
||||||
line = floatOrDie(name, val);
|
line = floatOrDie(name, val);
|
||||||
break;
|
break;
|
||||||
|
@ -1285,6 +1289,15 @@ void draw () {
|
||||||
canvas.strokeWeight(1.0);
|
canvas.strokeWeight(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!FileModeTSP && config.dot) {
|
||||||
|
canvas.noStroke();
|
||||||
|
if (config.invert) {
|
||||||
|
canvas.fill(255);
|
||||||
|
} else {
|
||||||
|
canvas.fill(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (FileModeTSP) {
|
if (FileModeTSP) {
|
||||||
OptimizePlotPath();
|
OptimizePlotPath();
|
||||||
canvas.background(config.invert ? 0 : 255);
|
canvas.background(config.invert ? 0 : 255);
|
||||||
|
@ -1317,7 +1330,7 @@ void draw () {
|
||||||
dotDiam = config.minDotSize;
|
dotDiam = config.minDotSize;
|
||||||
}
|
}
|
||||||
canvas.ellipse(px, py, dotDiam, dotDiam);
|
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);
|
hatchLines = fillCircle(px, py, dotDiam, 45.0, config.line * config.canvasScalar);
|
||||||
if (hatchLines.size() > 0) {
|
if (hatchLines.size() > 0) {
|
||||||
for (float[] linePoints : hatchLines) {
|
for (float[] linePoints : hatchLines) {
|
||||||
|
@ -1438,10 +1451,15 @@ void draw () {
|
||||||
float xTemp = SVGscale * p1.x + xOffset;
|
float xTemp = SVGscale * p1.x + xOffset;
|
||||||
float yTemp = SVGscale * p1.y + yOffset;
|
float yTemp = SVGscale * p1.y + yOffset;
|
||||||
|
|
||||||
rowTemp = "<circle cx=\"" + xTemp + "\" cy=\"" + yTemp + "\" r=\"" + dotRad +
|
if (config.dot) {
|
||||||
|
rowTemp = "<path d=\"M " + xTemp + "," + yTemp + " L " + (xTemp + 0.01 ) + "," + yTemp + "\" style=\"fill:none;stroke:black;stroke-width:" + dotRad + ";\"/>";
|
||||||
|
} else {
|
||||||
|
rowTemp = "<circle cx=\"" + xTemp + "\" cy=\"" + yTemp + "\" r=\"" + dotRad +
|
||||||
"\" style=\"fill:none;stroke:black;stroke-width:1;\"/>";
|
"\" style=\"fill:none;stroke:black;stroke-width:1;\"/>";
|
||||||
// Typ: <circle cx="1600" cy="450" r="3" style="fill:none;stroke:black;stroke-width:2;"/>
|
// Typ: <circle cx="1600" cy="450" r="3" style="fill:none;stroke:black;stroke-width:2;"/>
|
||||||
if (config.fill) {
|
}
|
||||||
|
|
||||||
|
if (!config.dot && config.fill) {
|
||||||
hatchLines = fillCircle(xTemp, yTemp, dotRad * 2.0, 45.0, config.line);
|
hatchLines = fillCircle(xTemp, yTemp, dotRad * 2.0, 45.0, config.line);
|
||||||
if (hatchLines.size() > 0) {
|
if (hatchLines.size() > 0) {
|
||||||
for (float[] linePoints : hatchLines) {
|
for (float[] linePoints : hatchLines) {
|
||||||
|
|
Loading…
Reference in New Issue