This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.
Name |
displayDensity() |
Examples |
void setup() {
size(100, 100);
int d = displayDensity();
pixelDensity(d);
noStroke();
}
void draw() {
background(0);
ellipse(30, 48, 36, 36);
ellipse(70, 48, 36, 36);
}
|
Description |
This function returns the number "2" if the screen is a high-density screen (called a Retina display on OS X or high-dpi on Windows and Linux) and a "1" if not. This information is useful for a program to adapt to run at double the pixel density on a screen that supports it.
|
Syntax | displayDensity()
displayDensity(display) |
Parameters |
display |
int: the display number to check |
|
Returns | int |
Updated on March 16, 2016 10:39:04am EDT