2024-03-11 15:36:09 +01:00
|
|
|
// import 'dart:async';
|
2024-03-07 15:29:36 +01:00
|
|
|
import 'dart:ffi';
|
|
|
|
import 'dart:io';
|
2024-03-11 15:36:09 +01:00
|
|
|
import 'dart:typed_data';
|
|
|
|
// import 'dart:isolate';
|
|
|
|
// import 'dart:ui';
|
2024-03-11 18:42:48 +01:00
|
|
|
import 'package:archimedes_mobile_lib/archimedes_c_shim.dart';
|
|
|
|
import 'package:archimedes_mobile_lib/dynloader.dart';
|
2024-03-11 15:36:09 +01:00
|
|
|
import "package:ffi/ffi.dart";
|
|
|
|
import "package:path/path.dart" show dirname, join;
|
|
|
|
import 'dart:io' show Platform;
|
2024-03-07 15:29:36 +01:00
|
|
|
|
|
|
|
import 'archimedes_mobile_lib_bindings_generated.dart';
|
|
|
|
|
|
|
|
/// The dynamic library in which the symbols for [ArchimedesMobileLibBindings] can be found.
|
2024-03-11 18:42:48 +01:00
|
|
|
final DynamicLibrary _dylib = getArchimedesCLib();
|
2024-03-11 15:36:09 +01:00
|
|
|
|
|
|
|
void main(List<String> arguments) {
|
2024-03-11 18:42:48 +01:00
|
|
|
final assets = join(HERE.parent.path, "assets");
|
2024-03-11 15:36:09 +01:00
|
|
|
final testFrames = join(assets, "test", "frames");
|
|
|
|
final firstFrame = join(testFrames, "0001.png");
|
|
|
|
final f = File(firstFrame);
|
|
|
|
final l = f.readAsBytesSync().cast();
|
|
|
|
final myPointer = malloc<Uint8>(l.length);
|
|
|
|
for (int i = 0; i < l.length; ++i) {
|
|
|
|
myPointer[i] = l[i];
|
|
|
|
print(myPointer[i]);
|
|
|
|
}
|
2024-03-07 15:29:36 +01:00
|
|
|
|
2024-03-11 15:36:09 +01:00
|
|
|
Pointer<Frame> frame = newFrame(myPointer, l.length, 768, 768, 64);
|
2024-03-07 15:29:36 +01:00
|
|
|
|
2024-03-11 15:36:09 +01:00
|
|
|
Pointer<UnsignedChar> data = malloc<UnsignedChar>(l.length * 4);
|
2024-03-07 15:29:36 +01:00
|
|
|
|
2024-03-11 15:36:09 +01:00
|
|
|
getImageData(frame, data);
|
2024-03-07 15:29:36 +01:00
|
|
|
}
|