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$
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
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 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();
00048 
00049         /// Draw another graphics on this one
00050         virtual void drawGraphics( const OSGraphics &rGraphics, int xSrc = 0,
00051                                    int ySrc = 0, int xDest = 0, int yDest = 0,
00052                                    int width = -1, int height = -1 );
00053 
00054         /// Render a bitmap on this graphics
00055         virtual void drawBitmap( const GenericBitmap &rBitmap, int xSrc = 0,
00056                                  int ySrc = 0, int xDest = 0, int yDest = 0,
00057                                  int width = -1, int height = -1,
00058                                  bool blend = false );
00059 
00060         /// Draw a filled rectangle on the grahics (color is #RRGGBB)
00061         virtual void fillRect( int left, int top, int width, int height,
00062                                uint32_t color );
00063 
00064         /// Draw an empty rectangle on the grahics (color is #RRGGBB)
00065         virtual void drawRect( int left, int top, int width, int height,
00066                                uint32_t color );
00067 
00068         /// Set the shape of a window with the mask of this graphics.
00069         virtual void applyMaskToWindow( OSWindow &rWindow );
00070 
00071         /// Copy the graphics on a window
00072         virtual void copyToWindow( OSWindow &rWindow, int xSrc,
00073                                    int ySrc, int width, int height,
00074                                    int xDest, int yDest );
00075 
00076         /// Tell whether the pixel at the given position is visible
00077         virtual bool hit( int x, int y ) const;
00078 
00079         /// Getters
00080         virtual int getWidth() const { return m_width; }
00081         virtual int getHeight() const { return m_height; }
00082 
00083         /// Get the pixmap ID
00084         Pixmap getDrawable() const { return m_pixmap; }
00085         /// Get the transparency mask
00086         Region getMask() const { return m_mask; }
00087 
00088     private:
00089         /// X11 display
00090         X11Display &m_rDisplay;
00091         /// Size of the image
00092         int m_width, m_height;
00093         /// Pixmap
00094         Pixmap m_pixmap;
00095         /// Transparency mask
00096         Region m_mask;
00097         /// Graphics context
00098         GC m_gc;
00099 
00100         /// Add an horizontal segment in a region
00101         void addHSegmentInRegion( Region &rMask, int xStart,
00102                                                int xEnd, int y );
00103         /// Add a vertical segment in a region
00104         void addVSegmentInRegion( Region &rMask, int yStart,
00105                                                int yEnd, int x );
00106 };
00107 
00108 
00109 #endif

Generated on Wed Aug 13 08:02:38 2008 for VLC by  doxygen 1.5.1