]> Dogcows Code - chaz/openbox/blob - otk/surface.hh
store the pixel32 data in the surface so it can be reused
[chaz/openbox] / otk / surface.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __surface_hh
3 #define __surface_hh
4
5 #include "size.hh"
6
7 extern "C" {
8 #include <X11/Xlib.h>
9 #define _XFT_NO_COMPAT_ // no Xft 1 API
10 #include <X11/Xft/Xft.h>
11
12 #ifdef HAVE_STDINT_H
13 # include <stdint.h>
14 #else
15 # ifdef HAVE_SYS_TYPES_H
16 # include <sys/types.h>
17 # endif
18 #endif
19 }
20
21 namespace otk {
22
23 class ScreenInfo;
24 class RenderColor;
25 class RenderControl;
26 class TrueRenderControl;
27 class PseudoRenderControl;
28
29 #ifdef HAVE_STDINT_H
30 typedef uint32_t pixel32;
31 typedef uint16_t pixel16;
32 #else
33 typedef u_int32_t pixel32;
34 typedef u_int16_t pixel16;
35 #endif /* HAVE_STDINT_H */
36
37 class Surface {
38 int _screen;
39 Size _size;
40 pixel32 *_pixel_data;
41 Pixmap _pixmap;
42 XftDraw *_xftdraw;
43
44 protected:
45 void createObjects();
46 void destroyObjects();
47
48 void setPixmap(XImage *image);
49 void setPixmap(const RenderColor &color);
50
51 public:
52 Surface(int screen, const Size &size);
53 virtual ~Surface();
54
55 inline int screen(void) const { return _screen; }
56
57 const Size& size() const { return _size; }
58
59 Pixmap pixmap() const { return _pixmap; }
60
61 pixel32 *pixelData() { return _pixel_data; }
62
63 // The RenderControl classes use the internal objects in this class to render
64 // to it. Noone else needs them tho, so they are private.
65 friend class RenderControl;
66 friend class TrueRenderControl;
67 friend class PseudoRenderControl;
68 };
69
70 }
71
72 #endif // __surface_hh
This page took 0.045414 seconds and 5 git commands to generate.