Creates a new Rapid application instance.
Initialization options including the target canvas.
Default texture filtering preference and requested canvas MSAA setting.
Background clear color [r, g, b, a], values range from 0 to 255.
The target HTMLCanvasElement.
The currently active rendering region.
The current device pixel ratio.
Counts the number of WebGL draw calls made in the current frame.
The active WebGL context.
Region dedicated to arbitrary geometry and shapes rendering.
Indicates whether we are currently writing to the stencil buffer to create a mask.
Logical height in CSS pixels, used for coordinate system and projection matrix.
Logical width in CSS pixels, used for coordinate system and projection matrix.
Direct access to the underlying matrix store.
Matrix stack for hierarchical transformations.
Maximum number of texture units supported by the device.
Physical height (canvas actual pixels = logical height * dpr).
Physical width (canvas actual pixels = logical width * dpr).
Whether textures use premultiplied alpha. Set once at construction.
The current orthographic projection matrix (16 elements).
Indicates if the projection matrix has changed and needs to be uploaded to shaders.
OptionalscaleRegion dedicated to fast sprite rendering.
Manager for creating and organizing textures.
Default filtering mode used when sampling textures.
Pushes vertices for a circle geometry using TRIANGLES or similar primitives.
The radius of the circle.
Optionalcolor: ColorAn optional tint color.
The number of segments (polygons) used to approximate the circle.
Adds an individual vertex to the current graphics batch.
The relative X coordinate of the vertex.
The relative Y coordinate of the vertex.
The U texture coordinate (0 to 1).
The V texture coordinate (0 to 1).
The vertex color as a 32-bit unsigned integer.
Pushes vertices for a rectangle geometry. Should be enclosed by startGraphic and endGraphic.
The width of the rectangle.
The height of the rectangle.
Optionalcolor: ColorAn optional tint color.
Applies a chain of shaders to a texture sequentially using ping-pong RenderTextures. Each shader receives the output of the previous one as its input. Two internal RenderTextures are reused across calls (resized as needed).
The input texture to start the filter chain from.
An ordered array of CustomGlShader to apply in sequence.
The RenderTexture containing the final filtered result.
Draw it with rapid.drawSprite({ texture: result }) to display it on screen.
Clears the active framebuffer applying the default background color.
Clears bounds created into the stencil mask.
The bitmask specifying which stencil layer to clear.
Clears a RenderTexture to a solid color. Must be called while the RT is the active render target (i.e. inside enterRenderTexture/leaveRenderTexture). Can also be called standalone — it will bind the RT, clear it, but NOT restore the main framebuffer.
Clear color. Defaults to transparent black (0, 0, 0, 0).
Utility method: Draws an image directly as a mask using a generic rectangle geometry.
Convenience wrapper: enters a RenderTexture, optionally clears it, runs a callback, then leaves.
The RenderTexture to render into.
The callback containing draw calls to execute inside the RT.
Clear color before rendering. Pass null to skip clearing. Defaults to transparent black.
Finishes the mask drawing phase and restores color buffer writing.
Ends the current graphics geometry definition, readying it for rendering.
Disables scissor clipping, restoring full-canvas rendering.
Enters a constrained rendering phase masked by the existing stencil buffer values.
Equality check type. Use "equal" to draw inside the mask, or "notEqual" to draw outside.
The reference value to test against.
The bitmask specifying which stencil bits to consider.
Enters a specific rendering region, flushing the previous one if necessary.
The rendering region to enter.
OptionalcustomShader: GLShader | CustomGlShaderAn optional custom shader to use for this region.
Exits the masked rendering phase, restoring default full-screen stencil values tests.
Flushes currently buffered rendering operations across all active regions.
Optionalcolor: ColorCompletes rendering to an offscreen render texture and reverts rendering back to the main canvas.
Resizes the canvas, updates internal viewport values, and recreates projection boundaries.
The new logical display width.
The new logical display height.
OptionalcssWidth: numberOptional CSS display width.
OptionalcssHeight: numberOptional CSS display height.
Configures the global WebGL blending behavior.
The targeted BlendMode to switch onto.
Starts drawing into the stencil buffer to construct a rendering mask.
The stencil reference value.
The stencil bitmask.
Starts rendering arbitrary graphics geometries.
The WebGL drawing mode (e.g., gl.TRIANGLES, gl.TRIANGLE_FAN).
Optionaltexture: TextureAn optional texture applied to the graphic vertices.
OptionalcustomShader: GLShader | CustomGlShaderAn optional custom shader overriding the region's default shader.
OptionalcustomMatrix: numberStarts rendering graphics explicitly for use as a mask, overriding the shader.
The WebGL drawing mode (e.g., gl.TRIANGLES).
Optionaltexture: TextureAn optional texture whose alpha channel may dictate masking rules.
OptionalcustomMatrix: numberEnables rectangular scissor clipping. Only pixels within the specified rectangle (in logical coordinates) will be rendered. Coordinates use the same system as your drawing calls (top-left origin).
Left edge in logical pixels.
Top edge in logical pixels.
Width in logical pixels.
Height in logical pixels.
Exports a world matrix as a CSS matrix(...) string, ready to assign
directly to a DOM element's style.transform.
Unlike matrixStack.toCSSMatrix(), this bakes in the logic-pixel → CSS-pixel
scale (accounting for dpr and a custom logicWidth/logicHeight), so the
result lines up with the canvas without any extra scale(...) on your end.
Optionalindex: numberMatrix index to export. Defaults to the current world matrix.
Convenience wrapper: sets a blend mode, runs a callback, then restores NORMAL blend mode.
The BlendMode to apply for the duration of the callback.
The callback to execute under the given blend mode.
Convenience wrapper: writes a mask using the stencil buffer, then renders within it, then exits the mask.
Callback that defines the mask geometry (drawn to stencil, not visible).
Callback containing the actual draw calls masked by the stencil.
Mask type: EQUAL (draw inside) or NOT_EQUAL (draw outside). Defaults to EQUAL.
Stencil reference value. Defaults to 1.
Convenience wrapper: enables scissor clipping for a region, runs a callback, then disables it.
Left edge in logical pixels.
Top edge in logical pixels.
Width in logical pixels.
Height in logical pixels.
The callback to execute within the scissor region.
Convenience wrapper: saves the matrix stack, applies an optional transform, runs a callback, then restores.
When transform is provided, delegates to matrixStack.applyTransform() which handles
position, rotation, scale, offset, and origin automatically.
The callback to execute within the saved transform context.
Optionaltransform: ITransformOptionsOptional transform options to apply before running the callback.
The logical width used to resolve origin anchoring. Defaults to 0.
The logical height used to resolve origin anchoring. Defaults to 0.
The main application class for the Rapid rendering engine. Manages the WebGL context, rendering regions, state, and matrices.