diff options
author | fluxgen <fluxgen> | 2003-04-20 13:27:16 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-04-20 13:27:16 (GMT) |
commit | b232cd86458249cb307b3b065225d788d8956561 (patch) | |
tree | 7067afa70890446c8580ad832b894f7c1310aa4f /src/FbTk/Transparent.hh | |
parent | 2a1bc27e90ae96f14a2fc0164fef074974023389 (diff) | |
download | fluxbox-b232cd86458249cb307b3b065225d788d8956561.zip fluxbox-b232cd86458249cb307b3b065225d788d8956561.tar.bz2 |
for transparent drawable
Diffstat (limited to 'src/FbTk/Transparent.hh')
-rw-r--r-- | src/FbTk/Transparent.hh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/FbTk/Transparent.hh b/src/FbTk/Transparent.hh new file mode 100644 index 0000000..8652568 --- /dev/null +++ b/src/FbTk/Transparent.hh | |||
@@ -0,0 +1,62 @@ | |||
1 | // Transparent.hh for FbTk - Fluxbox Toolkit | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id: Transparent.hh,v 1.1 2003/04/20 13:27:16 fluxgen Exp $ | ||
23 | |||
24 | #ifndef FBTK_TRANSPARENT_HH | ||
25 | #define FBTK_TRANSPARENT_HH | ||
26 | |||
27 | #include <X11/Xlib.h> | ||
28 | |||
29 | namespace FbTk { | ||
30 | |||
31 | /// renders to drawable together with an alpha mask | ||
32 | class Transparent { | ||
33 | public: | ||
34 | Transparent(Drawable source, Drawable dest, unsigned char alpha, int screen_num); | ||
35 | ~Transparent(); | ||
36 | /// sets alpha value | ||
37 | void setAlpha(unsigned char alpha); | ||
38 | /// sets source drawable | ||
39 | void setSource(Drawable src, int screen_num); | ||
40 | /// sets destination drawable | ||
41 | void setDest(Drawable dest, int screen_num); | ||
42 | /** | ||
43 | renders to dest from src with specified coordinates and size | ||
44 | */ | ||
45 | void render(int src_x, int src_y, | ||
46 | int dest_x, int dest_y, | ||
47 | unsigned int width, unsigned int height) const; | ||
48 | unsigned char alpha() const { return m_alpha; } | ||
49 | private: | ||
50 | void freeAlpha(); | ||
51 | void allocAlpha(unsigned char newval); | ||
52 | unsigned long m_alpha_pic; | ||
53 | unsigned long m_src_pic; | ||
54 | unsigned long m_dest_pic; | ||
55 | Drawable m_source, m_dest; | ||
56 | unsigned char m_alpha; | ||
57 | }; | ||
58 | |||
59 | }; // end namespace FbTk | ||
60 | |||
61 | #endif // FBTK_TRANSPARENT_HH | ||
62 | |||