aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbPixmap.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/FbPixmap.hh')
-rw-r--r--src/FbTk/FbPixmap.hh83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh
new file mode 100644
index 0000000..b0b7fed
--- /dev/null
+++ b/src/FbTk/FbPixmap.hh
@@ -0,0 +1,83 @@
1// FbPixmap.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: FbPixmap.hh,v 1.10 2004/01/11 12:48:46 fluxgen Exp $
23
24#ifndef FBTK_FBPIXMAP_HH
25#define FBTK_FBPIXMAP_HH
26
27#include "FbDrawable.hh"
28
29#include <X11/Xlib.h>
30
31namespace FbTk {
32
33/// a wrapper for X Pixmap
34class FbPixmap:public FbDrawable {
35public:
36 FbPixmap();
37 /// copy pixmap
38 explicit FbPixmap(const FbPixmap &copy);
39 /// creates a FbPixmap from X pixmap
40 explicit FbPixmap(Pixmap pm);
41 FbPixmap(const FbDrawable &src,
42 unsigned int width, unsigned int height,
43 int depth);
44 FbPixmap(Drawable src,
45 unsigned int width, unsigned int height,
46 int depth);
47
48 virtual ~FbPixmap();
49
50 void copy(const FbPixmap &the_copy);
51 void copy(Pixmap pixmap);
52 /// rotates the pixmap 90 deg, not implemented!
53 void rotate();
54 /// scales the pixmap to specified size
55 void scale(unsigned int width, unsigned int height);
56 void resize(unsigned int width, unsigned int height);
57 /// drops pixmap and returns it
58 Pixmap release();
59
60 FbPixmap &operator = (const FbPixmap &copy);
61 /// sets new pixmap
62 FbPixmap &operator = (Pixmap pm);
63
64 inline Drawable drawable() const { return m_pm; }
65 inline unsigned int width() const { return m_width; }
66 inline unsigned int height() const { return m_height; }
67 inline int depth() const { return m_depth; }
68
69
70private:
71 void free();
72 void create(Drawable src,
73 unsigned int width, unsigned int height,
74 int depth);
75 Pixmap m_pm;
76 unsigned int m_width, m_height;
77 int m_depth;
78};
79
80} // end namespace FbTk
81
82#endif // FBTK_FBPIXMAP_HH
83