Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • ExcaliburGraphicsContext

Implemented by

Index

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

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

  • beginDrawLifecycle(): void
  • clear(): void
  • clearPostProcessors(): void
  • drawCircle(pos: Vector, radius: number, color: Color, stroke?: Color, thickness?: number): void
  • drawImage(image: HTMLImageSource, x: number, y: number): void
  • drawImage(image: HTMLImageSource, x: number, y: number, width: number, height: number): void
  • drawImage(image: HTMLImageSource, sx: number, sy: number, swidth?: number, sheight?: number, dx?: number, dy?: number, dwidth?: number, dheight?: number): void
  • drawRectangle(pos: Vector, width: number, height: number, color: Color, stroke?: Color, strokeThickness?: number): void
  • endDrawLifecycle(): void
  • flush(): void
  • resetTransform(): void
  • restore(): void
  • rotate(angle: number): void
  • save(): void
  • scale(x: number, y: number): void
  • translate(x: number, y: number): void