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

Class GrayImageRow



  • public class GrayImageRow
    extends java.lang.Object
    Class GrayImageRow provides one row of a grayscale image. The image row is layered on top of a byte array (type byte[]). 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 getIntPixel(), getPixel(), setIntPixel(), and setPixel() methods. These methods represent a pixel value as an integer in the range 0 .. 255 or as a floating point number in the range 0.0 .. 1.0. The image row's interpretation attribute specifies how to map between the numerical pixel value and the shade of gray. If the interpretation is ZERO_IS_WHITE, then a value of 0 or 0.0 represents white and 255 or 1.0 represents black. If the interpretation is ZERO_IS_BLACK, then a value of 0 or 0.0 represents black and 255 or 1.0 represents white. The default interpretation is ZERO_IS_BLACK. To change the interpretation, call the setInterpretation() method.

    Changing the contents of the underlying matrix directly will also change the image row. In the underlying matrix, a value of 0 represents black and a value of 255 represents white.

    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void fill(float val)
      Set all pixels in this image row to the given value.
      void fill(int val)
      Set all pixels in this image row to the given value.
      byte[] getArray()
      Obtain this image row's underlying array.
      PJGGrayImage.Interpretation getInterpretation()
      Get this image row's interpretation.
      int getIntPixel(int c)
      Obtain the pixel at the given column in this image row.
      float getPixel(int c)
      Obtain the pixel at the given column in this image row.
      void setArray(byte[] theArray)
      Set this image row's underlying array.
      void setInterpretation(PJGGrayImage.Interpretation theInterpretation)
      Set this image row's interpretation.
      void setIntPixel(int c, int val)
      Set the pixel at the given column in this image row.
      void setPixel(int c, float val)
      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

      • GrayImageRow

        public GrayImageRow(byte[] theArray)
        Construct a new grayscale image row on top of the given array. The image row's interpretation is ZERO_IS_BLACK.
        Parameters:
        theArray - Underlying array.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theArray is null.
    • Method Detail

      • getArray

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

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

        public int getIntPixel(int c)
        Obtain the pixel at the given column in this image row.
        Parameters:
        c - Column index.
        Returns:
        Pixel[c] as an integer in the range 0 .. 255.
        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.
      • getPixel

        public float getPixel(int c)
        Obtain the pixel at the given column in this image row.
        Parameters:
        c - Column index.
        Returns:
        Pixel[c] as a floating point number in the range 0.0 .. 1.0.
        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.
      • setIntPixel

        public void setIntPixel(int c,
                                int val)
        Set the pixel at the given column in this image row. If val is outside the range 0 .. 255, it is pinned to the appropriate boundary.
        Parameters:
        c - Column index.
        val - New pixel value as an integer in the range 0 .. 255.
        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,
                             float val)
        Set the pixel at the given column in this image row. If val is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        c - Column index.
        val - New pixel value as a floating point number in the range 0.0 .. 1.0.
        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(int val)
        Set all pixels in this image row to the given value. If val is outside the range 0 .. 255, it is pinned to the appropriate boundary.
        Parameters:
        val - New pixel value as an integer in the range 0 .. 255.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if the underlying matrix row has not been specified.
      • fill

        public void fill(float val)
        Set all pixels in this image row to the given value. If val is outside the range 0.0 .. 1.0, it is pinned to the appropriate boundary.
        Parameters:
        val - New pixel value as a floating point number in the range 0.0 .. 1.0.
        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.