Documentation of 'edu.rit.image.ColorImageRow' Java class
ColorImageRow
edu.rit.image

Class ColorImageRow



  • public class ColorImageRow
    extends java.lang.Object
    Class ColorImageRow provides one row of a color image. The image row is layered on top of an integer array (type int[]). Use the setArray() method to specify which array this is. The width of the image row is equal to the number of elements in the underlying array. The image row's underlying array usually is (but does not have to be) one row of an image's underlying matrix.

    To read and write the pixels of an image row, use the getPixel(), getPixelColor(), setPixel(), setPixelColor(), and setPixelHSB() methods.

    Changing the contents of the underlying array directly will also change the image. The color information is stored in an array element as follows:

    • Bits 31 .. 24 -- Unused, must be 0
    • Bits 23 .. 16 -- Red component in the range 0 .. 255
    • Bits 15 .. 8 -- Green component in the range 0 .. 255
    • Bits 7 .. 0 -- Blue component in the range 0 .. 255

    HSB Colors. A color may be specified using hue, saturation, and brightness components instead of red, green, and blue components.

    The hue component gives the basic color. A hue of 0 = red; 1/6 = yellow; 2/6 = green; 3/6 = cyan; 4/6 = blue; 5/6 = magenta; 1 = red again. Intermediate hue values yield intermediate colors.

    The saturation component specifies how gray or colored the color is. A saturation of 0 yields fully gray; a saturation of 1 yields fully colored. Intermediate saturation values yield mixtures of gray and colored.

    The brightness component specifies how dark or light the color is. A brightness of 0 yields fully dark (black); a brightness of 1 yields fully light (somewhere between white and colored depending on the saturation). Intermediate brightness values yield somewhere between a gray shade and a darkened color (depending on the saturation).

    • Constructor Summary

      Constructors 
      Constructor and Description
      ColorImageRow(int[] theArray)
      Construct a new color image row on top of the given array.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void fill(java.awt.Color color)
      Set all pixels in this image row to the given color.
      void fill(float red, float green, float blue)
      Set all pixels in this image row to the given color.
      void fill(HSB color)
      Set all pixels in this image row to the given color.
      void fill(int red, int green, int blue)
      Set all pixels in this image row to the given color.
      void fill(IntRGB color)
      Set all pixels in this image row to the given color.
      void fill(RGB color)
      Set all pixels in this image row to the given color.
      void fillHSB(float hue, float sat, float bri)
      Set all pixels in this image row to the given color.
      int[] getArray()
      Obtain this image row's underlying array.
      void getPixel(int c, HSB color)
      Obtain the pixel at the given column in this image row.
      void getPixel(int c, IntRGB color)
      Obtain the pixel at the given column in this image row.
      void getPixel(int c, RGB color)
      Obtain the pixel at the given column in this image row.
      java.awt.Color getPixelColor(int c)
      Obtain the pixel at the given column in this image row.
      void setArray(int[] theArray)
      Set this image row's underlying array.
      void setPixel(int c, float red, float green, float blue)
      Set the pixel at the given column in this image row.
      void setPixel(int c, HSB color)
      Set the pixel at the given column in this image row.
      void setPixel(int c, int red, int green, int blue)
      Set the pixel at the given column in this image row.
      void setPixel(int c, IntRGB color)
      Set the pixel at the given column in this image row.
      void setPixel(int c, RGB color)
      Set the pixel at the given column in this image row.
      void setPixelColor(int c, java.awt.Color color)
      Set the pixel at the given column in this image row.
      void setPixelHSB(int c, float hue, float sat, float bri)
      Set the pixel at the given column in this image row.
      • Methods inherited from class java.lang.Object

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

      • ColorImageRow

        public ColorImageRow(int[] theArray)
        Construct a new color image row on top of the given array.
        Parameters:
        theArray - Underlying array.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theArray is null.
    • Method Detail

      • getArray

        public int[] getArray()
        Obtain this image row's underlying array.
        Returns:
        Underlying array.
      • setArray

        public void setArray(int[] theArray)
        Set this image row's underlying array.
        Parameters:
        theArray - Underlying array.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theArray is null.
      • getPixel

        public void getPixel(int c,
                             RGB color)
        Obtain the pixel at the given column in this image row.
        Parameters:
        c - Column index.
        color - Floating point RGB color object in which to store the pixel's color components.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • getPixel

        public void getPixel(int c,
                             IntRGB color)
        Obtain the pixel at the given column in this image row.
        Parameters:
        c - Column index.
        color - Integer RGB color object in which to store the pixel's color components.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • getPixel

        public void getPixel(int c,
                             HSB color)
        Obtain the pixel at the given column in this image row.
        Parameters:
        c - Column index.
        color - Floating point HSB color object in which to store the pixel's color components.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • getPixelColor

        public java.awt.Color getPixelColor(int c)
        Obtain the pixel at the given column in this image row.
        Parameters:
        c - Column index.
        Returns:
        AWT Color of pixel.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • setPixel

        public void setPixel(int c,
                             RGB color)
        Set the pixel at the given column in this image row. If any component of color is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        c - Column index.
        color - Floating point RGB color object containing the pixel's color components.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • setPixel

        public void setPixel(int c,
                             IntRGB color)
        Set the pixel at the given column in this image row. If any component of color is outside the range 0 .. 255, it is pinned to the appropriate boundary.
        Parameters:
        c - Column index.
        color - Integer RGB color object containing the pixel's color components.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • setPixel

        public void setPixel(int c,
                             HSB color)
        Set the pixel at the given column in this image row. If any component of color is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        c - Column index.
        color - Floating point HSB color object containing the pixel's color components.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • setPixelColor

        public void setPixelColor(int c,
                                  java.awt.Color color)
        Set the pixel at the given column in this image row.
        Parameters:
        c - Column index.
        color - The pixel's AWT color.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • setPixel

        public void setPixel(int c,
                             float red,
                             float green,
                             float blue)
        Set the pixel at the given column in this image row. If any value red, green, or blue is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        c - Column index in the range matrix().colRange().
        red - Pixel's red component.
        green - Pixel's green component.
        blue - Pixel's blue component.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • setPixel

        public void setPixel(int c,
                             int red,
                             int green,
                             int blue)
        Set the pixel at the given column in this image row. If any value red, green, or blue is outside the range 0 .. 255, it is pinned to the appropriate boundary.
        Parameters:
        c - Column index in the range matrix().colRange().
        red - Pixel's red component.
        green - Pixel's green component.
        blue - Pixel's blue component.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • setPixelHSB

        public void setPixelHSB(int c,
                                float hue,
                                float sat,
                                float bri)
        Set the pixel at the given column in this image row. If any value hue, sat, or bri is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        c - Column index in the range matrix().colRange().
        hue - Pixel's hue component.
        sat - Pixel's saturation component.
        bri - Pixel's brightness component.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified.
        java.lang.ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if c is out of bounds.
      • fill

        public void fill(RGB color)
        Set all pixels in this image row to the given color. If any component of color is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        color - Floating point RGB color object containing the pixel's color components.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
      • fill

        public void fill(IntRGB color)
        Set all pixels in this image row to the given color. If any component of color is outside the range 0 .. 255, it is pinned to the appropriate boundary.
        Parameters:
        color - Integer RGB color object containing the pixel's color components.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
      • fill

        public void fill(HSB color)
        Set all pixels in this image row to the given color. If any component of color is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        color - Floating point HSB color object containing the pixel's color components.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
      • fill

        public void fill(java.awt.Color color)
        Set all pixels in this image row to the given color.
        Parameters:
        color - The pixel's AWT color.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified. Thrown if color is null.
      • fill

        public void fill(float red,
                         float green,
                         float blue)
        Set all pixels in this image row to the given color. If any value red, green, or blue is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        red - Pixel's red component.
        green - Pixel's green component.
        blue - Pixel's blue component.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified.
      • fill

        public void fill(int red,
                         int green,
                         int blue)
        Set all pixels in this image row to the given color. If any value red, green, or blue is outside the range 0 .. 255, it is pinned to the appropriate boundary.
        Parameters:
        red - Pixel's red component.
        green - Pixel's green component.
        blue - Pixel's blue component.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified.
      • fillHSB

        public void fillHSB(float hue,
                            float sat,
                            float bri)
        Set all pixels in this image row to the given color. If any value hue, sat, or bri is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        hue - Pixel's hue component.
        sat - Pixel's saturation component.
        bri - Pixel's brightness component.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.