skins2: add OS/2 support
[vlc.git] / modules / gui / skins2 / os2 / os2_graphics.hpp
blobdfe775fc50ab6e5669fde1ab1e3ae0b74ae7b4f9
1 /*****************************************************************************
2 * os2_graphics.hpp
3 *****************************************************************************
4 * Copyright (C) 2003, 2013 the VideoLAN team
6 * Authors: Cyril Deguet <asmax@via.ecp.fr>
7 * Olivier Teulière <ipkiss@via.ecp.fr>
8 * KO Myung-Hun <komh@chollian.net>
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.
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.
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 *****************************************************************************/
25 #ifndef OS2_GRAPHICS_HPP
26 #define OS2_GRAPHICS_HPP
28 #include "../src/os_graphics.hpp"
31 class GenericBitmap;
33 /// OS2 implementation of OSGraphics
34 class OS2Graphics: public OSGraphics
36 public:
37 OS2Graphics( intf_thread_t *pIntf, int width, int height );
38 virtual ~OS2Graphics();
40 /// Clear the graphics
41 virtual void clear( int xDest = 0, int yDest = 0,
42 int width = -1, int height = -1 );
44 /// Render a bitmap on this graphics
45 virtual void drawBitmap( const GenericBitmap &rBitmap, int xSrc = 0,
46 int ySrc = 0, int xDest = 0, int yDest = 0,
47 int width = -1, int height = -1,
48 bool blend = false );
50 /// Draw another graphics on this one
51 virtual void drawGraphics( const OSGraphics &rGraphics, int xSrc = 0,
52 int ySrc = 0, int xDest = 0, int yDest = 0,
53 int width = -1, int height = -1 );
55 /// Draw an empty rectangle on the grahics (color is #RRGGBB)
56 virtual void drawRect( int left, int top, int width, int height,
57 uint32_t color );
60 /// Draw a filled rectangle on the grahics (color is #RRGGBB)
61 virtual void fillRect( int left, int top, int width, int height,
62 uint32_t color );
64 /// Set the shape of a window with the mask of this graphics.
65 virtual void applyMaskToWindow( OSWindow &rWindow );
67 /// Copy the graphics on a window
68 virtual void copyToWindow( OSWindow &rWindow, int xSrc,
69 int ySrc, int width, int height,
70 int xDest, int yDest );
72 /// Tell whether the pixel at the given position is visible
73 virtual bool hit( int x, int y ) const;
75 /// Getters for the size
76 virtual int getWidth() const { return m_width; }
77 virtual int getHeight() const { return m_height; }
79 /// Get the device context handler
80 virtual HDC getPS() const { return m_hps; }
82 /// Get the mask
83 virtual HRGN getMask() const { return m_mask; }
85 private:
86 /// Size of the image
87 int m_width, m_height;
89 /// Device context
90 HDC m_hdc;
92 /// Presentaiton space
93 HPS m_hps;
95 /// Bitmap handle
96 HBITMAP m_hbm;
98 /// Transparency mask
99 HRGN m_mask;
101 /// Add a segment in a region
102 void addSegmentInRegion( HRGN &rMask, int start, int end, int line,
103 int height );
105 /// check boundaries for graphics and bitmaps
106 bool checkBoundaries( int x_src, int y_src, int w_src, int h_src,
107 int& x_target, int& y_target,
108 int& w_target, int& h_target );
110 /// invert Y of a point against the given height
111 int invertPointY( int y, int height ) const
113 return ( height - 1 ) - y;
116 /// invert Y of a point against the m_height
117 int invertPointY( int y ) const
119 return ( m_height - 1 ) - y;
122 /// invert Y of a rectangular against the given height
123 int invertRectY( int y, int height ) const
125 // bottom is inclusive, top is exclusive
126 // the following is the short of ( height - 1 ) - ( y - 1 )
127 return height - y;
130 /// invert Y of a rectangular against the m_height
131 int invertRectY( int y ) const
133 // bottom is inclusive, top is exclusive
134 // the following is the short of ( m_height - 1 ) - ( y - 1 )
135 return m_height - y;
140 #endif