Sets the framebuffer's pixel density or returns its current density.
Computer displays are grids of little lights called pixels. A display's pixel density describes how many pixels it packs into an area. Displays with smaller pixels have a higher pixel density and create sharper images.
The parameter, density
, is optional. If a number is passed, as in myBuffer.pixelDensity(1)
, it sets the framebuffer's pixel density. By default, the framebuffer's pixel density will match that of the canvas where it was created. All canvases default to match the display's pixel density.
Calling myBuffer.pixelDensity()
without an argument returns its current pixel density.
示例
语法
pixelDensity([density])
参数
density
Number:
pixel density to set.
Returns
Number: current pixel density.
Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/p5.Framebuffer.js and open a pull request!