BASE_frameSize static method

int BASE_frameSize(
  1. int width,
  2. int height,
  3. PixelFormat format
)

Returns the byte size of a single frame.

Returns 0 if either width or height is 0.

Throws a StateError if format is PixelFormat.PIXELFORMAT_NONE.

Implementation

static int BASE_frameSize(int width, int height, PixelFormat format) {
  if (width == 0 || height == 0) return 0;
  if (format == .PIXELFORMAT_NONE) throw StateError('Image format must be set before accessing data layout');
  return width * height * BASE_bytesPerPixel(format);
}