00001 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- 00002 #ifndef __surface_hh 00003 #define __surface_hh 00004 00005 #include "point.hh" 00006 #include "truerendercontrol.hh" 00007 #include "pseudorendercontrol.hh" 00008 00009 extern "C" { 00010 #include <X11/Xlib.h> 00011 #define _XFT_NO_COMPAT_ // no Xft 1 API 00012 #include <X11/Xft/Xft.h> 00013 } 00014 00015 namespace otk { 00016 00017 class ScreenInfo; 00018 class RenderColor; 00019 00020 class Surface { 00021 int _screen; 00022 Point _size; 00023 Pixmap _pixmap; 00024 XftDraw *_xftdraw; 00025 00026 protected: 00027 void createObjects(); 00028 void destroyObjects(); 00029 00030 void setPixmap(XImage *image); 00031 void setPixmap(const RenderColor &color); 00032 00033 public: 00034 Surface(int screen, const Point &size); 00035 virtual ~Surface(); 00036 00037 inline int screen(void) const { return _screen; } 00038 00039 virtual const Point& size() const { return _size; } 00040 virtual int width() const { return _size.x(); } 00041 virtual int height() const { return _size.y(); } 00042 00043 virtual Pixmap pixmap() const { return _pixmap; } 00044 00045 // The RenderControl classes use the internal objects in this class to render 00046 // to it. Noone else needs them tho, so they are private. 00047 friend class RenderControl; 00048 friend class TrueRenderControl; 00049 friend class PseudoRenderControl; 00050 }; 00051 00052 } 00053 00054 #endif // __surface_hh