- Source: src/renderer/canvas/index.js (Line 7)
Classes
Methods
-
<static> GetBlendModes()
-
Returns an array which maps the default blend modes to supported Canvas blend modes.
If the browser doesn't support a blend mode, it will default to the normal
source-overblend mode.- Since: 3.0.0
- Source: src/renderer/canvas/utils/GetBlendModes.js (Line 10)
Returns:
Which Canvas blend mode corresponds to which default Phaser blend mode.
- Type
- array
-
<static> SetTransform(renderer, ctx, src, camera [, parentMatrix])
-
Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix and then performs the following steps:
- Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts.
- Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given.
- Sets the blend mode of the context to be that used by the Game Object.
- Sets the alpha value of the context to be that used by the Game Object combined with the Camera.
- Saves the context state.
- Sets the final matrix values into the context via setTransform.
- If Renderer.antialias, or the frame.source.scaleMode is set, then imageSmoothingEnabled is set.
This function is only meant to be used internally. Most of the Canvas Renderer classes use it.
Parameters:
Name Type Argument Description rendererPhaser.Renderer.Canvas.CanvasRenderer A reference to the current active Canvas renderer.
ctxCanvasRenderingContext2D The canvas context to set the transform on.
srcPhaser.GameObjects.GameObject The Game Object being rendered. Can be any type that extends the base class.
cameraPhaser.Cameras.Scene2D.Camera The Camera that is rendering the Game Object.
parentMatrixPhaser.GameObjects.Components.TransformMatrix <optional>
A parent transform matrix to apply to the Game Object before rendering.
- Since: 3.12.0
- Source: src/renderer/canvas/utils/SetTransform.js (Line 9)
Returns:
trueif the Game Object context was set, otherwisefalse.- Type
- boolean
