This commit is contained in:
2025-01-24 19:20:57 +08:00
parent 7bd0c2b82a
commit 11e4d7a9f2
3 changed files with 8 additions and 25 deletions

View File

@@ -39,12 +39,12 @@ class Image {
return image;
}
int getPixelAtIndex(int index) {
Color 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];
return Color.fromValue(_data[index]);
}
Image copyRange(int x, int y, int width, int height) {
@@ -184,11 +184,11 @@ class Color {
Color.fromValue(this.value);
int get r => (value >> 16) & 0xFF;
int get r => value & 0xFF;
int get g => (value >> 8) & 0xFF;
int get b => value & 0xFF;
int get b => (value >> 16) & 0xFF;
int get a => (value >> 24) & 0xFF;
}