pref: calculate image hash from raw bytes

This commit is contained in:
Fabian Freund committed 2025-02-21 11:54:26 +01:00
1 parent a3c900cf62
commit a9cad61d36
9 files changed
+22 -32

No files matched your search

+6 -6
View File
@@ -1,18 +1,18 @@
import 'dart:ui';
import 'package:lensai/extensions/image.dart';
class EquatableImage {
final Image value;
final int? _imageHash;
EquatableImage(this.value, {required int? hash}) : _imageHash = hash;
static Future<EquatableImage> calculate(Image image) async {
final imageHash = await image.calculateHash();
//For now we only calculate the has from encoded image on decoding
return EquatableImage(image, hash: imageHash);
}
// static Future<EquatableImage> calculate(Image image) async {
// final imageHash = await image.calculateHash();
// return EquatableImage(image, hash: imageHash);
// }
@override
int get hashCode => _imageHash.hashCode;