allocateDataForType static method

List allocateDataForType(
  1. int size,
  2. int type,
  3. int bitsPerSample
)

Implementation

static List allocateDataForType(int size, int type, int bitsPerSample) {
  switch (type) {
    case HdrImage.INT:
      if (bitsPerSample == 8) {
        return Int8List(size);
      } else if (bitsPerSample == 16) {
        return Int16List(size);
      } else if (bitsPerSample == 32) {
        return Int32List(size);
      }
      break;
    case HdrImage.UINT:
      if (bitsPerSample == 8) {
        return Uint8List(size);
      } else if (bitsPerSample == 16) {
        return Uint16List(size);
      } else if (bitsPerSample == 32) {
        return Uint32List(size);
      }
      break;
    case HdrImage.FLOAT:
      if (bitsPerSample == 16) {
        return Uint16List(size);
      } else if (bitsPerSample == 32) {
        return Float32List(size);
      } else if (bitsPerSample == 64) {
        return Float64List(size);
      }
      break;
  }
  throw UnimplementedError();
}