x11_graphics.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * x11_graphics.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: 63881d38a585298e35f419885832488f515436a6 $
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 X11_GRAPHICS_HPP
00026 #define X11_GRAPHICS_HPP
00027 
00028 #include <X11/Xlib.h>
00029 #include <X11/Xutil.h>
00030 
00031 #include "../src/os_graphics.hpp"
00032 
00033 class X11Display;
00034 class GenericWindow;
00035 class GenericBitmap;
00036 
00037 /// X11 implementation of OSGraphics
00038 class X11Graphics: public OSGraphics
00039 {
00040 public:
00041     X11Graphics( intf_thread_t *pIntf, X11Display &rDisplay, int width,
00042                  int height);
00043 
00044     virtual ~X11Graphics();
00045 
00046     /// Clear the graphics
00047     virtual void clear( int xDest = 0, int yDest = 0,
00048                         int width = -1, int height = -1 );
00049 
00050     /// Draw another graphics on this one
00051     virtual void drawGraphics( const OSGraphics &rGraphics, int xSrc = 0,
00052                                int ySrc = 0, int xDest = 0, int yDest = 0,
00053                                int width = -1, int height = -1 );
00054 
00055     /// Render a bitmap on this graphics
00056     virtual void drawBitmap( const GenericBitmap &rBitmap, int xSrc = 0,
00057                              int ySrc = 0, int xDest = 0, int yDest = 0,
00058                              int width = -1, int height = -1,
00059                              bool blend = false );
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     /// Draw an empty rectangle on the grahics (color is #RRGGBB)
00066     virtual void drawRect( int left, int top, int width, int height,
00067                            uint32_t color );
00068 
00069     /// Set the shape of a window with the mask of this graphics.
00070     virtual void applyMaskToWindow( OSWindow &rWindow );
00071 
00072     /// Copy the graphics on a window
00073     virtual void copyToWindow( OSWindow &rWindow, int xSrc,
00074                                int ySrc, int width, int height,
00075                                int xDest, int yDest );
00076 
00077     /// Tell whether the pixel at the given position is visible
00078     virtual bool hit( int x, int y ) const;
00079 
00080     /// Getters
00081     virtual int getWidth() const { return m_width; }
00082     virtual int getHeight() const { return m_height; }
00083 
00084     /// Get the pixmap ID
00085     Pixmap getDrawable() const { return m_pixmap; }
00086     /// Get the transparency mask
00087     Region getMask() const { return m_mask; }
00088 
00089 private:
00090     /// X11 display
00091     X11Display &m_rDisplay;
00092     /// Size of the image
00093     int m_width, m_height;
00094     /// Pixmap
00095     Pixmap m_pixmap;
00096     /// Transparency mask
00097     Region m_mask;
00098     /// Graphics context
00099     GC m_gc;
00100 
00101     /// Add an horizontal segment in a region
00102     void addHSegmentInRegion( Region &rMask, int xStart, int xEnd, int y );
00103     /// Add a vertical segment in a region
00104     void addVSegmentInRegion( Region &rMask, int yStart, int yEnd, int x );
00105 };
00106 
00107 
00108 #endif

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