Class IntArrayMatrixView

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int[] m_Data
      the underlaying array.
      protected int m_Height
      the height of the matrix.
      protected int m_Width
      the width of the matrix.
    • Constructor Summary

      Constructors 
      Constructor Description
      IntArrayMatrixView​(int[] data, int width, int height)
      Initializes the matrix view.
      IntArrayMatrixView​(int width, int height)
      Initializes the matrix view with an empty array.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int get​(int position)
      Returns the value at the specified position.
      int get​(int x, int y)
      Returns the value at the specified location.
      int[] getData()
      Returns the underlying data.
      int getHeight()
      Returns the height of the matrix.
      int[] getRGBA​(int position)
      Returns the RGBA values at the specified location.
      int[] getRGBA​(int x, int y)
      Returns the RGBA values at the specified location.
      int getWidth()
      Returns the width of the matrix.
      void set​(int position, int value)
      Sets the value at the specified location.
      void set​(int x, int y, int value)
      Sets the value at the specified location.
      void setRGBA​(int position, int[] rgba)
      Sets the RGBA values at the specified location.
      void setRGBA​(int x, int y, int[] rgba)
      Sets the RGBA values at the specified location.
      int size()
      Returns the number of data points (height * width).
      BufferedImage toBufferedImage()
      Turns the matrix into an image.
      BufferedImage toBufferedImage​(int type)
      Turns the matrix into an image.
      SpreadSheet toSpreadSheet()
      Returns the content as spreadsheet.
      String toString()
      Returns a short description of the view.
    • Field Detail

      • m_Data

        protected int[] m_Data
        the underlaying array.
      • m_Width

        protected int m_Width
        the width of the matrix.
      • m_Height

        protected int m_Height
        the height of the matrix.
    • Constructor Detail

      • IntArrayMatrixView

        public IntArrayMatrixView​(int width,
                                  int height)
        Initializes the matrix view with an empty array.
        Parameters:
        width - the width of the matrix
        height - the height of the matrix
      • IntArrayMatrixView

        public IntArrayMatrixView​(int[] data,
                                  int width,
                                  int height)
        Initializes the matrix view.
        Parameters:
        data - the 1-dim array data
        width - the width of the matrix
        height - the height of the matrix
    • Method Detail

      • getData

        public int[] getData()
        Returns the underlying data.
        Returns:
        the data
      • getWidth

        public int getWidth()
        Returns the width of the matrix.
        Returns:
        the width
      • getHeight

        public int getHeight()
        Returns the height of the matrix.
        Returns:
        the height
      • size

        public int size()
        Returns the number of data points (height * width).
        Returns:
        the number of data points
      • get

        public int get​(int position)
        Returns the value at the specified position.
        Parameters:
        position - the 0-based position in the underlying array
        Returns:
        the value at the position
      • getRGBA

        public int[] getRGBA​(int position)
        Returns the RGBA values at the specified location.
        Parameters:
        position - the 0-based position in the underlying array
        Returns:
        the RGBA values at the position
      • get

        public int get​(int x,
                       int y)
        Returns the value at the specified location.
        Parameters:
        x - the 0-based column
        y - the 0-based row
        Returns:
        the value at the position
      • getRGBA

        public int[] getRGBA​(int x,
                             int y)
        Returns the RGBA values at the specified location.
        Parameters:
        x - the 0-based column
        y - the 0-based row
        Returns:
        the RGBA values at the position
      • set

        public void set​(int position,
                        int value)
        Sets the value at the specified location.
        Parameters:
        position - the 0-based position in the underlying array
        value - the value to set
      • setRGBA

        public void setRGBA​(int position,
                            int[] rgba)
        Sets the RGBA values at the specified location.
        Parameters:
        position - the 0-based position in the underlying array
        rgba - the RGBA values to set
      • set

        public void set​(int x,
                        int y,
                        int value)
        Sets the value at the specified location.
        Parameters:
        x - the 0-based column
        y - the 0-based row
        value - the value to set
      • setRGBA

        public void setRGBA​(int x,
                            int y,
                            int[] rgba)
        Sets the RGBA values at the specified location.
        Parameters:
        x - the 0-based column
        y - the 0-based row
        rgba - the RGBA values to set
      • toString

        public String toString()
        Returns a short description of the view.
        Overrides:
        toString in class Object
        Returns:
        the description
      • toBufferedImage

        public BufferedImage toBufferedImage​(int type)
        Turns the matrix into an image.
        Parameters:
        type - the BufferedImage type
        Returns:
        the image