]> Dogcows Code - chaz/openbox/blob - otk/truerendercontrol.hh
b44969aa2ff0489dbf43251c489d12d778a33e38
[chaz/openbox] / otk / truerendercontrol.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __truerendercontrol_hh
3 #define __truerendercontrol_hh
4
5 #include "rendercontrol.hh"
6
7 extern "C" {
8
9 #ifdef HAVE_STDINT_H
10 # include <stdint.h>
11 #else
12 # ifdef HAVE_SYS_TYPES_H
13 # include <sys/types.h>
14 # endif
15 #endif
16
17 }
18
19 #include <vector>
20
21 namespace otk {
22
23 #ifdef HAVE_STDINT_H
24 typedef uint32_t pixel32;
25 typedef uint16_t pixel16;
26 #else
27 typedef u_int32_t pixel32;
28 typedef u_int16_t pixel16;
29 #endif /* HAVE_STDINT_H */
30
31 #ifdef WORDS_BIGENDIAN
32 const int default_red_shift=0;
33 const int default_green_shift=8;
34 const int default_blue_shift=16;
35 const int endian=MSBFirst;
36 #else
37 const int default_red_shift=16;
38 const int default_green_shift=8;
39 const int default_blue_shift=0;
40 const int endian=LSBFirst;
41 #endif /* WORDS_BIGENDIAN */
42
43 class TrueRenderControl : public RenderControl {
44 private:
45 // the number of bits to shift a color value (from 0-255) to the right, to
46 // fit it into the the color mask (do this before the offset)
47 int _red_shift;
48 int _green_shift;
49 int _blue_shift;
50
51 // the offset of each color in a color mask
52 int _red_offset;
53 int _green_offset;
54 int _blue_offset;
55
56 public:
57 TrueRenderControl(int screen);
58 virtual ~TrueRenderControl();
59
60 virtual void drawBackground(Surface& sf, const RenderTexture &texture) const;
61 virtual void drawGradientBackground(Surface &sf,
62 const RenderTexture &texture) const;
63
64 inline void highlight(pixel32 *x, pixel32 *y, bool raised) const;
65 void reduceDepth(XImage *im, pixel32 *data) const;
66 void verticalGradient(Surface &sf, const RenderTexture &texture,
67 pixel32 *data) const;
68 void diagonalGradient(Surface &sf, const RenderTexture &texture,
69 pixel32 *data) const;
70 void crossDiagonalGradient(Surface &sf, const RenderTexture &texture,
71 pixel32 *data) const;
72 };
73
74 }
75
76 #endif // __truerendercontrol_hh
This page took 0.03459 seconds and 4 git commands to generate.