convert method
- List<
int> input, { - PixelFormat<
int, void> format = abgr8888,
override
Converts input
and returns the result of the conversion.
Implementation
@override
Buffer<int> convert(
List<int> input, {
PixelFormat<int, void> format = abgr8888,
}) {
final Uint32List view;
if (input is TypedDataList<int>) {
view = input.buffer.asUint32List();
} else {
view = Uint32List.fromList(input);
}
final width = view[0];
final height = view[1];
final output = IntPixels(width, height, format: format);
// Reverse of the above encoding.
var word = 0;
var bit = 0;
var offset = 2;
for (var i = 0; i < output.data.length; i++) {
if (bit == 0) {
word = view[offset];
offset++;
}
output.data[i] = (word & 1) == 0 ? format.zero : format.max;
word >>= 1;
bit++;
if (bit == 32) {
bit = 0;
}
}
return output;
}