rainyl / opencv_dart

OpenCV bindings for Dart language and Flutter. Support Asynchronous Now!
https://pub.dev/packages/opencv_dart
Apache License 2.0
136 stars 18 forks source link

Refactor vector wrappers #154

Closed rainyl closed 4 months ago

rainyl commented 4 months ago

The current impl of vector wrappers are not efficient, getting the elements inside them will perform a deep copy, however, return a reference is much better.

So I am going to refactor the wrappers of vectors to use structs:

typedef struct {
  Point *ptr;
  size_t length;
} VecPoint;

In this way, we can get it's length without allocating memories comparing to the current impl, which will be more efficient and convenient to interact with the List (or Iterable) of dart.