decodeRegion method

  1. @override
ImageWrapper decodeRegion(
  1. Rectangle rect,
  2. double sampleSize
)
override

Method is used to decode rectangle region in the image specified by rect. rect area to render Rectangle sampleSize if set to a value > 1, requests the decoder to subsample the original image, returning a smaller image to save memory. Returns constructed bitmap

Example:

// Decode region with sample size 1 (full resolution)
ImageWrapper decodedImage = _decoder!.decodeRegion(sampleRect, 1);
print(
 "Decoded region: ${sampleRect.width}x${sampleRect.height} at sample size 1",
);

Implementation

@override
ImageWrapper decodeRegion(Rectangle rect, double sampleSize) {
    final _decodeRegionFfi = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
        Pointer<Void> Function(Pointer<Void>, RectangleNative, Float),
        Pointer<Void> Function(Pointer<Void>, RectangleNative, double)
      >('navigine_sdk_flutter_BitmapRegionDecoder_decodeRegion__Rect_SampleSize'));
    final __resultHandle = _decodeRegionFfi(this.ptr, RectangleImpl.toNative(rect), sampleSize);
    final _result = ImageWrapperImpl.fromNativePtr(__resultHandle);
    exception.checkCallResult();
    return _result;
}