00001 /* --------------------------------------------------------------------------- 00002 Phission : 00003 Realtime Vision Processing System 00004 00005 Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu) 00006 University of Massachusetts at Lowell, 00007 Laboratory for Artificial Intelligence and Robotics 00008 00009 This file is part of Phission. 00010 00011 Phission is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU Lesser General Public License as published by 00013 the Free Software Foundation; either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Phission is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public License 00022 along with Phission; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 00025 ---------------------------------------------------------------------------*/ 00026 #ifndef _PHDISPLAYINTERFACE_H 00027 #define _PHDISPLAYINTERFACE_H 00028 00029 #include <phStandard.h> 00030 #include <phThread.h> 00031 #include <ImageGfx.h> 00032 #include <phImage.h> 00033 class phImageWindow; 00034 00035 /* ---------------------------------------------------------------------- */ 00043 PHAPI(class) phDisplayInterface : public phThread 00044 { 00045 protected: 00046 phImageWindow *m_imageWindow; 00047 00048 /* images */ 00049 phImage *m_tempImage; 00050 00051 /* live source stuff */ 00052 phImage *m_liveSourceImage; 00053 00054 /* Pausing is done by setting a flag, having the loop check it 00055 * and then waiting on this semaphore */ 00056 int m_paused; 00057 phSemaphore *m_pause_wait; 00058 phMutex m_pause_lock; 00059 00060 /* Semaphores and signalling */ 00061 phSemaphore m_refresh_done_sem; 00062 phSemaphore m_cleanup_sem; 00063 00064 /* phThread enabling variables */ 00065 phMutex m_spawn_lock; 00066 virtual int run (); 00067 virtual int wakeup (); 00068 virtual int cleanup (); 00069 virtual int error (); 00070 00071 public: 00072 phDisplayInterface( uint32_t width = 0, 00073 uint32_t height= 0, 00074 char *title = NULL ); 00075 virtual ~phDisplayInterface(); 00076 00077 virtual int open ( uint32_t width = 0, 00078 uint32_t height= 0, 00079 char *title = NULL ); 00080 virtual int close (); 00081 00082 /* These wrap around the API dependent m_imageWindow instances */ 00083 virtual int show (); 00084 virtual int hide (); 00085 00086 virtual int resize ( uint32_t w, uint32_t h ); 00087 virtual int move ( int32_t x, int32_t y ); 00088 00089 virtual int isOpen (); 00090 00091 int unpause (); 00092 int pause (); 00093 int isPaused (); 00094 00095 virtual int set ( uint32_t width, 00096 uint32_t height, 00097 const char *title = NULL ); 00098 00099 virtual int setTitle ( const char *title ); 00100 virtual const char *getTitle (); 00101 00102 virtual int setWidth ( uint32_t width ); 00103 virtual int setHeight ( uint32_t height ); 00104 00105 virtual uint32_t getWidth (); 00106 virtual uint32_t getHeight (); 00107 virtual phUSize getSize (); 00108 00109 virtual int32_t getX (); 00110 virtual int32_t getY (); 00111 virtual phPoint getLocation (); 00112 00113 phImageWindow *getImageWindow(); 00114 00115 /* These are unique to phDisplayInterface and differentiate it from 00116 * phImageWindow derived classes */ 00117 /* Live source stuff */ 00118 int isLiveSourceSet (); 00119 phLiveObject *getLiveSourceInput (); 00120 virtual int setLiveSourceInput ( phLiveObject *img ); 00121 00122 /* not virtual; these are convenience methods. 00123 * One should overload setLiveSourceInput */ 00124 int setInput ( phLiveObject *input ); 00125 int setLiveInput( phLiveObject *input ); 00126 }; 00127 00128 #endif /* _PHDISPLAYINTERFACE_H */
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |