Rac. Fill

Fill color for drawing.

Can be used as fill.apply() to apply the fill settings globally, or as the parameter of drawable.draw(fill) to apply the fill only for that call.

When color is null a no-fill setting is applied.

instance.Fill

Instances of Rac contain a convenience rac.Fill function to create Fill objects with fewer parameters. This function also contains ready-made convenience objects, like rac.Fill.none, listed under instance.Fill.

Example
let rac = new Rac()
let color = rac.Color(0.2, 0.4, 0.6)
// new instance with constructor
let fill = new Rac.Fill(rac, color)
// or convenience function
let otherFill = rac.Fill(color)
See also:

Constructor

new Fill(rac, colornullable)

Creates a new Fill instance.

Parameters:
Name Type Attributes Description
rac Rac

Instance to use for drawing and creating other objects

color Rac.Color <nullable>

A Color for the fill setting, or null to apply a no-fill setting

Members

rac :Rac

Instance of Rac used for drawing and passed along to any created object.

Methods

(static) from(rac, something) → {Rac.Fill}

Returns a Fill derived from something.

  • When something is an instance of Fill, returns that same object.
  • When something is an instance of Color, returns a new Fill using something as color.
  • When something is an instance of Stroke, returns a new Fill using stroke.color.
  • Otherwise an error is thrown.
Parameters:
Name Type Description
rac Rac

Instance to pass along to newly created objects

something Rac.Fill | Rac.Color | Rac.Stroke

An object to derive a Fill from

appendStroke(someStroke) → {Rac.StyleContainer}

Returns a new StyleContainer containing this and the Stroke derived from someStroke.

See also:
Parameters:
Name Type Description
someStroke Rac.Stroke | Rac.Color | Rac.Fill

An object to derive a Stroke from

appendStyle(style) → {Rac.StyleContainer|Rac.Fill}

Returns a new StyleContainer containing this and style. When style is null, returns this instead.

Parameters:
Name Type Description
style Rac.Stroke | Rac.Fill | Rac.StyleContainer

A style object to contain along this

container() → {Rac.StyleContainer}

Returns a new StyleContainer containing only this.