- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

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);
      pixelDensity(displayDensity());
      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
Related | pixelDensity() size()

Updated on July 4, 2018 11:56:41am EDT