( begin auto-generated from displayDensity.xml ) 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
()
| 1137 | * @see PApplet#size(int,int) |
| 1138 | */ |
| 1139 | public int displayDensity() { |
| 1140 | if (display != SPAN && (fullScreen || present)) { |
| 1141 | return displayDensity(display); |
| 1142 | } |
| 1143 | // walk through all displays, use 2 if any display is 2 |
| 1144 | for (int i = 0; i < displayDevices.length; i++) { |
| 1145 | if (displayDensity(i+1) == 2) { |
| 1146 | return 2; |
| 1147 | } |
| 1148 | } |
| 1149 | // If nobody's density is 2 then everyone is 1 |
| 1150 | return 1; |
| 1151 | } |
| 1152 | |
| 1153 | /** |
| 1154 | * @param display the display number to check |
no test coverage detected