infoBytes static method

(int, int, int, int) infoBytes(
  1. Uint8List bytes
)

Implementation

static (int result, int channels, int width, int height) infoBytes(Uint8List bytes) {
  final pBytes = malloc<ffi.Uint8>(bytes.length);
  pBytes.asTypedList(bytes.length).setAll(0, bytes);
  final pW = calloc<ffi.Int>();
  final pH = calloc<ffi.Int>();
  final pChannels = calloc<ffi.Int>();
  final result = c.stbi_info_from_memory(pBytes.cast(), bytes.length, pW, pH, pChannels);
  final rval = (result, pChannels.value, pW.value, pH.value);
  calloc.free(pBytes);
  calloc.free(pW);
  calloc.free(pH);
  calloc.free(pChannels);
  return rval;
}