Made an important change that removes some of the mystery in the scaling values. Originally it was using an arbitrary value of 1536x1056 and was scaled at 800 / canvasWidth (???). Now it will be set to the canvas value, which gives the user control over the final resolution of the SVG.

This commit is contained in:
mattmcw 2021-08-03 00:36:57 -04:00
parent 3dfd46bab0
commit 7bc971167b
2 changed files with 9 additions and 4 deletions

View File

@ -9,8 +9,8 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1536"
height="1056"
width="{{WIDTH}}"
height="{{HEIGHT}}"
id="svg2985"
version="1.1"
inkscape:version="0.48.1 r9760">

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -84,7 +84,7 @@ public class Config {
public int canvasWidth = 800;
public int canvasHeight = 600;
public float canvasScalar = 2.0;
public float canvasScalar = 1.0;
public boolean display = true;
public int windowWidth = 800;
@ -1350,9 +1350,14 @@ void draw () {
FileOutput = loadStrings("header.txt");
String rowTemp;
for (i = 0; i < FileOutput.length; i++) {
FileOutput[i] = FileOutput[i].replace("{{WIDTH}}", str(config.canvasWidth));
FileOutput[i] = FileOutput[i].replace("{{HEIGHT}}", str(config.canvasHeight));
}
//Need to get some background on this.
//what are these magic numbers?
float SVGscale = (800.0 / (float) config.canvasHeight);
float SVGscale = 1.0; //(800.0 / (float) config.canvasHeight);
//not centering the image is more controllable
int xOffset = 0; //(int) (1536 - (SVGscale * config.canvasWidth / 2));
int yOffset = 0; //(int) (1056 - (SVGscale * config.canvasHeight / 2));