xlib_surface.h

Go to the documentation of this file.
00001 /* Copyright (C) 2005 The cairomm Development Team
00002  *
00003  * This library is free software; you can redistribute it and/or
00004  * modify it under the terms of the GNU Library General Public
00005  * License as published by the Free Software Foundation; either
00006  * version 2 of the License, or (at your option) any later version.
00007  *
00008  * This library is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * Library General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Library General Public
00014  * License along with this library; if not, write to the Free Software
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00016  * 02110-1301, USA.
00017  */
00018 
00019 #ifndef __CAIROMM_XLIB_SURFACE_H
00020 #define __CAIROMM_XLIB_SURFACE_H
00021 
00022 #include <cairomm/surface.h>
00023 
00024 // This header is not included by cairomm.h because it requires X headers that 
00025 // tend to pollute the namespace with non-prefixed #defines and typedefs.
00026 // You may include it directly if you need to use this API.
00027 
00028 #ifdef CAIRO_HAS_XLIB_SURFACE
00029 #include <cairo-xlib.h> // Needed for the X11 "Display" struct (which pollutes the namespace because it has no prefix.)
00030 #ifdef CAIRO_HAS_XLIB_XRENDER_SURFACE
00031 #include <cairo-xlib-xrender.h> // xrender-specific API
00032 #endif // CAIRO_HAS_XLIB_XRENDER_SURFACE
00033 #endif // CAIRO_HAS_XLIB_SURFACE
00034 
00035 
00036 namespace Cairo
00037 {
00038 
00039 #ifdef CAIRO_HAS_XLIB_SURFACE
00040 
00048 class XlibSurface : public Surface
00049 {
00050 public:
00051 
00059   explicit XlibSurface(cairo_surface_t* cobject, bool has_reference = false);
00060   virtual ~XlibSurface();
00061 
00077   static RefPtr<XlibSurface> create(Display* dpy, Drawable drawable, Visual* visual, int width, int height);
00078 
00089   static RefPtr<XlibSurface> create(Display *dpy, Pixmap bitmap, Screen *screen, int width, int height);
00090 
00103   void set_size(int width, int height);
00104 
00114   void set_drawable(Drawable drawable, int width, int height);
00115 
00117   Drawable get_drawable() const;
00118 
00120   const Display* get_display() const;
00122   Display* get_display();
00123 
00125   Screen* get_screen();
00127   const Screen* get_screen() const;
00128 
00130   Visual* get_visual();
00132   const Visual* get_visual() const;
00133 
00135   int get_depth() const;
00136 
00138   int get_height() const;
00139 
00141   int get_width() const;
00142 
00143 #if CAIRO_HAS_XLIB_XRENDER_SURFACE
00144 
00162   static Cairo::RefPtr<Cairo::XlibSurface> 
00163   create_with_xrender_format (Display *dpy,
00164                               Drawable drawable,
00165                               Screen *screen,
00166                               XRenderPictFormat *format,
00167                               int width,
00168                               int height);
00169 
00182   XRenderPictFormat * get_xrender_format() const;
00183 
00184 #endif // CAIRO_HAS_XLIB_XRENDER_SURFACE
00185 
00186 };
00187 
00188 #endif // CAIRO_HAS_XLIB_SURFACE
00189 
00190 } // namespace Cairo
00191 
00192 #endif //__CAIROMM_XLIB_SURFACE_H
00193 
00194 // vim: ts=2 sw=2 et

Generated on Thu Sep 4 21:57:13 2008 for cairomm by  doxygen 1.5.5