- 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 | ### pixelDensity()
Examples |
    size(100, 100);
    pixelDensity(2);
    noStroke();
    background(0);
    ellipse(30, 48, 36, 36);
    ellipse(70, 48, 36, 36);
    void setup() {
      size(100, 100);
      pixelDensity(2);
      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 makes it possible for Processing to render using all of the pixels on high resolutions screens like Apple Retina displays and Windows High-DPI displays. This function can only be run once within a program and it must be used right after size() in a program without a setup() and used within setup() when a program has one.
Syntax |
    pixelDensity(density)
Parameters |
density | int: 1 or 2
Returns | void

Updated on June 20, 2015 10:37:33pm UTC