ImageDescriptor.raw constructor

ImageDescriptor.raw(
  1. ImmutableBuffer buffer,
  2. {required int width,
  3. required int height,
  4. int? rowBytes,
  5. required PixelFormat pixelFormat}
)

Creates an image descriptor from raw image pixels.

The pixels parameter is the pixel data. They are packed in bytes in the order described by pixelFormat, then grouped in rows, from left to right, then top to bottom.

The rowBytes parameter is the number of bytes consumed by each row of pixels in the data buffer. If unspecified, it defaults to width multiplied by the number of bytes per pixel in the provided format.

Implementation

// Not async because there's no expensive work to do here.
factory ImageDescriptor.raw(
  ImmutableBuffer buffer, {
  required int width,
  required int height,
  int? rowBytes,
  required PixelFormat pixelFormat,
}) = _NativeImageDescriptor.raw;