Class Renderer

a base renderer object

Hierarchy (view full)

Constructors

constructor

Properties

backgroundColor

backgroundColor: Color

The background color used to clear the main framebuffer. Note: alpha value will be set based on the transparent property of the renderer settings.

Default

black

currentColor

currentColor: Color

currentTint

currentTint: Color

depthTest

depthTest: string

the default method to sort object ("sorting", "z-buffer")

Default

"sorting"

designRatio

designRatio: number

the requested video size ratio

isContextValid

isContextValid: boolean

true if the current rendering context is valid

Default

true

path2D

path2D: Path2D

The Path2D instance used by the renderer to draw primitives

projectionMatrix

projectionMatrix: Matrix3d

renderTarget

renderTarget: CanvasRenderTarget

The renderer renderTarget

Name

renderTarget

scaleRatio

scaleRatio: Vector2d

the scaling ratio to be applied to the main canvas

Default

<1,1>

settings

settings: object

The given constructor options

type

type: string

The renderer type : Canvas, WebGL, etc... (override this property with a specific value when implementing a custom renderer)

uvOffset

uvOffset: number

Accessors

height

width

Methods

clear

clearMask

clearTint

fill

flush

getBlendMode

getCanvas

getColor

getContext

globalAlpha

overlaps

reset

resize

setAntiAlias

  • setAntiAlias(enable?): void
  • enable/disable image smoothing (scaling interpolation) for the current render target

    Parameters

    • Optionalenable: boolean = false

    Returns void

setMask

  • setMask(): void
  • A mask limits rendering elements to the shape and position of the given mask object. So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible. Mask are not preserved through renderer context save and restore.

    Returns void

setProjection

setTint

  • setTint(tint, alpha?): void
  • set a coloring tint for sprite based renderables

    Parameters

    • tint: Color

      the tint color

    • Optionalalpha: number = tint.alpha

      an alpha value to be applied to the tint

    Returns void

stroke

tint

toBlob

  • toBlob(type?, quality?): Promise<any>
  • creates a Blob object representing the last rendered frame

    Parameters

    • Optionaltype: string = "image/png"

      A string indicating the image format

    • Optionalquality: number

      A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.

    Returns Promise<any>

    A Promise returning a Blob object representing the last rendered frame

    Example

    renderer.convertToBlob().then((blob) =>console.log(blob));
    

toDataURL

  • toDataURL(type?, quality?): Promise<any>
  • returns a data URL containing a representation of the last frame rendered

    Parameters

    • Optionaltype: string = "image/png"

      A string indicating the image format

    • Optionalquality: number

      A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.

    Returns Promise<any>

    A Promise returning a string containing the requested data URL.

    Example

    renderer.toDataURL().then((dataURL) =>console.log(dataURL));
    

toImageBitmap

  • toImageBitmap(type?, quality?): Promise<any>
  • creates an ImageBitmap object of the last frame rendered (not supported by standard Canvas)

    Parameters

    • Optionaltype: string = "image/png"

      A string indicating the image format

    • Optionalquality: number

      A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.

    Returns Promise<any>

    A Promise returning an ImageBitmap.

    Example

    renderer.transferToImageBitmap().then((image) =>console.log(image));
    

Settings

Member Visibility

On This Page

AltStyle によって変換されたページ (->オリジナル) /