mapPoint method

({double x, double y}) mapPoint(
  1. MapDirection direction, {
  2. required double x,
  3. required double y,
})

Map a point between viewport coordinates and video frame coordinates. Returns the mapped coordinates as a record ({double x, double y}). https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-mappointmapdirection-dir-float-x-float-y-float-z--nullptr-void-vo_opaque--nullptr

Implementation

({double x, double y}) mapPoint(
  MapDirection direction, {
  required double x,
  required double y,
}) {
  final cx = calloc<Float>();
  final cy = calloc<Float>();
  final cz = calloc<Float>();
  cx.value = x;
  cy.value = y;
  _player.ref.mapPoint
      .asFunction<
        void Function(
          Pointer<mdkPlayer>,
          int,
          Pointer<Float>,
          Pointer<Float>,
          Pointer<Float>,
          Pointer<Void>,
        )
      >()(_player.ref.object, direction.rawValue, cx, cy, cz, _getVid());
  final result = (x: cx.value, y: cy.value);
  calloc.free(cx);
  calloc.free(cy);
  calloc.free(cz);
  return result;
}