]> git.sesse.net Git - vlc/blob - modules/gui/skins2/win32/win32_graphics.hpp
Merge branch 'master' into lpcm_encoder
[vlc] / modules / gui / skins2 / win32 / win32_graphics.hpp
1 /*****************************************************************************
2  * win32_graphics.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef WIN32_GRAPHICS_HPP
26 #define WIN32_GRAPHICS_HPP
27
28 #include "../src/os_graphics.hpp"
29 #include <windows.h>
30
31
32 class GenericBitmap;
33
34 /// Win32 implementation of OSGraphics
35 class Win32Graphics: public OSGraphics
36 {
37 public:
38     Win32Graphics( intf_thread_t *pIntf, int width, int height );
39     virtual ~Win32Graphics();
40
41     /// Clear the graphics
42     virtual void clear( int xDest = 0, int yDest = 0,
43                         int width = -1, int height = -1 );
44
45     /// Render a bitmap on this graphics
46     virtual void drawBitmap( const GenericBitmap &rBitmap, int xSrc = 0,
47                              int ySrc = 0, int xDest = 0, int yDest = 0,
48                              int width = -1, int height = -1,
49                              bool blend = false );
50
51     /// Draw another graphics on this one
52     virtual void drawGraphics( const OSGraphics &rGraphics, int xSrc = 0,
53                                int ySrc = 0, int xDest = 0, int yDest = 0,
54                                int width = -1, int height = -1 );
55
56     /// Draw an empty rectangle on the grahics (color is #RRGGBB)
57     virtual void drawRect( int left, int top, int width, int height,
58                            uint32_t color );
59
60
61     /// Draw a filled rectangle on the grahics (color is #RRGGBB)
62     virtual void fillRect( int left, int top, int width, int height,
63                            uint32_t color );
64
65     /// Set the shape of a window with the mask of this graphics.
66     virtual void applyMaskToWindow( OSWindow &rWindow );
67
68     /// Copy the graphics on a window
69     virtual void copyToWindow( OSWindow &rWindow, int xSrc,
70                                int ySrc, int width, int height,
71                                int xDest, int yDest );
72
73     /// Tell whether the pixel at the given position is visible
74     virtual bool hit( int x, int y ) const;
75
76     /// Getters for the size
77     virtual int getWidth() const { return m_width; }
78     virtual int getHeight() const { return m_height; }
79
80     /// Get the device context handler
81     virtual HDC getDC() const { return m_hDC; }
82
83     /// Get the mask
84     virtual HRGN getMask() const { return m_mask; }
85
86 private:
87     /// Size of the image
88     int m_width, m_height;
89
90     /// Device context
91     HDC m_hDC;
92
93     /// Transparency mask
94     HRGN m_mask;
95
96     /// Add a segment in a region
97     void addSegmentInRegion( HRGN &rMask, int start, int end, int line );
98 };
99
100
101 #endif