image_mesaoutput.h

Go to the documentation of this file.
00001 #ifndef MESAOUTPUT_H
00002 #define MESAOUTPUT_H
00003 
00004 #include "mimasconfig.h"
00005 
00006 #ifdef HAVE_OPENGL
00007 
00008 #include <map>
00009 #include "image.h"
00010 #include "image_output.h"
00011 #include "rgba.h"
00012 #include "timer.h"
00013 #include "x11_display.h"
00014 #include "x11_window.h"
00015 
00016 namespace mimas {
00017 
00057 template< typename T >
00058 class image_mesaoutput: public image_output< T >
00059 {
00060  public:
00065   image_mesaoutput( x11_display *_display,
00066         int _width = 32, int _height = 32 );
00068   virtual void write( const const_image_ref< T > &image );
00070   static std::map< Window, image_mesaoutput< T > * > windows;
00072   void wait( int milliSeconds );
00074   void delay( int milliSeconds ) { interval = milliSeconds; }
00076   void pause(void);
00078   x11_window_ptr get_window(void) { return window; }
00079  protected:
00081   class image_window: public x11_window {
00082   public:
00084     image_window( x11_display *_display, int _width, int _height ):
00085       x11_window( _display, _width, _height ) {}
00087     void setImage( const image< T > &_img ) { img = _img; }
00088   protected:
00090     virtual void paint_event(void) throw (mimasexception);
00092     image< T > img;
00093   };
00095   boost::shared_ptr< image_window > window;
00097   timer time;
00099   int interval;
00100 };
00101 
00103 struct _wait { int milliSeconds; };
00106 inline _wait wait( int _milliSeconds )
00107 { _wait retVal; retVal.milliSeconds = _milliSeconds; return retVal; }
00108 
00110 struct _pause {};
00113 inline _pause pause(void)
00114 { _pause retVal; return retVal; }
00115 
00117 struct _delay { int milliSeconds; };
00120 inline _delay delay( int _milliSeconds )
00121 { _delay retVal; retVal.milliSeconds = _milliSeconds; return retVal; }
00122 
00124 template< typename T, typename TPtr >
00125 inline image_mesaoutput< T > &operator<<
00126   ( image_mesaoutput< T > &output, const const_image_ref< T, TPtr > &img )
00127 { output.write( img ); return output; }
00128 
00130 template< typename T >
00131 inline image_mesaoutput< T > &operator<<
00132 ( image_mesaoutput< T > &output, _wait wait )
00133 { output.wait( wait.milliSeconds ); return output; }
00134 
00136 template< typename T >
00137 inline image_mesaoutput< T > &operator<<
00138 ( image_mesaoutput< T > &output, _pause )
00139 { output.pause(); return output; }
00140 
00142 template< typename T >
00143 inline image_mesaoutput< T > &operator<<
00144 ( image_mesaoutput< T > &output, _delay delay )
00145 { output.delay( delay.milliSeconds ); return output; }
00146 
00148 inline image_mesaoutput< unsigned char > &operator<<
00149 ( image_mesaoutput< unsigned char > &output,
00150   const const_image_ref< int > &im )
00151 {
00152   output.write( image< unsigned char >( im ) );
00153   return output;
00154 }
00155 
00157 inline image_mesaoutput< unsigned char > &operator<<
00158 ( image_mesaoutput< unsigned char > &output,
00159   const const_image_ref< double > &im )
00160 {
00161   output.write(image< unsigned char >( im ) );
00162   return output;
00163 }
00164 
00166 inline image_mesaoutput< rgba< unsigned char > > &operator<<
00167 ( image_mesaoutput< rgba< unsigned char > > &output,
00168   const const_image_ref< rgba< int > > &im )
00169 {
00170   output.write( image< rgba< unsigned char > >( im ) );
00171   return output;
00172 }
00173 
00175 inline image_mesaoutput< rgba< unsigned char > > &operator<<
00176 ( image_mesaoutput< rgba< unsigned char > > &output,
00177   const const_image_ref< rgba< float > > &im )
00178 {
00179   output.write( image< rgba< unsigned char > >( im ) );
00180   return output;
00181 }
00182 
00184 inline image_mesaoutput< rgba< unsigned char > > &operator<<
00185 ( image_mesaoutput< rgba< unsigned char > > &output,
00186   const const_image_ref< rgba< double > > &im )
00187 {
00188   output.write( image< rgba< unsigned char > >( im ) );
00189   return output;
00190 }
00191 
00192 
00194 
00196 
00197 };
00198 
00199 #include "image_mesaoutput.tcc"
00200 
00201 #endif
00202 
00203 #endif

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:17 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...