createTrackbar function

void createTrackbar(
  1. String trackbarName,
  2. String winName,
  3. int maxval, {
  4. Dartcv_TrackbarCallbackFunction? onChange,
})

Implementation

void createTrackbar(
  String trackbarName,
  String winName,
  int maxval, {
  cvg.Dartcv_TrackbarCallbackFunction? onChange,
}) {
  final cTrackName = trackbarName.toNativeUtf8().cast<ffi.Char>();
  final cWinName = winName.toNativeUtf8().cast<ffi.Char>();
  if (onChange == null) {
    cvRun(() => chighgui.cv_createTrackbar(cTrackName, cWinName, maxval));
  } else {
    final funcPointer = ffi.NativeCallable<cvg.cv_TrackbarCallbackFunction>.isolateLocal(onChange);
    cvRun(
      () => chighgui.cv_createTrackbar_1(
        cTrackName,
        cWinName,
        ffi.nullptr,
        maxval,
        funcPointer.nativeFunction,
        ffi.nullptr,
      ),
    );
  }
  calloc.free(cTrackName);
  calloc.free(cWinName);
}