Phaser.Display.Canvas.CanvasInterpolation
Scope: static
Source: src/display/canvas/CanvasInterpolation.js#L7
Since: 3.0.0
Static functions
setBicubic
<static> setBicubic(canvas)
Description:
Sets the CSS image-rendering property on the given canvas to auto, restoring the default browser behavior. This allows the browser to apply smooth (typically bicubic) interpolation when scaling the canvas, which produces softer edges and is better suited to high-resolution textures or non-pixel-art content. Also sets the IE-specific msInterpolationMode to bicubic.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| canvas | HTMLCanvasElement | No | The canvas object to have the style set on. |
Returns: HTMLCanvasElement - The canvas.
Source: src/display/canvas/CanvasInterpolation.js#L49
Since: 3.0.0
setCrisp
<static> setCrisp(canvas)
Description:
Sets the CSS image-rendering property on the given canvas to use nearest-neighbor (crisp) scaling. This disables anti-aliasing so that each pixel is rendered as a hard-edged block, which is ideal for pixel art games. Multiple vendor-prefixed values are applied in sequence to ensure cross-browser compatibility, including Firefox (-moz-crisp-edges), Opera (-o-crisp-edges), WebKit (-webkit-optimize-contrast), and Internet Explorer (msInterpolationMode: nearest-neighbor).
Parameters:
| name | type | optional | description |
|---|---|---|---|
| canvas | HTMLCanvasElement | No | The canvas object to have the style set on. |
Returns: HTMLCanvasElement - The canvas.
Source: src/display/canvas/CanvasInterpolation.js#L21
Since: 3.0.0