- Processing
- p5.js
- Processing.py

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing 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 is new with Processing 3.0. It 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 June 20, 2015 10:37:33pm UTC