buildImgVARP function

VARP buildImgVARP(
  1. Uint8List img,
  2. int height,
  3. int width,
  4. int channels, {
  5. int flags = IMREAD_COLOR,
})

Implementation

VARP buildImgVARP(Uint8List img, int height, int width, int channels, {int flags = IMREAD_COLOR}) {
  final pImg = calloc<ffi.Uint8>(img.length)..asTypedList(img.length).setAll(0, img);
  // This uses `_Const` internally, which will copy data, so it's safe to free `pImg` after calling.
  final pOut = c.mnn_cv_buildImgVARP(pImg, height, width, channels, flags);
  final rval = VARP.fromPointer(pOut);
  calloc.free(pImg);
  return rval;
}