captureSessionGetCaptureRegion method

Rectangle<num> captureSessionGetCaptureRegion(
  1. Pointer<Void> libraryPtr
)

Implementation

Rectangle captureSessionGetCaptureRegion(Pointer<Void> libraryPtr) {
  Pointer<Int32> xOut = calloc();
  Pointer<Int32> yOut = calloc();
  Pointer<Int32> widthOut = calloc();
  Pointer<Int32> heightOut = calloc();

  int error = _captureSessionGetCaptureRegion(libraryPtr, xOut, yOut, widthOut, heightOut);
  if( error != FaceCaptureErrorCode.noErrors.value ) {
    throw FaceCaptureException(error);
  }

  Rectangle captureRegion = Rectangle(xOut.value, yOut.value, widthOut.value, heightOut.value);

  calloc.free(xOut);
  calloc.free(yOut);
  calloc.free(widthOut);
  calloc.free(heightOut);

  return captureRegion;
}