forked from iakdis/librecamera
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_lut_assets.dart
More file actions
48 lines (41 loc) · 1.64 KB
/
test_lut_assets.dart
File metadata and controls
48 lines (41 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import 'dart:convert';
import 'package:flutter/services.dart';
Future<void> testLutAssets() async {
try {
print('尝试读取 AssetManifest.bin...');
final ByteData manifestData = await rootBundle.load('AssetManifest.bin');
final manifestMap = const StandardMessageCodec().decodeMessage(manifestData) as Map<Object?, Object?>;
final lutAssets = manifestMap.keys
.cast<String>()
.where((k) => k.startsWith('assets/Luts/') && k.endsWith('.cube'))
.toList();
print('找到 ${lutAssets.length} 个 LUT 资产:');
for (final asset in lutAssets) {
print(' - $asset');
}
} catch (binError) {
print('AssetManifest.bin 读取失败: $binError');
try {
print('尝试读取 AssetManifest.json...');
final String manifestJson = await rootBundle.loadString('AssetManifest.json');
final Map<String, dynamic> manifestMap = json.decode(manifestJson) as Map<String, dynamic>;
final lutAssets = manifestMap.keys
.where((k) => k.startsWith('assets/Luts/') && k.endsWith('.cube'))
.toList();
print('找到 ${lutAssets.length} 个 LUT 资产:');
for (final asset in lutAssets) {
print(' - $asset');
}
} catch (jsonError) {
print('AssetManifest.json 读取失败: $jsonError');
}
}
// 直接尝试加载已知的LUT文件
try {
print('\n直接测试加载 CINEMATIC_FILM.cube...');
final ByteData data = await rootBundle.load('assets/Luts/CINEMATIC_FILM/CINEMATIC_FILM.cube');
print('成功! 文件大小: ${data.lengthInBytes} 字节');
} catch (e) {
print('直接加载失败: $e');
}
}