displayDensity()

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. 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.

名称

displayDensity()

示例


void setup()
{  
size(100, 100);


pixelDensity(displayDensity());


noStroke();


  } 
void draw()
{  
background(0);


ellipse(30, 48, 36, 36);


ellipse(70, 48, 36, 36);


  } 
描述 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.
语法
displayDensity() displayDensity(display)
参数
display int: the display number to check
返回值 int
相关 pixelDensity()
size()

Updated on October 2, 2018 05:02:04pm EDT

displayDensity()