Skip to main content
Version: Phaser v4.0.0

TransformerImage

A RenderNode that computes and stores the screen-space quad vertex positions for a single Image-like GameObject each time it is rendered.

During its run call, this node combines the camera view matrix (adjusted for the game object's scroll factors), any parent container matrix, and the game object's own position, rotation, and scale into a single final transform matrix. It then projects the four corners of the game object's frame through that matrix and writes the resulting eight coordinate values (four x/y pairs) into the quad Float32Array, ready for consumption by the subsequent submitter node.

Horizontal and vertical flipping are handled here, with the local origin offset adjusted automatically when the frame does not use a custom pivot. Vertex rounding is also applied when required by the game object or camera settings, snapping all quad corners to integer pixel coordinates to avoid sub-pixel rendering artefacts.

Constructor

new TransformerImage(manager, [config])

Parameters

nametypeoptionaldescription
managerPhaser.Renderer.WebGL.RenderNodes.RenderNodeManagerNoThe manager that owns this RenderNode.
configobjectYesThe configuration object for this RenderNode.

Scope: static

Extends

Phaser.Renderer.WebGL.RenderNodes.RenderNode

Source: src/renderer/webgl/renderNodes/transformer/TransformerImage.js#L12
Since: 4.0.0

Inherited Members

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Public Members

quad

quad: Float32Array

Description:

A flat array of 8 floats storing the screen-space positions of the four corners of the rendered quad, written during each run call. Values are ordered as [x0, y0, x1, y1, x2, y2, x3, y3], representing the top-left, top-right, bottom-left, and bottom-right corners respectively.

Source: src/renderer/webgl/renderNodes/transformer/TransformerImage.js#L48
Since: 4.0.0


Inherited Methods

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Public Methods

run

<instance> run(drawingContext, gameObject, texturerNode, [parentMatrix], [element])

Description:

Computes the final screen-space quad vertex positions for the given Image-like GameObject and stores them in this.quad.

The method builds the complete transform by combining the camera view matrix (modified by the game object's scroll factors), an optional parent container matrix, and the game object's own position, rotation, and scale. Horizontal and vertical flips are factored in by negating the relevant scale axis and, when the frame does not use a custom pivot, by adjusting the local origin offset so the image flips around its display origin. The resulting four corner positions are then projected through the matrix via setQuad and written into this.quad. If vertex rounding is required, all eight values are snapped to the nearest integer before the node exits.

Parameters:

nametypeoptionaldescription
drawingContextPhaser.Renderer.WebGL.DrawingContextNoThe current drawing context.
gameObjectPhaser.GameObjects.GameObjectNoThe GameObject being rendered.
texturerNodePhaser.Renderer.WebGL.RenderNodes.RenderNodeNoThe texturer node used to texture the GameObject. This contains relevant data on the dimensions of the object.
parentMatrixPhaser.GameObjects.Components.TransformMatrixYesThis transform matrix is defined if the game object is nested.
elementobjectYesThe specific element within the game object. This is used for objects that consist of multiple quads. It is unused here.

Overrides: Phaser.Renderer.WebGL.RenderNodes.RenderNode#run

Source: src/renderer/webgl/renderNodes/transformer/TransformerImage.js#L86
Since: 4.0.0