mirror of
https://github.com/processing/processing4.git
synced 2026-01-25 09:21:07 +01:00
Per https://github.com/processing/processing4/issues/58, pixelDensity should run in settings and currently results in failure if used in static context. This will rewrite pixelDensity into the setting section if found in static or settings context. Adds unit tests for both scenarios.
42 lines
965 B
Plaintext
42 lines
965 B
Plaintext
import processing.core.*;
|
|
import processing.data.*;
|
|
import processing.event.*;
|
|
import processing.opengl.*;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.ArrayList;
|
|
import java.io.File;
|
|
import java.io.BufferedReader;
|
|
import java.io.PrintWriter;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
import java.io.IOException;
|
|
|
|
public class staticpixeldensity extends PApplet {
|
|
|
|
public void setup() {
|
|
/* size commented out by preprocessor */;
|
|
/* pixelDensity commented out by preprocessor */;
|
|
noStroke();
|
|
background(0);
|
|
ellipse(30, 48, 36, 36);
|
|
ellipse(70, 48, 36, 36);
|
|
|
|
noLoop();
|
|
}
|
|
|
|
public void settings() {
|
|
size(100,100);
|
|
pixelDensity(2);
|
|
}
|
|
|
|
static public void main(String[] passedArgs) {
|
|
String[] appletArgs = new String[] { "staticpixeldensity" };
|
|
if (passedArgs != null) {
|
|
PApplet.main(concat(appletArgs, passedArgs));
|
|
} else {
|
|
PApplet.main(appletArgs);
|
|
}
|
|
}
|
|
}
|