1 /*****************************************************************************
2  * os_graphics.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id: c8cf28f998fd506da6ddeb03411b8a614b955b3c $
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 OS_GRAPHICS_HPP
26 #define OS_GRAPHICS_HPP
27 
28 #include "skin_common.hpp"
29 #include "../utils/position.hpp"
30 #include "../utils/pointer.hpp"
31 
32 class GenericBitmap;
33 class OSWindow;
34 
35 
36 /// OS specific graphics class
37 class OSGraphics: public SkinObject, public Box
38 {
39 public:
~OSGraphics()40     virtual ~OSGraphics() { }
41 
42     /// Clear the graphics
43     virtual void clear( int xDest = 0, int yDest = 0,
44                         int width = -1, int height = -1) = 0;
45 
46     /// Draw another graphics on this one
47     virtual void drawGraphics( const OSGraphics &rGraphics, int xSrc = 0,
48                                int ySrc = 0, int xDest = 0, int yDest = 0,
49                                int width = -1, int height = -1 ) = 0;
50 
51     /// Render a bitmap on this graphics
52     virtual void drawBitmap( const GenericBitmap &rBitmap, int xSrc = 0,
53                              int ySrc = 0, int xDest = 0, int yDest = 0,
54                              int width = -1, int height = -1,
55                              bool blend = false) = 0;
56 
57     /// Draw a filled rectangle on the grahics (color is #RRGGBB)
58     virtual void fillRect( int left, int top, int width, int height,
59                            uint32_t color ) = 0;
60 
61     /// Draw an empty rectangle on the grahics (color is #RRGGBB)
62     virtual void drawRect( int left, int top, int width, int height,
63                            uint32_t color ) = 0;
64 
65 
66     /// Set the shape of a window with the mask of this graphics.
67     virtual void applyMaskToWindow( OSWindow &rWindow ) = 0;
68 
69     /// Copy the graphics on a window
70     virtual void copyToWindow( OSWindow &rWindow, int xSrc,
71                                int ySrc, int width, int height,
72                                int xDest, int yDest ) = 0;
73 
74     /// Tell whether the pixel at the given position is visible
75     virtual bool hit( int x, int y ) const = 0;
76 
77 protected:
OSGraphics(intf_thread_t * pIntf)78     OSGraphics( intf_thread_t *pIntf ): SkinObject( pIntf ) { }
79 };
80 
81 typedef CountedPtr<OSGraphics> OSGraphicsPtr;
82 
83 #endif
84