captureStateGetFrame method

Uint8List captureStateGetFrame(
  1. Pointer<Void> libraryPtr,
  2. Pointer<Void> captureStatePtr
)

Implementation

Uint8List captureStateGetFrame(Pointer<Void> libraryPtr, Pointer<Void> captureStatePtr) {
  Pointer<Pointer<Uint8>> frameOut = calloc();
  Pointer<Int> sizeOut = calloc();
  int error = _captureStateGetFrame(libraryPtr, captureStatePtr, frameOut, sizeOut);
  if( error != FaceCaptureErrorCode.noErrors.value ) {
    throw FaceCaptureException(error);
  }
  Pointer<Uint8> frame = frameOut.value;
  Uint8List frameData = Uint8List.fromList(frame.asTypedList(sizeOut.value));

  calloc.free(frame);
  calloc.free(sizeOut);
  calloc.free(frameOut);

  return frameData;
}