Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

win32.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2002 Xavier Trochu
00003 
00004 This software is provided 'as-is', without any express or implied warranty. In no event
00005 will the authors be held liable for any damages arising from the use of this software.
00006 
00007 Permission is granted to anyone to use this software for any purpose, including commercial
00008 applications, and to alter it and redistribute it freely, subject to the following
00009 restrictions:
00010 
00011 1. The origin of this software must not be misrepresented; you must not claim that you
00012    wrote the original software. If you use this software in a product, an acknowledgment
00013    in the product documentation would be appreciated but is not required.
00014 
00015 2. Altered source versions must be plainly marked as such, and must not be misrepresented 
00016    as being the original software.
00017 
00018 3. This notice may not be removed or altered from any source distribution.
00019 */
00020 #ifndef __WIN32_H_
00021 #define __WIN32_H_
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026 
00027 #ifdef DEBUG
00028 # ifndef NO_DEBUG_WIN32
00029 #  define DEBUG_WIN32
00030 # endif
00031 #else
00032 # ifdef DEBUG_WIN32
00033 #  error DEBUG_WIN32 defined without DEBUG
00034 # endif
00035 #endif
00036 
00037 #include <exception>
00038 #include <string>
00039 #include <windows.h> // for BITMAPINFO, ...
00040 
00041 #include "brenderer.h"
00042 
00048 class bitmap_renderer : public base_renderer {
00049 private:
00050     int _padding;           
00051     BITMAPINFO * _bmi;      
00052 public:
00053     static const int HEADER_SIZE = sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD);
00054 protected:
00055     const BITMAPINFO * get_bmi() const throw() { return _bmi; }
00056 public:
00057     bitmap_renderer() throw(std::exception);
00058     virtual ~bitmap_renderer() throw();
00059     virtual bool init_frame(const point & size) throw(std::exception);
00060     bool set_palette(const palette & pal) throw();
00061 
00062     virtual void dump(char * data, int size) throw(std::exception) = 0;
00063     void save(int f=-1) throw(std::exception);
00064 };
00065 
00069 class bitmap_file_renderer : public bitmap_renderer {
00070 private:
00071     std::string _name;          
00072     BITMAPFILEHEADER _bfi;      
00073 public:
00074     bitmap_file_renderer(const std::string & name) throw();
00075     virtual ~bitmap_file_renderer() throw() {};
00076     bool init_frame(const point & size) throw();
00077     void dump(char * data, int size) throw(std::exception);
00078     bool wait(int ms) throw() { return true; };
00079     //~ bool start_decode(int version, int nbframe) throw() { return true; }
00080     bool save_current() throw();
00081 };
00082 
00083 class ds_wave_out;
00084 
00088 class window_renderer : public bitmap_renderer {
00089 private:
00090     HWND _hwnd;         
00091     char * _bitmap;         
00092     int _size;              
00093     int _clock;             
00094     HANDLE _hThread;        
00095     HANDLE _hEvent;         
00096     HANDLE _hMutex;         
00097     ds_wave_out * _out;     
00098 
00099 static LRESULT WINAPI windowProc(HWND, UINT, WPARAM, LPARAM);
00100 static DWORD CALLBACK threadProc(void *);
00101 public:
00102     window_renderer() throw(std::exception);
00103     virtual ~window_renderer() throw();
00104     bool init_frame(const point & size) throw(std::exception);
00105     void dump(char * data, int size) throw(std::exception);
00106     bool wait(int ms) throw();
00107     //~ bool start_decode(int, int) throw() { return true; };
00108     void clean() throw();
00109     virtual sound_renderer * get_sound_renderer() throw(std::exception);
00110 };
00111 
00112 #endif

Generated on Fri Aug 9 22:54:30 2002 for san_player by doxygen1.2.16