rgbaToGray static method
Convert an RGBA/BGRA buffer to grayscale.
Implementation
static Uint8List rgbaToGray(
Uint8List rgba,
int width,
int height,
int stride,
) {
final input = calloc<Uint8>(rgba.length);
final out = calloc<Uint8>(width * height);
try {
input.asTypedList(rgba.length).setAll(0, rgba);
_rgbaToGray(input, width, height, stride, out);
return Uint8List.fromList(out.asTypedList(width * height));
} finally {
calloc.free(input);
calloc.free(out);
}
}