resize static method

RgbaImage resize(
  1. RgbaImage src,
  2. int dw,
  3. int dh
)

Bilinear resize.

Implementation

static RgbaImage resize(RgbaImage src, int dw, int dh) {
  final input = calloc<Uint8>(src.bytes.length);
  final out = calloc<Uint8>(dw * dh * 4);
  try {
    input.asTypedList(src.bytes.length).setAll(0, src.bytes);
    _resize(input, src.width, src.height, out, dw, dh);
    return RgbaImage(
      Uint8List.fromList(out.asTypedList(dw * dh * 4)),
      dw,
      dh,
    );
  } finally {
    calloc.free(input);
    calloc.free(out);
  }
}