Hierarchy

  • ExcaliburGraphicsContext

Implemented by

Properties

backgroundColor: Color

Set the background color of the graphics context, default is Color.ExcaliburBlue

debug: DebugDraw

Access the debug drawing api

height: number
opacity: number

Sets the opacity of the current Graphic being drawn, default is 1

smoothing: boolean

Enable smoothed drawing (also known as anti-aliasing), by default false

snapToPixel: boolean

Snaps all drawings to the nearest pixel truncated down, by default false

tint: Color

Sets the tint color to be multiplied by any images drawn, default is black 0xFFFFFFFF

useDrawSorting: boolean

Excalibur will automatically sort draw calls by z and priority for maximal draw performance, this can disrupt a specific desired painter order.

To force a specific draw call order, use ExcaliburGraphicsContext.z

By default useDrawSorting is true, to opt out set this to false

width: number
z: number

Set the current z context for the graphics context. Draw calls issued to the context will use this z to inform their sort order.

Note it is important to all ExcaliburGraphicsContext.save and ExcaliburGraphicsContext.restore when modifying state.

Methods

  • Draw an image to the Excalibur Graphics context at an x and y coordinate using the images width and height

    Parameters

    Returns void

  • Draw an image to the Excalibur Graphics context at an x and y coordinate with a specific width and height

    Parameters

    Returns void

  • Draw an image to the Excalibur Graphics context specifying the source image coordinates (sx, sy, swidth, sheight) and to a specific destination on the context (dx, dy, dwidth, dheight)

    Parameters

    • image: HTMLImageSource
    • sx: number
    • sy: number
    • Optional swidth: number
    • Optional sheight: number
    • Optional dx: number
    • Optional dy: number
    • Optional dwidth: number
    • Optional dheight: number

    Returns void