libdart_openmvg/lib/archimedes_mobile_lib.dart

36 lines
1.1 KiB
Dart
Raw Normal View History

// import 'dart:async';
import 'dart:ffi';
import 'dart:io';
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';
import "package:ffi/ffi.dart";
import "package:path/path.dart" show dirname, join;
import 'dart:io' show Platform;
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();
void main(List<String> arguments) {
2024-03-11 18:42:48 +01:00
final assets = join(HERE.parent.path, "assets");
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]);
}
Pointer<Frame> frame = newFrame(myPointer, l.length, 768, 768, 64);
Pointer<UnsignedChar> data = malloc<UnsignedChar>(l.length * 4);
getImageData(frame, data);
}