]> icculus.org git repositories - dana/openbox.git/blob - otk/rendercontrol.hh
8bpp pseudo color. it's horrid code. the graphics are horrid.
[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 class PixmapMask;
20
21 class RenderControl {
22 protected:
23   int _screen;
24
25 //  bool _dither;
26
27   RenderControl(int screen);
28
29   virtual void reduceDepth(Surface &sf, XImage *im) const = 0;
30   
31   inline void highlight(pixel32 *x, pixel32 *y, bool raised) const;
32   void verticalGradient(Surface &sf, const RenderTexture &texture) const;
33   void diagonalGradient(Surface &sf, const RenderTexture &texture) const;
34   void crossDiagonalGradient(Surface &sf, const RenderTexture &texture) const;
35   virtual void drawGradientBackground(Surface &sf,
36                                       const RenderTexture &texture) const;
37   virtual void drawSolidBackground(Surface& sf,
38                                    const RenderTexture& texture) const;
39
40 public:
41   virtual ~RenderControl();
42
43   static RenderControl *getRenderControl(int screen);
44
45   virtual void drawRoot(const RenderColor &color) const;
46   
47   //! Draws a background onto a Surface, as specified by a RenderTexture
48   /*!
49     This function will overwrite the entire surface.
50   */
51   virtual void drawBackground(Surface &sf,
52                               const RenderTexture &texture) const;
53
54   //! Draws an image onto the surface
55   /*!
56     This function will overwrite the entire surface.<br>
57     The image must be specified in 32-bit packed ARGB format. The current
58     background will be used for applying the alpha.
59   */
60   virtual void drawImage(Surface &sf, int w, int h,
61                          unsigned long *data) const;
62   
63   //! Draws a string onto a Surface
64   virtual void drawString(Surface &sf, const Font &font, int x, int y,
65                           const RenderColor &color,
66                           const ustring &string) const;
67
68   //! Draws a PixmapMask with a specified color onto a Surface
69   virtual void drawMask(Surface &sf, const RenderColor &color,
70                         const PixmapMask &mask) const;
71 };
72
73 }
74
75 #endif // __rendercontrol_hh