首页 > 文档 > displayDensity()显示屏密度判断函数
2017
07-03

displayDensity()显示屏密度判断函数

3.displayDensity()

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.

如果屏幕是一个高密度的屏幕(在OS X上的视网膜显示或在Windows和Linux上的high – dpi上显示的视网膜)函数返回“1”;如果不是的话,这个函数将返回数字“2”。这个信息对于一个程序来说是有用的,它可以在支持它的屏幕上以双倍的像素密度运行。

Syntax(语法):displayDensity()

displayDensity(display)

Parameters (参数):display——the display number to check显示号码检查

Returns返回值):int

Related相关函数):pixelDensity()
size()

 



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。