Hi,
I am trying to export an image drawn by my sketch as SVG. The export runs through, but the result is wrong.
Here is the output of the sketch in the render window:
…and here is the exported image as rendered by both Inkscape and Vivaldi:
Now, the w3 validator passes the generated SVG document, with only the warning
Character encoding declared at document level
However, the rendered image is clearly different from what I expect and want.
Here is the code to draw the image:
void draw()
{
beginRecord(SVG, "gankyil.svg");
float R = 200;
//clear();
pushMatrix();
translate(width/2, height/2);
strokeWeight(5);
for (int i = 0; i < 120; i++)
{
stroke(255, i*(255/120), i*(255/120));
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(TWO_PI/(1*360.0));
}
for (int i = 0; i < 120; i++)
{
stroke(i*(255/120), 255, i*(255/120));
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(TWO_PI/(1*360.0));
}
for (int i = 0; i < 120; i++)
{
stroke(i*(255/120), i*(255/120), 255);
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(TWO_PI/(1*360.0));
}
popMatrix();
// Segment into three sections with very thick black lines.
strokeWeight(8);
stroke(0, 0, 0);
ellipse(width/2, height/2, R, R);
translate(width/2, height/2);
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(2*PI/3.0);
arc(-R/2, 0, R/2, R/2, 0, PI);
rotate(2*PI/3.0);
arc(-R/2, 0, R/2, R/2, 0, PI);
endRecord();
}
You can just run that to get the SVG - I tried adding it in code tags, but it’s too large.
Any ideas on where to look to fix this behavior? In Processing, or in the SVG library…?