Class CanvasPixelArray


  • public class CanvasPixelArray
    extends JavaScriptObject
    Array-like object holding the actual image data for an ImageData object. For each pixel, this object contains a red, green, blue and alpha value between 0 and 255 (in this order). Note that we use ints here to represent the data to avoid complexities stemming from bytes being signed in Java.
    See Also:
    HTML Canvas 2D CanvasPixelArray
    • Constructor Detail

      • CanvasPixelArray

        protected CanvasPixelArray()
    • Method Detail

      • get

        public final int get​(int i)
        Returns the data value at index i.
        Parameters:
        i - the data index
        Returns:
        the data value
      • getLength

        public final int getLength()
        Returns the length of the array.
        Returns:
        the array length
      • set

        public final void set​(int i,
                              int value)
        Sets the data value at position i to the given value. Most browsers will clamp this value to the range 0...255, but that is not enforced in this implementation.
        Parameters:
        i - index to set.
        value - value to set (use values from 0 to 255)