Documentation of 'edu.rit.color.RGB' Java class
RGB
edu.rit.color

Class RGB



  • public class RGB
    extends java.lang.Object
    Class RGB provides a color represented as floating point red, green, and blue components.

    Class RGB includes methods for packing and unpacking a floating point RGB color object into and from an integer. The packed color representation uses 8 bits for each component, with the red component in bits 23-16, the green component in bits 15-8, and the blue component in bits 7-0.

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      float blue
      The blue component in the range 0.0 through 1.0.
      float green
      The green component in the range 0.0 through 1.0.
      float red
      The red component in the range 0.0 through 1.0.
    • Constructor Summary

      Constructors 
      Constructor and Description
      RGB()
      Construct a new floating point RGB color.
      RGB(float red, float green, float blue)
      Construct a new floating point RGB color with the given red, green, and blue components.
      RGB(int color)
      Construct a new floating point RGB color from the given packed color.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int pack()
      Pack this floating point RGB color into a packed color.
      static int pack(float red, float green, float blue)
      Pack the given red, green, and blue components into a packed color.
      void unpack(int color)
      Unpack this floating point RGB color from a packed color.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • red

        public float red
        The red component in the range 0.0 through 1.0.
      • green

        public float green
        The green component in the range 0.0 through 1.0.
      • blue

        public float blue
        The blue component in the range 0.0 through 1.0.
    • Constructor Detail

      • RGB

        public RGB()
        Construct a new floating point RGB color. The red, green, and blue components are all 0.
      • RGB

        public RGB(float red,
                   float green,
                   float blue)
        Construct a new floating point RGB color with the given red, green, and blue components.
        Parameters:
        red - Red component.
        green - Green component.
        blue - Blue component.
      • RGB

        public RGB(int color)
        Construct a new floating point RGB color from the given packed color.
        Parameters:
        color - Packed color.
    • Method Detail

      • pack

        public int pack()
        Pack this floating point RGB color into a packed color.
        Returns:
        Packed color.
      • pack

        public static int pack(float red,
                               float green,
                               float blue)
        Pack the given red, green, and blue components into a packed color.
        Parameters:
        red - Red component.
        green - Green component.
        blue - Blue component.
        Returns:
        Packed color.
      • unpack

        public void unpack(int color)
        Unpack this floating point RGB color from a packed color.
        Parameters:
        color - Packed color.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.