imageProcessingOptions method

Pointer<MpImageProcessingOptions> imageProcessingOptions(
  1. ImageProcessingOptions? options
)

Allocates native image-processing options backed by this scope.

Implementation

ffi.Pointer<bindings.MpImageProcessingOptions> imageProcessingOptions(
  ImageProcessingOptions? options,
) {
  final ffi.Pointer<bindings.MpImageProcessingOptions> result =
      _arena<bindings.MpImageProcessingOptions>();
  final ImageProcessingOptions value = options ?? ImageProcessingOptions();
  result.ref
    ..has_region_of_interest = value.regionOfInterest == null ? 0 : 1
    ..rotation_degrees = value.rotationDegrees;
  if (value.regionOfInterest case final NormalizedRect rectangle) {
    result.ref.region_of_interest
      ..left = rectangle.left
      ..top = rectangle.top
      ..right = rectangle.right
      ..bottom = rectangle.bottom;
  }
  return result;
}