Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SolidFill

Class for specifying fillstyle with a single, solid Color.

Instances of SolidFill are immutable, meaning that its setters don't modify the object, but instead return a completely new modified object.

Index

Constructors

constructor

  • Create a new SolidFill to fill the object with a single solid Color.

    Example:

    // create fillstyle from RGBA
    const solidfill = new SolidFill({
     // A (alpha) is optional - 255 by default
     color: ColorRGBA(255, 0, 0)
    })
    
    // create fillstyle from HEX string
    const solidfill = new SolidFill({
     color: ColorHEX('#F00')
    })
    
    // create fillstyle from HSV
    const solidfill = new SolidFill({
     color: ColorHSV(0, 1, 0.49)
    })

    Parameters

    Returns SolidFill

Methods

getColor

  • Get color of SolidFill.

    Returns Color

    Color object

getDefaultHighlightStyle

  • getDefaultHighlightStyle(): this

setA

  • Construct a new SolidFill object based on this one, but with a modified Alpha value.

    Parameters

    • alpha: number

      Value of Alpha channel [0-255]

    Returns SolidFill

    New SolidFill object

setB

  • Construct a new SolidFill object based on this one, but with a modified Blue value.

    Parameters

    • blue: number

      Value of Blue channel [0-255]

    Returns SolidFill

    New SolidFill object

setColor

  • Construct a new SolidFill object based on this one, but with modified color.

    Example:

    // specify new color
    solidfill.setColor( ColorHEX('#F00') )
    
    // change individual color properties
    solidfill.setColor( color => color.setA(80) )

    Parameters

    • value: Color | ImmutableMutator<Color>

      Either a Color object or a function, which will be used to create a new Color based on current value.

    Returns this

    New SolidFill object

setG

  • Construct a new SolidFill object based on this one, but with a modified Green value.

    Parameters

    • green: number

      Value of Green channel [0-255]

    Returns SolidFill

    New SolidFill object

setR

  • Construct a new SolidFill object based on this one, but with a modified Red value.

    Parameters

    • red: number

    Returns SolidFill

    New SolidFill object

Static Record

  • Record(defaultValues: TProps, name?: undefined | string): Factory<TProps>
  • Unlike other types in Immutable.js, the Record() function creates a new Record Factory, which is a function that creates Record instances.

    See above for examples of using Record().

    Note: Record is a factory function and not a class, and does not use the new keyword during construction.

    Type parameters

    • TProps

    Parameters

    • defaultValues: TProps
    • Optional name: undefined | string

    Returns Factory<TProps>