Class FastPixelInt

    • Constructor Detail

      • FastPixelInt

        public FastPixelInt​(BufferedImage bImage)
        Constructs a fast pixel object with the underlying buffered image.

        Note that calling this method may cause this DataBufferobject to be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

        Parameters:
        bImage - The buffered image to extract data from
        Since:
        1.3.0 com.github.kilianB
    • Method Detail

      • getRGB

        public int getRGB​(int index)
      • getRGB

        public int getRGB​(int x,
                          int y)
        Returns an integer pixel in the default RGB color model(TYPE_INT_ARGB). There are only 8-bits of precision for each color component in the returned data when using this method. An ArrayOutOfBoundsException may be thrown if the coordinates are not in bounds.
        Parameters:
        x - the X coordinate of the pixel from which to get the pixel in the default RGB color model
        y - the Y coordinate of the pixel from which to get the pixel in the default RGB color model
        Returns:
        an integer pixel in the default RGB color model and default sRGB colorspace.
        Since:
        1.3.0 com.github.kilianB
      • setAlpha

        public void setAlpha​(int index,
                             int newAlpha)
        Description copied from interface: FastPixel
        Set the alpha value. This method is a NOP if alpha is not supported.
        Parameters:
        index - the offset of the underlying array
        newAlpha - the new alpha value in range [0-255]
      • setRed

        public void setRed​(int index,
                           int newRed)
        Description copied from interface: FastPixel
        Set the red value at the specified offset
        Parameters:
        index - the offset of the underlying array
        newRed - the new red value in range [0-255]
      • setRed

        public void setRed​(int x,
                           int y,
                           int newRed)
        Set the red value of the specified pixel
        Parameters:
        x - The x coordinate of the images' pixel
        y - The y coordinate of the images' pixel
        newRed - the new red value in range [0-255]
        Since:
        1.3.0 com.github.kilianB
      • setGreen

        public void setGreen​(int index,
                             int newGreen)
        Description copied from interface: FastPixel
        Set the green value at the specified offset
        Parameters:
        index - the offset of the underlying array
        newGreen - the new green value in range [0-255]
      • setBlue

        public void setBlue​(int index,
                            int newBlue)
      • getOffset

        public int getOffset​(int x,
                             int y)
        Description copied from interface: FastPixel
        Map the x and y values to the underlying one dimensional data array
        Parameters:
        x - the x coordinate
        y - the y coordinate
        Returns:
        the corresponding 1d array index