Class HSBType

    • Constructor Detail

      • HSBType

        public HSBType()
      • HSBType

        public HSBType​(DecimalType h,
                       PercentType s,
                       PercentType b)
        Constructs a HSBType instance with the given values
        Parameters:
        h - the hue value in the range from 0 <= h < 360
        s - the saturation as a percent value
        b - the brightness as a percent value
      • HSBType

        public HSBType​(String value)
        Constructs a HSBType instance from a given string. The string has to be in comma-separated format with exactly three segments, which correspond to the hue, saturation and brightness values. where the hue value in the range from 0 <= h < 360 and the saturation and brightness are percent values.
        Parameters:
        value - a stringified HSBType value in the format "hue,saturation,brightness"
    • Method Detail

      • fromRGB

        public static HSBType fromRGB​(int r,
                                      int g,
                                      int b)
        Create HSB from RGB
        Parameters:
        r - red 0-255
        g - green 0-255
        b - blue 0-255
      • fromXY

        public static HSBType fromXY​(float x,
                                     float y)
        Returns a HSBType object representing the provided xy color values in CIE XY color model. Conversion from CIE XY color model to sRGB using D65 reference white Returned color is set to full brightness
        Parameters:
        x - , y color information 0.0 - 1.0
        Returns:
        new HSBType object representing the given CIE XY color, full brightness
      • getRGB

        public int getRGB()
        Returns the RGB value representing the color in the default sRGB color model. (Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue).
        Returns:
        the RGB value of the color in the default sRGB color model
      • toFullString

        public String toFullString()
        Description copied from interface: Type
        Get a string representation that contains the whole internal representation of the type.

        The returned string could be consumed by the static 'valueOf(String)' method of the respective type to build a new type that is equal to this type.

        Specified by:
        toFullString in interface Type
        Overrides:
        toFullString in class DecimalType
        Returns:
        a full string representation of the type to be consumed by 'valueOf(String)'
      • toXY

        public PercentType[] toXY()
        Returns the xyY values representing this object's color in CIE XY color model. Conversion from sRGB to CIE XY using D65 reference white xy pair contains color information Y represents relative luminance
        Parameters:
        HSBType - color object
        Returns:
        PercentType[x, y, Y] values in the CIE XY color model
      • as

        public <T extends State> @Nullable T as​(@Nullable Class<T> target)
        Description copied from interface: State
        Convert this State's value into another type
        Specified by:
        as in interface State
        Overrides:
        as in class PercentType
        Parameters:
        target - the desired State type
        Returns:
        the State's value in the given type's representation, or null if the conversion was not possible