Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • new Surface(fileName: string): Surface
  • new Surface(width: number, height: number, content?: Color | ArrayBuffer): Surface
  • Construct a new surface from the contents of an image file. Not supported in Oozaru; prefer Surface.fromFile in new code.

    deprecated

    Parameters

    • fileName: string

      SphereFS path to an image file.

    Returns Surface

  • Construct a new surface of a given size and initial contents.

    Parameters

    • width: number

      The width of the new texture, in pixels.

    • height: number

      The height of the new texture, in pixels.

    • Optional content: Color | ArrayBuffer

      Either a Color to fill the texture with or a buffer of RGBA pixels.

    Returns Surface

Properties

blendOp

blendOp: BlendOp

Blending operation to use when rendering to this surface.

fileName

fileName: string | null

The SphereFS path of the image file used to create the texture, or null for non-file-based textures.

height

height: number

Height of the surface, in pixels.

transform

transform: Transform

Transform to use when rendering to this surface. Must include a projection.

width

width: number

Width of the surface, in pixels.

Static Screen

Screen: Surface

A surface representing the backbuffer. The contents of Surface.Screen are presented to the screen at the end of every frame's Render phase.

Methods

clipTo

  • clipTo(x: number, y: number, width: number, height: number): void
  • Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns void

download

  • download(): Uint8ClampedArray

toTexture

upload

  • upload(data: ArrayBuffer | ArrayBufferView): void
  • Upload new RGBA pixel data to this texture.

    Parameters

    • data: ArrayBuffer | ArrayBufferView

      A buffer with the new RGBA pixel values.

    Returns void

Static fromFile

  • fromFile(fileName: string): Promise<Surface>
  • Create a new surface initialized from the contents of an image file. The image is loaded in the background; the promise resolves once the surface is ready for use.

    Parameters

    • fileName: string

    Returns Promise<Surface>

    A promise for the new surface.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc