]> icculus.org git repositories - dana/openbox.git/blob - otk/rendercontrol.hh
store the pixel32 data in the surface so it can be reused
[dana/openbox.git] / otk / rendercontrol.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __rendercontrol_hh
3 #define __rendercontrol_hh
4
5 extern "C" {
6 #include <X11/Xlib.h>
7 #include <X11/Xutil.h>
8 }
9
10 #include "surface.hh"
11
12 namespace otk {
13
14 class ScreenInfo;
15 class RenderTexture;
16 class Font;
17 class RenderColor;
18 class ustring;
19
20 class RenderControl {
21 protected:
22   int _screen;
23
24   /*
25   // color tables, meaning, 256 (possibly) different shades of each color,
26   // based on the number of bits there are available for each color in the
27   // visual
28   unsigned char _red_color_table[256];
29   unsigned char _green_color_table[256];
30   unsigned char _blue_color_table[256];
31   */
32
33 /*
34   Bool _dither;
35
36   int _cpc; // colors-per-channel: must be a value between [2,6]
37   int _bpp; // bits-per-pixel
38
39   unsigned int *_grad_xbuffer;
40   unsigned int *_grad_ybuffer;
41   unsigned int _grad_buffer_width;
42   unsigned int _grad_buffer_height;
43
44   unsigned long *_sqrt_table;
45
46   // These values are all determined based on a visual
47
48   int _red_bits;    // the number of bits (1-255) that each shade of color
49   int _green_bits;  // spans across. best case is 1, which gives 255 shades.
50   int _blue_bits;
51   unsigned char _red_color_table[256];
52   unsigned char _green_color_table[256];
53   unsigned char _blue_color_table[256];
54
55   // These are only used for TrueColor visuals
56   int _red_offset;  // the offset of each color in a color mask
57   int _green_offset;
58   int _blue_offset;
59
60   // These are only used for !TrueColor visuals
61   XColor *_colors;
62   int _ncolors;
63 */
64
65   RenderControl(int screen);
66
67   virtual void drawSolidBackground(Surface& sf,
68                                    const RenderTexture& texture) const;
69   
70 public:
71   virtual ~RenderControl();
72
73   static RenderControl *getRenderControl(int screen);
74
75   virtual void drawRoot(const RenderColor &color) const;
76   
77   //! Draws a string onto a Surface
78   virtual void drawString(Surface &sf, const Font &font, int x, int y,
79                           const RenderColor &color,
80                           const ustring &string) const;
81
82   //! Draws a background onto a Surface, as specified by a RenderTexture
83   virtual void drawBackground(Surface &sf,
84                               const RenderTexture &texture) const = 0;
85 };
86
87 }
88
89 #endif // __rendercontrol_hh