32 lines
859 B
Dart
32 lines
859 B
Dart
import 'dart:ffi';
|
|
|
|
import 'package:ffi/ffi.dart';
|
|
import 'package:segmentation_douglas_peucker_flutter/dotnet_exception.dart';
|
|
import 'package:segmentation_douglas_peucker_flutter/gen/generated_bindings.dart';
|
|
import 'package:segmentation_douglas_peucker_flutter/lib.dart';
|
|
|
|
class DaliPoint {
|
|
final int x;
|
|
final int y;
|
|
|
|
const DaliPoint(this.x, this.y);
|
|
|
|
factory DaliPoint.fromPointer(Pointer<Void> pointer) {
|
|
final NativeLibrary nativeLibrary = NativeLibrary(Lib.shared);
|
|
|
|
final Pointer<System_Exception_t> exception = calloc();
|
|
final x = nativeLibrary.System_Drawing_Point_X_Get(pointer, exception);
|
|
exception.handle();
|
|
|
|
final y = nativeLibrary.System_Drawing_Point_Y_Get(pointer, exception);
|
|
exception.handle();
|
|
|
|
return DaliPoint(x, y);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'DaliPoint{x: $x, y: $y}';
|
|
}
|
|
}
|