Add configuration options for fillAngle (default 45 degrees) and fillRandom, which will randomize the angle on every dot drawn. Calling this release 2.1.2.
This commit is contained in:
parent
26985553a7
commit
6a3c991dc2
|
@ -32,7 +32,7 @@ Other variables:
|
||||||
```java
|
```java
|
||||||
public int canvasWidth = 800;
|
public int canvasWidth = 800;
|
||||||
public int canvasHeight = 600;
|
public int canvasHeight = 600;
|
||||||
public float canvasScalar = 1.25;
|
public float canvasScalar = 1.0;
|
||||||
|
|
||||||
public boolean display = true;
|
public boolean display = true;
|
||||||
public int windowWidth = 800;
|
public int windowWidth = 800;
|
||||||
|
@ -60,6 +60,7 @@ public boolean gammaCorrection = false;
|
||||||
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;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,8 @@ public class Config {
|
||||||
public float gamma = 1.0;
|
public float gamma = 1.0;
|
||||||
|
|
||||||
public boolean fill = false;
|
public boolean fill = false;
|
||||||
|
public float fillAngle = 45.0;
|
||||||
|
public boolean fillRandom = false;
|
||||||
public boolean dot = false;
|
public boolean dot = false;
|
||||||
public float line = 1.0;
|
public float line = 1.0;
|
||||||
|
|
||||||
|
@ -285,6 +287,12 @@ public class Config {
|
||||||
case "fill" :
|
case "fill" :
|
||||||
fill = boolOrDie(name, val);
|
fill = boolOrDie(name, val);
|
||||||
break;
|
break;
|
||||||
|
case "fillAngle" :
|
||||||
|
fillAngle = floatOrDie(name, val);
|
||||||
|
break;
|
||||||
|
case "fillRandom" :
|
||||||
|
fillRandom = boolOrDie(name, val);
|
||||||
|
break;
|
||||||
case "dot" :
|
case "dot" :
|
||||||
dot = boolOrDie(name, val);
|
dot = boolOrDie(name, val);
|
||||||
break;
|
break;
|
||||||
|
@ -1188,6 +1196,7 @@ void draw () {
|
||||||
float dotRad;
|
float dotRad;
|
||||||
float dotDiam;
|
float dotDiam;
|
||||||
float cutoffScaled = 1 - config.cutoff;
|
float cutoffScaled = 1 - config.cutoff;
|
||||||
|
float hatchAngle;
|
||||||
ArrayList<float[]> hatchLines;
|
ArrayList<float[]> hatchLines;
|
||||||
|
|
||||||
canvas.beginDraw();
|
canvas.beginDraw();
|
||||||
|
@ -1329,7 +1338,8 @@ void draw () {
|
||||||
}
|
}
|
||||||
canvas.ellipse(px, py, dotDiam, dotDiam);
|
canvas.ellipse(px, py, dotDiam, dotDiam);
|
||||||
if (!config.dot && config.fill) {
|
if (!config.dot && config.fill) {
|
||||||
hatchLines = fillCircle(px, py, dotDiam, 45.0, config.line * config.canvasScalar);
|
hatchAngle = config.fillRandom ? random(0.0, 360.0) : config.fillAngle;
|
||||||
|
hatchLines = fillCircle(px, py, dotDiam, hatchAngle, config.line * config.canvasScalar);
|
||||||
if (hatchLines.size() > 0) {
|
if (hatchLines.size() > 0) {
|
||||||
for (float[] linePoints : hatchLines) {
|
for (float[] linePoints : hatchLines) {
|
||||||
canvas.line(linePoints[0], linePoints[1], linePoints[2], linePoints[3]);
|
canvas.line(linePoints[0], linePoints[1], linePoints[2], linePoints[3]);
|
||||||
|
@ -1458,7 +1468,8 @@ void draw () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.dot && config.fill) {
|
if (!config.dot && config.fill) {
|
||||||
hatchLines = fillCircle(xTemp, yTemp, dotRad * 2.0, 45.0, config.line);
|
hatchAngle = config.fillRandom ? random(0.0, 360.0) : config.fillAngle;
|
||||||
|
hatchLines = fillCircle(xTemp, yTemp, dotRad * 2.0, hatchAngle, config.line);
|
||||||
if (hatchLines.size() > 0) {
|
if (hatchLines.size() > 0) {
|
||||||
for (float[] linePoints : hatchLines) {
|
for (float[] linePoints : hatchLines) {
|
||||||
rowTemp += "<line x1=\"" + linePoints[0] + "\" y1=\"" + linePoints[1] + "\" x2=\"" + linePoints[2] + "\" y2=\"" + linePoints[3] + "\" style=\"fill:none;stroke:black;stroke-width:1;\"/>";
|
rowTemp += "<line x1=\"" + linePoints[0] + "\" y1=\"" + linePoints[1] + "\" x2=\"" + linePoints[2] + "\" y2=\"" + linePoints[3] + "\" style=\"fill:none;stroke:black;stroke-width:1;\"/>";
|
||||||
|
|
Loading…
Reference in New Issue