Class WeighedColor

  • All Implemented Interfaces:
    Serializable, CharSequence

    public final class WeighedColor
    extends Object
    A weighted color, used in color lists for gradients etc.
     green;0.33
     
    Since:
    8.2.0
    Author:
    XIMA MEDIA GmbH
    See Also:
    Serialized Form
    • Constructor Detail

      • WeighedColor

        public WeighedColor​(Color color,
                            Double weight)
        Creates a new weighted color with the given weight.
        Parameters:
        color - Color to use.
        weight - Weight of the color may be null for no weight.
    • Method Detail

      • getColor

        public Color getColor()
        Returns:
        The color being weighted.
      • getWeight

        public OptionalDouble getWeight()
        Returns:
        The weight of the color.
      • unweighed

        public static WeighedColor unweighed​(Color color)
        Creates new color with no weight.
        Parameters:
        color - Color to use.
        Returns:
        A new color with no weight.
      • weighed

        public static WeighedColor weighed​(Color color,
                                           double weight)
        Creates new color with the given weight.
        Parameters:
        color - Color to use.
        weight - Weight to use.
        Returns:
        A new weighted color.
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • charAt

        public default char charAt​(int index)
        Specified by:
        charAt in interface CharSequence