Skip to main content

Polygon

A polygon Graphic for drawing arbitrary polygons to the ExcaliburGraphicsContext

Polygons default to ImageFiltering.Blended

Hierarchy

Index

Constructors

constructor

Properties

publicinherited_bitmap

_bitmap: HTMLCanvasElement

publicoptionalinheritedfiltering

filtering?: ImageFiltering

readonlyinheritedid

id: number = ...

publicinheritedlineCap

lineCap: butt | round | square = 'butt'

publicinheritedopacity

opacity: number = 1

Gets or sets the opacity of the graphic, 0 is transparent, 1 is solid (opaque).

publicinheritedquality

quality: number = 1

publicinheritedshowDebug

showDebug: boolean = false

Gets or sets wether to show debug information about the graphic

publicoptionalinheritedtint

tint?: Color

publicinheritedtransform

transform: AffineMatrix = ...

Accessors

publicinheritedcolor

  • Gets or sets the fillStyle of the Raster graphic. Setting the fillStyle will cause the raster to be flagged dirty causing a re-raster on the next draw.


    Returns Color

  • Parameters

    Returns void

publicinheriteddirty

  • get dirty(): boolean
  • Gets whether the graphic is dirty, this means there are changes that haven't been re-rasterized


    Returns boolean

publicinheritedflipHorizontal

  • get flipHorizontal(): boolean
  • set flipHorizontal(value: boolean): void
  • Gets or sets the flipHorizontal, which will flip the graphic horizontally (across the y axis)


    Returns boolean

  • Parameters

    • value: boolean

    Returns void

publicinheritedflipVertical

  • get flipVertical(): boolean
  • set flipVertical(value: boolean): void
  • Gets or sets the flipVertical, which will flip the graphic vertically (across the x axis)


    Returns boolean

  • Parameters

    • value: boolean

    Returns void

publicinheritedheight

  • get height(): number
  • set height(value: number): void
  • Gets or sets the current height of the Raster graphic. Setting the height will cause the raster to be flagged dirty causing a re-raster on the next draw.

    Any padding or quality set will be factored into the height


    Returns number

  • Gets or sets the height of the graphic (always positive)


    Parameters

    • value: number

    Returns void

publicinheritedlineDash

  • get lineDash(): number[]
  • set lineDash(value: number[]): void
  • Returns number[]

  • Parameters

    • value: number[]

    Returns void

publicinheritedlineWidth

  • get lineWidth(): number
  • set lineWidth(value: number): void
  • Gets or sets the line width of the Raster graphic. Setting the lineWidth will cause the raster to be flagged dirty causing a re-raster on the next draw.


    Returns number

  • Parameters

    • value: number

    Returns void

publicinheritedlocalBounds

  • Returns the local bounds of the Raster including the padding


    Returns BoundingBox

publicminPoint

publicinheritedorigin

  • get origin(): Vector | undefined
  • set origin(value: Vector | undefined): void
  • Gets or sets the origin of the graphic, if not set the center of the graphic is the origin


    Returns Vector | undefined

  • Parameters

    Returns void

publicinheritedpadding

  • get padding(): number
  • set padding(value: number): void
  • Returns number

  • Parameters

    • value: number

    Returns void

publicpoints

publicinheritedrotation

  • get rotation(): number
  • set rotation(value: number): void
  • Gets or sets the rotation of the graphic


    Returns number

  • Parameters

    • value: number

    Returns void

publicinheritedscale

  • Gets or sets the scale of the graphic, this affects the width and


    Returns Vector

  • Parameters

    Returns void

publicinheritedsmoothing

  • get smoothing(): boolean
  • set smoothing(value: boolean): void
  • Gets or sets the smoothing (anti-aliasing of the graphic). Setting the height will cause the raster to be flagged dirty causing a re-raster on the next draw.


    Returns boolean

  • Parameters

    • value: boolean

    Returns void

publicinheritedstrokeColor

  • get strokeColor(): Color | undefined
  • set strokeColor(value: Color | undefined): void
  • Gets or sets the strokeStyle of the Raster graphic. Setting the strokeStyle will cause the raster to be flagged dirty causing a re-raster on the next draw.


    Returns Color | undefined

  • Parameters

    Returns void

publicinheritedwidth

  • get width(): number
  • set width(value: number): void
  • Gets or sets the current width of the Raster graphic. Setting the width will cause the raster to be flagged dirty causing a re-raster on the next draw.

    Any paddings or quality set will be factored into the width


    Returns number

  • Gets or sets the width of the graphic (always positive)


    Parameters

    • value: number

    Returns void

Methods

publicclone

  • Returns a new instance of the graphic that has the same properties


    Returns Polygon

publicinheritedcloneGraphicOptions

publicinheritedcloneRasterOptions

publicinheriteddraw

  • Draw the whole graphic to the context including transform


    Parameters

    Returns void

execute

  • execute(ctx: CanvasRenderingContext2D): void
  • Executes drawing implementation of the graphic, this is where the specific drawing code for the graphic should be implemented. Once rasterize() the graphic can be drawn to the ExcaliburGraphicsContext via draw(...)


    Parameters

    • ctx: CanvasRenderingContext2D

      Canvas to draw the graphic to

    Returns void

publicinheritedflagDirty

  • flagDirty(): void
  • Flags the graphic as dirty, meaning it must be re-rasterized before draw. This should be called any time the graphics state changes such that it affects the outputted drawing


    Returns void

publicinheritedisStale

  • isStale(): boolean
  • Returns boolean

publicinheritedrasterize

  • rasterize(): void
  • Rasterize the graphic to a bitmap making it usable as in excalibur. Rasterize is called automatically if the graphic is Raster.dirty on the next Graphic.draw call


    Returns void