aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Transparent.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Transparent.hh')
-rw-r--r--src/FbTk/Transparent.hh70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/FbTk/Transparent.hh b/src/FbTk/Transparent.hh
new file mode 100644
index 0000000..fe29826
--- /dev/null
+++ b/src/FbTk/Transparent.hh
@@ -0,0 +1,70 @@
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.3 2003/05/13 21:16:27 fluxgen Exp $
23
24#ifndef FBTK_TRANSPARENT_HH
25#define FBTK_TRANSPARENT_HH
26
27#include <X11/Xlib.h>
28
29namespace FbTk {
30
31/// renders to drawable together with an alpha mask
32class Transparent {
33public:
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
49 unsigned char alpha() const { return m_alpha; }
50 Drawable dest() const { return m_dest; }
51 Drawable source() const { return m_source; }
52
53private:
54 void freeAlpha();
55 void allocAlpha(unsigned char newval);
56 unsigned long m_alpha_pic;
57 unsigned long m_src_pic;
58 unsigned long m_dest_pic;
59 Drawable m_source, m_dest;
60 unsigned char m_alpha;
61
62 static bool s_init;
63 static bool s_render; ///< wheter we have RENDER support
64
65};
66
67}; // end namespace FbTk
68
69#endif // FBTK_TRANSPARENT_HH
70