diff options
-rw-r--r-- | src/Color.hh | 59 | ||||
-rw-r--r-- | src/Texture.hh | 93 |
2 files changed, 152 insertions, 0 deletions
diff --git a/src/Color.hh b/src/Color.hh new file mode 100644 index 0000000..9c457eb --- /dev/null +++ b/src/Color.hh | |||
@@ -0,0 +1,59 @@ | |||
1 | // Color.hh for Fluxbox Window Manager | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxbox@linuxmail.org) | ||
3 | // | ||
4 | // from Image.hh for Blackbox - an X11 Window manager | ||
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | ||
6 | // | ||
7 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
8 | // copy of this software and associated documentation files (the "Software"), | ||
9 | // to deal in the Software without restriction, including without limitation | ||
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
11 | // and/or sell copies of the Software, and to permit persons to whom the | ||
12 | // Software is furnished to do so, subject to the following conditions: | ||
13 | // | ||
14 | // The above copyright notice and this permission notice shall be included in | ||
15 | // all copies or substantial portions of the Software. | ||
16 | // | ||
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
20 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
23 | // DEALINGS IN THE SOFTWARE. | ||
24 | |||
25 | // $Id: Color.hh,v 1.1 2002/07/23 16:23:15 fluxgen Exp $ | ||
26 | |||
27 | #ifndef FBTK_COLOR_HH | ||
28 | #define FBTK_COLOR_HH | ||
29 | |||
30 | namespace FbTk { | ||
31 | /** | ||
32 | Holds rgb color and pixel value | ||
33 | */ | ||
34 | class Color { | ||
35 | public: | ||
36 | Color(unsigned char red = 0, unsigned char green = 0, unsigned char blue = 0): | ||
37 | m_red(red), m_green(green), m_blue(blue), m_pixel(0), m_allocated(false) { } | ||
38 | |||
39 | inline void setAllocated(bool a) { m_allocated = a; } | ||
40 | inline void setRGB(char red, char green, char blue) { m_red = red; m_green = green; m_blue = blue; } | ||
41 | inline void setPixel(unsigned long pixel) { m_pixel = pixel; } | ||
42 | |||
43 | inline bool isAllocated() const { return m_allocated; } | ||
44 | |||
45 | inline unsigned char red() const { return m_red; } | ||
46 | inline unsigned char green() const { return m_green; } | ||
47 | inline unsigned char blue() const { return m_blue; } | ||
48 | |||
49 | inline unsigned long pixel() const { return m_pixel; } | ||
50 | |||
51 | private: | ||
52 | unsigned char m_red, m_green, m_blue; | ||
53 | unsigned long m_pixel; | ||
54 | bool m_allocated; | ||
55 | }; | ||
56 | |||
57 | }; // end namespace FbTk | ||
58 | |||
59 | #endif // FBTK_COLOR_HH | ||
diff --git a/src/Texture.hh b/src/Texture.hh new file mode 100644 index 0000000..a091fbd --- /dev/null +++ b/src/Texture.hh | |||
@@ -0,0 +1,93 @@ | |||
1 | // Texture.hh for Fluxbox Window Manager | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxbox@linuxmail.org) | ||
3 | // | ||
4 | // from Image.hh for Blackbox - an X11 Window manager | ||
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | ||
6 | // | ||
7 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
8 | // copy of this software and associated documentation files (the "Software"), | ||
9 | // to deal in the Software without restriction, including without limitation | ||
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
11 | // and/or sell copies of the Software, and to permit persons to whom the | ||
12 | // Software is furnished to do so, subject to the following conditions: | ||
13 | // | ||
14 | // The above copyright notice and this permission notice shall be included in | ||
15 | // all copies or substantial portions of the Software. | ||
16 | // | ||
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
20 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
23 | // DEALINGS IN THE SOFTWARE. | ||
24 | |||
25 | // $Id: Texture.hh,v 1.1 2002/07/23 16:23:15 fluxgen Exp $ | ||
26 | |||
27 | #ifndef FBTK_TEXTURE_HH | ||
28 | #define FBTK_TEXTURE_HH | ||
29 | |||
30 | #include "Color.hh" | ||
31 | |||
32 | namespace FbTk { | ||
33 | |||
34 | /** | ||
35 | Holds texture type and info | ||
36 | */ | ||
37 | class Texture { | ||
38 | public: | ||
39 | enum Bevel { | ||
40 | FLAT = 0x00002, | ||
41 | SUNKEN = 0x00004, | ||
42 | RAISED = 0x00008 | ||
43 | }; | ||
44 | enum Textures { | ||
45 | NONE = 0x00000, | ||
46 | SOLID = 0x00010, | ||
47 | GRADIENT = 0x00020 | ||
48 | }; | ||
49 | enum Gradients { | ||
50 | HORIZONTAL = 0x00040, | ||
51 | VERTICAL = 0x00080, | ||
52 | DIAGONAL = 0x00100, | ||
53 | CROSSDIAGONAL = 0x00200, | ||
54 | RECTANGLE = 0x00400, | ||
55 | PYRAMID = 0x00800, | ||
56 | PIPECROSS = 0x01000, | ||
57 | ELLIPTIC = 0x02000 | ||
58 | }; | ||
59 | |||
60 | enum { | ||
61 | BEVEL1 = 0x04000, | ||
62 | BEVEL2 = 0x08000, // bevel types | ||
63 | INVERT = 0x010000, //inverted image | ||
64 | PARENTRELATIVE = 0x20000, | ||
65 | INTERLACED = 0x40000 | ||
66 | }; | ||
67 | |||
68 | Texture():m_type(0) { } | ||
69 | |||
70 | inline void setType(unsigned long t) { m_type = t; } | ||
71 | inline void addType(unsigned long t) { m_type |= t; } | ||
72 | |||
73 | inline Color &color() { return m_color; } | ||
74 | inline Color &colorTo() { return m_color_to; } | ||
75 | inline Color &hiColor() { return m_hicolor; } | ||
76 | inline Color &loColor() { return m_locolor; } | ||
77 | |||
78 | inline const Color &color() const { return m_color; } | ||
79 | inline const Color &colorTo() const { return m_color_to; } | ||
80 | inline const Color &hiColor() const { return m_hicolor; } | ||
81 | inline const Color &loColor() const { return m_locolor; } | ||
82 | |||
83 | inline unsigned long type() const { return m_type; } | ||
84 | |||
85 | |||
86 | private: | ||
87 | FbTk::Color m_color, m_color_to, m_hicolor, m_locolor; | ||
88 | unsigned long m_type; | ||
89 | }; | ||
90 | |||
91 | }; // end namespace FbTk | ||
92 | |||
93 | #endif // FBTK_TEXTURE_HH | ||