Canvas Path

From FlightGear wiki
Jump to: navigation, search

Properties

Additionally to the properties supported by every Canvas Element, Canvas Paths support the following properties:

fill

  • Format: "none" | <color> (#rrggbb, rbg(r,g,b), rgba(r,g,b,a) [r,g,b -> 0-255; a -> 0.0-1.0])
  • Default: "none" (do not fill path)

Color to fill the path.

fill-opacity

  • Format: <number> (any real number between 0.0 and 1.0)
  • Default: 1.0 (not transparent)

Factor to multiply the alpha channel of the fill color.

fill-rule

  • Format: "pseudo-nonzero" | "evenodd"
  • Default: "evenodd"

stroke

  • Format: "none" | <color> (#rrggbb, rbg(r,g,b), rgba(r,g,b,a) [r,g,b -> 0-255; a -> 0.0-1.0])
  • Default: "none" (do not draw path)

Color to draw the path.

stroke-opacity

  • Format: <number> (any real number between 0.0 and 1.0)
  • Default: 1.0 (not transparent)

Factor to multiply the alpha channel of the stroke color.

stroke-width

  • Format: <number> (any real number)
  • Default: 1.0

Specify the width (in pixels) of the stroke used to draw the path.

# 5 pixel wide, red stroke
path.set("stroke", "red")
    .set("stroke-width", 5);

stroke-dasharray

Line stipple (see SVG stroke-dasharray)

stroke-linecap

  • Format: "round" | "square" | "butt"
  • Default: "butt"

Line end (see SVG stroke-linecap)

stroke-linejoin

  • Format: "round" | "bevel" | "miter"
  • Default: "miter"

Line corner (see SVG stroke-linejoin)