crop method
void
crop()
Image cropping will be done by crop method
Implementation
void crop(int imageCropX, int imageCropY, int imageCropWidth, int imageCropHeight,
Function(Image, Uint8List) onImageLoaded) async {
worker.postMessage([
1,
libraryImage.getBytes(),
libraryImage.width.toInt(),
libraryImage.height.toInt(),
imageCropX,
imageCropY,
imageCropWidth,
imageCropHeight,
encodingQuality,
outputImageFormat.index
]);
final event = await worker.onMessage.first;
onImageLoaded.call(
Image.fromBytes(width: imageCropWidth, height: imageCropHeight, bytes: event.data[0], order: ChannelOrder.rgb),
event.data[1]);
}