1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
10 // Intel License Agreement
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
19 // * Redistribution's of source code must retain the above copyright notice,
20 // this list of conditions and the following disclaimer.
22 // * Redistribution's in binary form must reproduce the above copyright notice,
23 // this list of conditions and the following disclaimer in the documentation
24 // and/or other materials provided with the distribution.
26 // * The name of Intel Corporation may not be used to endorse or promote products
27 // derived from this software without specific prior written permission.
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
44 // in later times, use this file as a dispatcher to implementations like cvcap.cpp
46 CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_value)
50 case CV_WND_PROP_FULLSCREEN://accept CV_WINDOW_NORMAL or CV_WINDOW_FULLSCREEN
52 if (!name || (prop_value!=CV_WINDOW_NORMAL && prop_value!=CV_WINDOW_FULLSCREEN))//bag argument
55 #if defined WIN32 || defined _WIN32
56 cvChangeMode_W32(name,prop_value);
57 #elif defined (HAVE_GTK)
58 cvChangeMode_GTK(name,prop_value);
59 #elif defined (HAVE_CARBON)
60 cvChangeMode_QT(name,prop_value);
64 case CV_WND_PROP_AUTOSIZE:
72 /* return -1 if error */
73 CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
77 case CV_WND_PROP_FULLSCREEN:
79 if (!name)//bad argument
82 #if defined WIN32 || defined _WIN32
83 return cvGetMode_W32(name);
84 #elif defined (HAVE_GTK)
85 return cvGetMode_GTK(name);
86 #elif defined (HAVE_CARBON)
87 return cvGetMode_QT(name);
91 case CV_WND_PROP_AUTOSIZE:
93 if (!name)//bad argument
106 void namedWindow( const string& winname, int flags )
108 cvNamedWindow( winname.c_str(), flags );
112 void setWindowProperty(const string& winname, int prop_id, double prop_value)
114 cvSetWindowProperty( winname.c_str(),prop_id,prop_value);
118 double getWindowProperty(const string& winname, int prop_id)
120 return cvGetWindowProperty(winname.c_str(),prop_id);
123 void imshow( const string& winname, const Mat& img )
126 cvShowImage( winname.c_str(), &_img );
129 int waitKey(int delay)
131 return cvWaitKey(delay);
134 int createTrackbar(const string& trackbarName, const string& winName,
135 int* value, int count, TrackbarCallback callback,
138 return cvCreateTrackbar2(trackbarName.c_str(), winName.c_str(),
139 value, count, callback, userdata);
142 void setTrackbarPos( const string& trackbarName, const string& winName, int value )
144 cvSetTrackbarPos(trackbarName.c_str(), winName.c_str(), value );
147 int getTrackbarPos( const string& trackbarName, const string& winName )
149 return cvGetTrackbarPos(trackbarName.c_str(), winName.c_str());
154 #if defined WIN32 || defined _WIN32 // see window_w32.cpp
155 #elif defined (HAVE_GTK) // see window_gtk.cpp
156 #elif defined (HAVE_COCOA) // see window_carbon.cpp
157 #elif defined (HAVE_CARBON)
162 // No windowing system present at compile time ;-(
164 // We will build place holders that don't break the API but give an error
165 // at runtime. This way people can choose to replace an installed HighGUI
166 // version with a more capable one without a need to recompile dependent
167 // applications or libraries.
170 #define CV_NO_GUI_ERROR(funcname) \
171 cvError( CV_StsError, funcname, \
172 "The function is not implemented. " \
173 "Rebuild the library with Windows, GTK+ 2.x or Carbon support. "\
174 "If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script", \
178 CV_IMPL int cvNamedWindow( const char*, int )
180 CV_NO_GUI_ERROR("cvNamedWindow");
184 CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_value)//YV
186 CV_NO_GUI_ERROR("cvSetWindowProperty");
189 CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)//YV
191 CV_NO_GUI_ERROR("cvGetWindowProperty");
195 CV_IMPL void cvDestroyWindow( const char* )
197 CV_NO_GUI_ERROR( "cvDestroyWindow" );
201 cvDestroyAllWindows( void )
203 CV_NO_GUI_ERROR( "cvDestroyAllWindows" );
207 cvShowImage( const char*, const CvArr* )
209 CV_NO_GUI_ERROR( "cvShowImage" );
212 CV_IMPL void cvResizeWindow( const char*, int, int )
214 CV_NO_GUI_ERROR( "cvResizeWindow" );
217 CV_IMPL void cvMoveWindow( const char*, int, int )
219 CV_NO_GUI_ERROR( "cvMoveWindow" );
223 cvCreateTrackbar( const char*, const char*,
224 int*, int, CvTrackbarCallback )
226 CV_NO_GUI_ERROR( "cvCreateTrackbar" );
231 cvCreateTrackbar2( const char* trackbar_name, const char* window_name,
232 int* val, int count, CvTrackbarCallback2 on_notify2,
235 CV_NO_GUI_ERROR( "cvCreateTrackbar2" );
240 cvSetMouseCallback( const char*, CvMouseCallback, void* )
242 CV_NO_GUI_ERROR( "cvSetMouseCallback" );
245 CV_IMPL int cvGetTrackbarPos( const char*, const char* )
247 CV_NO_GUI_ERROR( "cvGetTrackbarPos" );
251 CV_IMPL void cvSetTrackbarPos( const char*, const char*, int )
253 CV_NO_GUI_ERROR( "cvSetTrackbarPos" );
256 CV_IMPL void* cvGetWindowHandle( const char* )
258 CV_NO_GUI_ERROR( "cvGetWindowHandle" );
262 CV_IMPL const char* cvGetWindowName( void* )
264 CV_NO_GUI_ERROR( "cvGetWindowName" );
268 CV_IMPL int cvWaitKey( int )
270 CV_NO_GUI_ERROR( "cvWaitKey" );
274 CV_IMPL int cvInitSystem( int argc, char** argv )
277 CV_NO_GUI_ERROR( "cvInitSystem" );
281 CV_IMPL int cvStartWindowThread()
284 CV_NO_GUI_ERROR( "cvStartWindowThread" );