1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
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
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifndef X11_GRAPHICS_HPP
26 #define X11_GRAPHICS_HPP
29 #include <X11/Xutil.h>
31 #include "../src/os_graphics.hpp"
37 /// X11 implementation of OSGraphics
38 class X11Graphics: public OSGraphics
41 X11Graphics( intf_thread_t *pIntf, X11Display &rDisplay, int width,
44 virtual ~X11Graphics();
46 /// Clear the graphics
49 /// Draw another graphics on this one
50 virtual void drawGraphics( const OSGraphics &rGraphics, int xSrc = 0,
51 int ySrc = 0, int xDest = 0, int yDest = 0,
52 int width = -1, int height = -1 );
54 /// Render a bitmap on this graphics
55 virtual void drawBitmap( const GenericBitmap &rBitmap, int xSrc = 0,
56 int ySrc = 0, int xDest = 0, int yDest = 0,
57 int width = -1, int height = -1,
60 /// Draw a filled rectangle on the grahics (color is #RRGGBB)
61 virtual void fillRect( int left, int top, int width, int height,
64 /// Draw an empty rectangle on the grahics (color is #RRGGBB)
65 virtual void drawRect( int left, int top, int width, int height,
68 /// Set the shape of a window with the mask of this graphics.
69 virtual void applyMaskToWindow( OSWindow &rWindow );
71 /// Copy the graphics on a window
72 virtual void copyToWindow( OSWindow &rWindow, int xSrc,
73 int ySrc, int width, int height,
74 int xDest, int yDest );
76 /// Tell whether the pixel at the given position is visible
77 virtual bool hit( int x, int y ) const;
80 virtual int getWidth() const { return m_width; }
81 virtual int getHeight() const { return m_height; }
84 Pixmap getDrawable() const { return m_pixmap; }
85 /// Get the transparency mask
86 Region getMask() const { return m_mask; }
90 X11Display &m_rDisplay;
92 int m_width, m_height;
100 /// Add an horizontal segment in a region
101 void addHSegmentInRegion( Region &rMask, int xStart,
103 /// Add a vertical segment in a region
104 void addVSegmentInRegion( Region &rMask, int yStart,