getCapturedImage method

Uint8List getCapturedImage(
  1. Pointer<Void> libraryPtr,
  2. Pointer<Void> workflowPtr
)

Implementation

Uint8List getCapturedImage(Pointer<Void> libraryPtr, Pointer<Void> workflowPtr) {
  Pointer<Pointer<Uint8>> captureImageOut = calloc();
  Pointer<Int> sizeOut = calloc();
  int error = _getCapturedImage(libraryPtr, workflowPtr, captureImageOut, sizeOut);
  if( error != FaceCaptureErrorCode.noErrors.value ) {
    throw FaceCaptureException(error);
  }
  Pointer<Uint8> frame = captureImageOut.value;
  Uint8List frameData = frame.asTypedList(sizeOut.value);

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

  return frameData;
}