Class PixelData

A buffer describing a volume (3D), image (2D) or line (1D) of pixels in memory. Pixels are stored as a succession of "depth" slices, each containing "height" rows of "width" pixels.

If using the constructor instead of Create() you must call GPUResourceData::allocateInternalBuffer or set the buffer in some other way before reading/writing from this object, as by the default there is no buffer allocated.

Hierarchy

  • FrameworkObject
    • PixelData

Constructors

  • Performs Alloc.

    Parameters

    • options: {
          format?: EnumValue<PixelFormat, number>;
          volume: Immutable<PixelVolume>;
      } | {
          depth?: number;
          height: number;
          pixelFormat?: EnumValue<PixelFormat, number>;
          width: number;
      }

      Options object for the function call.

    • OptionalisInternalConstructor: boolean

    Returns PixelData

Accessors

  • get rawIsConsecutive(): boolean
  • Return whether this buffer is laid out consecutive in memory (meaning the pitches are equal to the dimensions).

    Returns boolean

  • get rawRowPitch(): number
  • Returns the number of bytes that offsets one row from another. This can be exact number of bytes required to hold "width" pixel, but doesn't have to be as some buffers require padding.

    Returns number

  • get rawSize(): number
  • Return the size (in bytes) of the buffer this image requires.

    Returns number

  • get rawSlicePitch(): number
  • Returns the number of bytes that offsets one depth slice from another. This can be exact number of bytes required to hold "width * height" pixels, but doesn't have to be as some buffers require padding.

    Returns number

Methods

  • Returns a pixel at the specified location in the buffer.

    Parameters

    • x: number

      X coordinate of the pixel.

    • y: number

      Y coordinate of the pixel.

    • Optionalz: number

      Z coordinate of the pixel.

    Returns Color

    Value of the pixel, or undefined value if coordinates are out of range.

  • Returns values of all pixels.

    Returns Color[]

    All pixels in the buffer ordered consecutively. Pixels are stored as a succession of "depth" slices, each containing "height" rows of "width" pixels.

  • Returns all pixels in the buffer as raw bytes.

    Returns string[]

    Raw pixel bytes. It is up to the caller to interpret the pixel format and account for potential row and slice pitch values.

  • Sets a pixel at the specified location in the buffer.

    Parameters

    • value: Immutable<Color>

      Color of the pixel to set.

    • x: number

      X coordinate of the pixel.

    • y: number

      Y coordinate of the pixel.

    • Optionalz: number

      Z coordinate of the pixel.

    Returns void

  • Sets all pixels in the buffer.Caller must ensure that number of pixels match the extends of the buffer.

    Parameters

    • value: Immutable<Color>[]

      All pixels in the buffer ordered consecutively. Pixels are stored as a succession of "depth" slices, each containing "height" rows of "width" pixels.

    Returns void

  • Sets all pixels in the buffer as raw bytes.

    Parameters

    • value: string[]

      Raw pixel bytes. It is up to the caller to interpret the pixel format and account for potential row and slice pitch values.

    Returns void