applyTo method

  1. @override
Bitmap applyTo(
  1. Bitmap bitmap
)
override

Implementation

@override
Bitmap applyTo(Bitmap bitmap) {
  assert(left + width <= bitmap.width);
  assert(top + height <= bitmap.height);

  final int newBitmapSize = width * height * RGBA32BitmapHeader.pixelLength;

  final Bitmap cropped = Bitmap.fromHeadless(
    width,
    height,
    Uint8List(newBitmapSize),
  );

  _cropCore(
    bitmap.content,
    cropped.content,
    bitmap.width,
    // Height is not needed.
    left,
    top,
    width,
    height,
  );

  return cropped;
}