extractSvsRegion function

Future<Uint8List?> extractSvsRegion(
  1. SvsFile svs,
  2. int layerIndex,
  3. int x,
  4. int y,
  5. int width,
  6. int height, {
  7. bool applyColorScheme = true,
  8. bool applyDisplayColor = true,
  9. int? displayColor,
  10. CancellationToken? cancelToken,
  11. int quality = 90,
})

Extracts a rectangular region as encoded JPEG bytes.

Implementation

Future<Uint8List?> extractSvsRegion(
  SvsFile svs,
  int layerIndex,
  int x,
  int y,
  int width,
  int height, {
  bool applyColorScheme = true,
  bool applyDisplayColor = true,
  int? displayColor,
  CancellationToken? cancelToken,
  int quality = 90,
}) async {
  final image = await readRegion(
    svs,
    layerIndex,
    x,
    y,
    width,
    height,
    applyColorScheme: applyColorScheme,
    applyDisplayColor: applyDisplayColor,
    displayColor: displayColor,
    cancelToken: cancelToken,
  );
  if (image == null || cancelToken?.isCancelled == true) return null;
  return Uint8List.fromList(img.encodeJpg(image, quality: quality));
}