@@ -179,6 +179,14 @@ static void cleanupTrackbarCallbacksWithData_()
179
179
180
180
using namespace cv ::impl;
181
181
182
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
183
+ static void deprecateNotFoundNoOpBehavior ()
184
+ {
185
+ CV_LOG_ONCE_WARNING (NULL , " This no-op behavior is deprecated. Future versions of OpenCV will trigger exception in this case" );
186
+ }
187
+ #define CV_NOT_FOUND_DEPRECATION deprecateNotFoundNoOpBehavior ()
188
+ #endif
189
+
182
190
CV_IMPL void cvSetWindowProperty (const char * name, int prop_id, double prop_value)
183
191
{
184
192
CV_TRACE_FUNCTION ();
@@ -193,6 +201,19 @@ CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_valu
193
201
}
194
202
}
195
203
204
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
205
+ auto backend = getCurrentUIBackend ();
206
+ if (backend)
207
+ {
208
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << name << " '. Do nothing" );
209
+ CV_NOT_FOUND_DEPRECATION;
210
+ }
211
+ else
212
+ {
213
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
214
+ }
215
+ return ;
216
+ #else
196
217
switch (prop_id)
197
218
{
198
219
// change between fullscreen or not.
@@ -249,6 +270,7 @@ CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_valu
249
270
250
271
default :;
251
272
}
273
+ #endif
252
274
}
253
275
254
276
/* return -1 if error */
@@ -268,6 +290,19 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
268
290
}
269
291
}
270
292
293
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
294
+ auto backend = getCurrentUIBackend ();
295
+ if (backend)
296
+ {
297
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << name << " '. Do nothing" );
298
+ CV_NOT_FOUND_DEPRECATION;
299
+ }
300
+ else
301
+ {
302
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
303
+ }
304
+ return -1 ;
305
+ #else
271
306
switch (prop_id)
272
307
{
273
308
case CV_WND_PROP_FULLSCREEN:
@@ -361,13 +396,13 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
361
396
default :
362
397
return -1 ;
363
398
}
399
+ #endif
364
400
}
365
401
366
402
cv::Rect cvGetWindowImageRect (const char * name)
367
403
{
368
404
CV_TRACE_FUNCTION ();
369
- if (!name)
370
- return cv::Rect (-1 , -1 , -1 , -1 );
405
+ CV_Assert (name);
371
406
372
407
{
373
408
auto window = findWindow_ (name);
@@ -377,6 +412,20 @@ cv::Rect cvGetWindowImageRect(const char* name)
377
412
}
378
413
}
379
414
415
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
416
+ auto backend = getCurrentUIBackend ();
417
+ if (backend)
418
+ {
419
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << name << " '. Do nothing" );
420
+ CV_NOT_FOUND_DEPRECATION;
421
+ }
422
+ else
423
+ {
424
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
425
+ }
426
+ return Rect (-1 , -1 , -1 , -1 );
427
+ #else
428
+
380
429
#if defined (HAVE_QT)
381
430
return cvGetWindowRect_QT (name);
382
431
#elif defined(HAVE_WIN32UI)
@@ -386,8 +435,10 @@ cv::Rect cvGetWindowImageRect(const char* name)
386
435
#elif defined (HAVE_COCOA)
387
436
return cvGetWindowRect_COCOA (name);
388
437
#else
389
- return cv:: Rect (-1 , -1 , -1 , -1 );
438
+ return Rect (-1 , -1 , -1 , -1 );
390
439
#endif
440
+
441
+ #endif
391
442
}
392
443
393
444
cv::Rect cv::getWindowImageRect (const String& winname)
@@ -483,7 +534,21 @@ void cv::resizeWindow( const String& winname, int width, int height )
483
534
}
484
535
}
485
536
537
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
538
+ auto backend = getCurrentUIBackend ();
539
+ if (backend)
540
+ {
541
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << winname << " '. Do nothing" );
542
+ CV_NOT_FOUND_DEPRECATION;
543
+ }
544
+ else
545
+ {
546
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
547
+ }
548
+ return ;
549
+ #else
486
550
cvResizeWindow ( winname.c_str (), width, height );
551
+ #endif
487
552
}
488
553
489
554
void cv::resizeWindow (const String& winname, const cv::Size & size)
@@ -504,7 +569,21 @@ void cv::moveWindow( const String& winname, int x, int y )
504
569
}
505
570
}
506
571
572
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
573
+ auto backend = getCurrentUIBackend ();
574
+ if (backend)
575
+ {
576
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << winname << " '. Do nothing" );
577
+ CV_NOT_FOUND_DEPRECATION;
578
+ }
579
+ else
580
+ {
581
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
582
+ }
583
+ return ;
584
+ #else
507
585
cvMoveWindow ( winname.c_str (), x, y );
586
+ #endif
508
587
}
509
588
510
589
void cv::setWindowProperty (const String& winname, int prop_id, double prop_value)
@@ -616,8 +695,22 @@ int cv::createTrackbar(const String& trackbarName, const String& winName,
616
695
}
617
696
}
618
697
698
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
699
+ auto backend = getCurrentUIBackend ();
700
+ if (backend)
701
+ {
702
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << winName << " '. Do nothing" );
703
+ CV_NOT_FOUND_DEPRECATION;
704
+ }
705
+ else
706
+ {
707
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
708
+ }
709
+ return 0 ;
710
+ #else
619
711
return cvCreateTrackbar2 (trackbarName.c_str (), winName.c_str (),
620
712
value, count, callback, userdata);
713
+ #endif
621
714
}
622
715
623
716
void cv::setTrackbarPos ( const String& trackbarName, const String& winName, int value )
@@ -635,7 +728,21 @@ void cv::setTrackbarPos( const String& trackbarName, const String& winName, int
635
728
}
636
729
}
637
730
731
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
732
+ auto backend = getCurrentUIBackend ();
733
+ if (backend)
734
+ {
735
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << winName << " '. Do nothing" );
736
+ CV_NOT_FOUND_DEPRECATION;
737
+ }
738
+ else
739
+ {
740
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
741
+ }
742
+ return ;
743
+ #else
638
744
cvSetTrackbarPos (trackbarName.c_str (), winName.c_str (), value );
745
+ #endif
639
746
}
640
747
641
748
void cv::setTrackbarMax (const String& trackbarName, const String& winName, int maxval)
@@ -655,7 +762,21 @@ void cv::setTrackbarMax(const String& trackbarName, const String& winName, int m
655
762
}
656
763
}
657
764
765
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
766
+ auto backend = getCurrentUIBackend ();
767
+ if (backend)
768
+ {
769
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << winName << " '. Do nothing" );
770
+ CV_NOT_FOUND_DEPRECATION;
771
+ }
772
+ else
773
+ {
774
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
775
+ }
776
+ return ;
777
+ #else
658
778
cvSetTrackbarMax (trackbarName.c_str (), winName.c_str (), maxval);
779
+ #endif
659
780
}
660
781
661
782
void cv::setTrackbarMin (const String& trackbarName, const String& winName, int minval)
@@ -675,7 +796,21 @@ void cv::setTrackbarMin(const String& trackbarName, const String& winName, int m
675
796
}
676
797
}
677
798
799
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
800
+ auto backend = getCurrentUIBackend ();
801
+ if (backend)
802
+ {
803
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << winName << " '. Do nothing" );
804
+ CV_NOT_FOUND_DEPRECATION;
805
+ }
806
+ else
807
+ {
808
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
809
+ }
810
+ return ;
811
+ #else
678
812
cvSetTrackbarMin (trackbarName.c_str (), winName.c_str (), minval);
813
+ #endif
679
814
}
680
815
681
816
int cv::getTrackbarPos ( const String& trackbarName, const String& winName )
@@ -693,7 +828,21 @@ int cv::getTrackbarPos( const String& trackbarName, const String& winName )
693
828
}
694
829
}
695
830
831
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
832
+ auto backend = getCurrentUIBackend ();
833
+ if (backend)
834
+ {
835
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << winName << " '. Do nothing" );
836
+ CV_NOT_FOUND_DEPRECATION;
837
+ }
838
+ else
839
+ {
840
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
841
+ }
842
+ return -1 ;
843
+ #else
696
844
return cvGetTrackbarPos (trackbarName.c_str (), winName.c_str ());
845
+ #endif
697
846
}
698
847
699
848
void cv::setMouseCallback ( const String& windowName, MouseCallback onMouse, void * param)
@@ -709,7 +858,21 @@ void cv::setMouseCallback( const String& windowName, MouseCallback onMouse, void
709
858
}
710
859
}
711
860
861
+ #if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
862
+ auto backend = getCurrentUIBackend ();
863
+ if (backend)
864
+ {
865
+ CV_LOG_WARNING (NULL , " Can't find window with name: '" << windowName << " '. Do nothing" );
866
+ CV_NOT_FOUND_DEPRECATION;
867
+ }
868
+ else
869
+ {
870
+ CV_LOG_WARNING (NULL , " No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation" );
871
+ }
872
+ return ;
873
+ #else
712
874
cvSetMouseCallback (windowName.c_str (), onMouse, param);
875
+ #endif
713
876
}
714
877
715
878
int cv::getMouseWheelDelta ( int flags )
0 commit comments