getRectArray method

List<Rect> getRectArray()

Implementation

List<Rect> getRectArray() {
  final valueSize = calloc<Uint32>();
  final value = calloc<Pointer<NativeRect>>();

  try {
    final hr = ptr.ref.vtable
            .elementAt(44)
            .cast<
                Pointer<
                    NativeFunction<
                        HRESULT Function(
                            VTablePointer lpVtbl,
                            Pointer<Uint32> valueSize,
                            Pointer<Pointer<NativeRect>> value)>>>()
            .value
            .asFunction<
                int Function(VTablePointer lpVtbl, Pointer<Uint32> valueSize,
                    Pointer<Pointer<NativeRect>> value)>()(
        ptr.ref.lpVtbl, valueSize, value);

    if (FAILED(hr)) throwWindowsException(hr);

    return value.value.toList(length: valueSize.value);
  } finally {
    free(valueSize);
    free(value);
  }
}