win32_graphics.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * win32_graphics.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: b3cbd95430a036203912426564340dd6feed6ff7 $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *          Olivier Teulière <ipkiss@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef WIN32_GRAPHICS_HPP
00026 #define WIN32_GRAPHICS_HPP
00027 
00028 #include "../src/os_graphics.hpp"
00029 #include <windows.h>
00030 
00031 
00032 class GenericBitmap;
00033 
00034 /// Win32 implementation of OSGraphics
00035 class Win32Graphics: public OSGraphics
00036 {
00037 public:
00038     Win32Graphics( intf_thread_t *pIntf, int width, int height );
00039     virtual ~Win32Graphics();
00040 
00041     /// Clear the graphics
00042     virtual void clear( int xDest = 0, int yDest = 0,
00043                         int width = -1, int height = -1 );
00044 
00045     /// Render a bitmap on this graphics
00046     virtual void drawBitmap( const GenericBitmap &rBitmap, int xSrc = 0,
00047                              int ySrc = 0, int xDest = 0, int yDest = 0,
00048                              int width = -1, int height = -1,
00049                              bool blend = false );
00050 
00051     /// Draw another graphics on this one
00052     virtual void drawGraphics( const OSGraphics &rGraphics, int xSrc = 0,
00053                                int ySrc = 0, int xDest = 0, int yDest = 0,
00054                                int width = -1, int height = -1 );
00055 
00056     /// Draw an empty rectangle on the grahics (color is #RRGGBB)
00057     virtual void drawRect( int left, int top, int width, int height,
00058                            uint32_t color );
00059 
00060 
00061     /// Draw a filled rectangle on the grahics (color is #RRGGBB)
00062     virtual void fillRect( int left, int top, int width, int height,
00063                            uint32_t color );
00064 
00065     /// Set the shape of a window with the mask of this graphics.
00066     virtual void applyMaskToWindow( OSWindow &rWindow );
00067 
00068     /// Copy the graphics on a window
00069     virtual void copyToWindow( OSWindow &rWindow, int xSrc,
00070                                int ySrc, int width, int height,
00071                                int xDest, int yDest );
00072 
00073     /// Tell whether the pixel at the given position is visible
00074     virtual bool hit( int x, int y ) const;
00075 
00076     /// Getters for the size
00077     virtual int getWidth() const { return m_width; }
00078     virtual int getHeight() const { return m_height; }
00079 
00080     /// Get the device context handler
00081     virtual HDC getDC() const { return m_hDC; }
00082 
00083     /// Get the mask
00084     virtual HRGN getMask() const { return m_mask; }
00085 
00086 private:
00087     /// Size of the image
00088     int m_width, m_height;
00089 
00090     /// Device context
00091     HDC m_hDC;
00092 
00093     /// Transparency mask
00094     HRGN m_mask;
00095 
00096     /// Add a segment in a region
00097     void addSegmentInRegion( HRGN &rMask, int start, int end, int line );
00098 };
00099 
00100 
00101 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6