Class ColorRGB

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    ColorRGBA

    public class ColorRGB
    extends Object
    implements Serializable
    A color with red, green and blue color components.

    It exists mainly to avoid AWT references to Color.

    Author:
    Curtis Rueden, Lee Kamentsky, Barry DeZonia
    See Also:
    Serialized Form
    • Constructor Detail

      • ColorRGB

        public ColorRGB​(int red,
                        int green,
                        int blue)
      • ColorRGB

        public ColorRGB​(String s)
        Parses a color from the given string. The following formats are supported:
        1. HTML color codes starting with hash (#), as handled by fromHTMLColor(String).
        2. Color presets, as handled by Colors.getColor(String).
        3. Integer triples of the form r,g,b, with each element in the range [0, 255].
    • Method Detail

      • getRed

        public int getRed()
      • getGreen

        public int getGreen()
      • getBlue

        public int getBlue()
      • getAlpha

        public int getAlpha()
      • getARGB

        public int getARGB()
        Gets the color as a packed integer, 8 bits per color component. HSB is alpha, next is red, then green, and finally blue is LSB.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • fromHSVColor

        public static ColorRGB fromHSVColor​(double h,
                                            double s,
                                            double v)