Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phImageWindow.h

Go to the documentation of this file.
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 _PHIMAGEWINDOW_H
00027 #define _PHIMAGEWINDOW_H
00028 
00029 /* These 2 headers must be before phX11Util.h because phX11Util.h has
00030  * Xlib headers that define Status and conflict with a field in a windows
00031  * w32api header file */
00032 #include <phMutex.h>
00033 #include <phTimeInterval.h>
00034 #include <phImage.h>
00035 #include <phThread.h>
00036 #include <ImageGfx.h>
00037 
00038 /* ------------------------------------------------------------------------- */
00065 PHAPI(class) phImageWindow : public phThread
00066 {
00067 protected:
00068     phTimeInterval  m_timer;
00069     int32_t         m_frames;
00070     float           m_fps;
00071 
00072     uint32_t    m_min_width;
00073     uint32_t    m_min_height;
00074 
00075     int32_t     m_x;
00076     int32_t     m_y;
00077     uint32_t    m_w;
00078     uint32_t    m_h;
00079     
00080     phImage     m_image;
00081 
00082     uint32_t    m_formats;
00083     
00084     char       *m_title;
00085     uint32_t    m_title_size;
00086 
00087     /* Overload these for system/API/GUI specific implementations */
00088     /* Whether or not these need to be implemented or not, they have
00089      * to be overloaded because they are pure virtual functions */
00090     virtual int private_show() = 0;
00091     virtual int private_hide() = 0;
00092 
00093     virtual int private_redraw  ()                                = 0;
00094     virtual int private_update  ()                                = 0;
00095     virtual int private_resize  ( uint32_t w,     uint32_t h    ) = 0;
00096     virtual int private_move    ( int32_t  x,     int32_t  y    ) = 0;
00097     virtual int private_minsize ( uint32_t min_w, uint32_t min_h) = 0;
00098 
00099     int tickFrame();
00100 
00101 public:
00102     phImageWindow( int32_t  x, int32_t  y,
00103                    uint32_t w, uint32_t h,
00104                    char    *title,
00105                    uint32_t flags = phNOFLAG );
00106     virtual ~phImageWindow();
00107 
00108     virtual void show();
00109     virtual void hide();
00110 
00111     virtual int redraw  ();
00112     virtual int update  ();
00113     virtual int resize  ( uint32_t w, uint32_t h );
00114     virtual int move    ( int32_t x,  int32_t  y );
00115     
00116     /* Must overload this too, usually return this->isRunning() 
00117      * is sufficient */
00118     virtual int isOpen() = 0;
00119 
00120     const char *getTitle();
00121     virtual int setTitle(const char *title);
00122 
00123     /* setMinSize (and all overloaded versions) should return 1 if the
00124      * image had to be resized to preserve an unresized window's minimum
00125      * dimensions to fit the window. This will allow the calling function
00126      * to make a smart decision which will prevent double refreshing */
00127     virtual int         setMinSize  ( const phUSize &s );
00128     virtual int         setMinSize  ( uint32_t w, uint32_t h );
00129     virtual phUSize     getMinSize  ();
00130     
00131     virtual uint32_t    getWidth    ();
00132     virtual uint32_t    getHeight   ();
00133     virtual phUSize     getSize     ();
00134 
00135     virtual int32_t     getX        ();
00136     virtual int32_t     getY        ();
00137     virtual phPoint     getLocation ();
00138     
00139     virtual phImage    *getImage    ();
00140  
00141     /* setFormats is not implemented for all ImageWindows */
00142     virtual int setFormats( uint32_t formats );
00143     uint32_t    getFormats();
00144 
00145     float getFps();
00146 };
00147 
00148 #endif /* _PHIMAGEWINDOW_H */




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:02 2007 for phission by  doxygen 1.4.4