]> git.tdb.fi Git - libs/gui.git/blob - source/drawcontext.h
Bugfixes
[libs/gui.git] / source / drawcontext.h
1 /* $Id$
2
3 This file is part of libmspgbase
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GBASE_DRAWCONTEXT_H_
9 #define MSP_GBASE_DRAWCONTEXT_H_
10
11 #ifndef WIN32
12 #include <X11/Xlib.h>
13 #include <X11/extensions/XShm.h>
14 #endif
15
16 namespace Msp {
17 namespace Graphics {
18
19 class Display;
20 class Window;
21
22 class DrawContext
23 {
24 private:
25         Display &display;
26         Window &window;
27 #ifndef WIN32
28         XImage *image;
29         bool use_shm;
30         XShmSegmentInfo shminfo;
31 #endif
32
33 public:
34         DrawContext(Window &);
35         ~DrawContext();
36
37         Window &get_window() const { return window; }
38         unsigned get_depth() const { return image->bits_per_pixel; }
39         unsigned char *get_data() { return reinterpret_cast<unsigned char *>(image->data); }
40         void update();
41 };
42
43 } // namespace Graphics
44 } // namespace Msp
45
46 #endif