mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
Reduce app size
This commit is contained in:
@@ -26,7 +26,7 @@ class Image {
|
||||
var codec = await ui.instantiateImageCodec(data);
|
||||
var frame = await codec.getNextFrame();
|
||||
codec.dispose();
|
||||
var info = await frame.image.toByteData();
|
||||
var info = await frame.image.toByteData(format: ui.ImageByteFormat.rawStraightRgba);
|
||||
if (info == null) {
|
||||
throw Exception('Failed to decode image');
|
||||
}
|
||||
@@ -39,6 +39,14 @@ class Image {
|
||||
return image;
|
||||
}
|
||||
|
||||
int getPixelAtIndex(int index) {
|
||||
if (index < 0 || index >= _data.length) {
|
||||
throw ArgumentError(
|
||||
'Invalid argument: index must be in the range of [0, ${_data.length}).');
|
||||
}
|
||||
return _data[index];
|
||||
}
|
||||
|
||||
Image copyRange(int x, int y, int width, int height) {
|
||||
if (width + x > this.width) {
|
||||
throw ArgumentError('''
|
||||
|
Reference in New Issue
Block a user