- Since: 3.0.0
- Source: src/display/canvas/Smoothing.js (Line 10)
Methods
-
<static> disable(context)
-
Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. By default browsers have image smoothing enabled, which isn't always what you visually want, especially when using pixel art in a game. Note that this sets the property on the context itself, so that any image drawn to the context will be affected. This sets the property across all current browsers but support is patchy on earlier browsers, especially on mobile.
Parameters:
Name Type Description contextCanvasRenderingContext2D | WebGLRenderingContext The context on which to disable smoothing.
- Since: 3.0.0
- Source: src/display/canvas/Smoothing.js (Line 72)
Returns:
The provided context.
- Type
- CanvasRenderingContext2D | WebGLRenderingContext
-
<static> enable(context)
-
Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. By default browsers have image smoothing enabled, which isn't always what you visually want, especially when using pixel art in a game. Note that this sets the property on the context itself, so that any image drawn to the context will be affected. This sets the property across all current browsers but support is patchy on earlier browsers, especially on mobile.
Parameters:
Name Type Description contextCanvasRenderingContext2D | WebGLRenderingContext The context on which to enable smoothing.
- Since: 3.0.0
- Source: src/display/canvas/Smoothing.js (Line 43)
Returns:
The provided context.
- Type
- CanvasRenderingContext2D | WebGLRenderingContext
-
<static> getPrefix(context)
-
Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set.
Parameters:
Name Type Description contextCanvasRenderingContext2D | WebGLRenderingContext The canvas context to check.
- Since: 3.0.0
- Source: src/display/canvas/Smoothing.js (Line 16)
Returns:
The name of the property on the context which controls image smoothing (either
imageSmoothingEnabledor a vendor-prefixed version thereof), ornullif not supported.- Type
- string
-
<static> isEnabled(context)
-
Returns
trueif the given context has image smoothing enabled, otherwise returnsfalse. Returns null if no smoothing prefix is available.Parameters:
Name Type Description contextCanvasRenderingContext2D | WebGLRenderingContext The context to check.
- Since: 3.0.0
- Source: src/display/canvas/Smoothing.js (Line 101)
Returns:
trueif smoothing is enabled on the context, otherwisefalse.nullif not supported.- Type
- boolean
