aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/TextureRender.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/TextureRender.hh')
-rw-r--r--src/FbTk/TextureRender.hh100
1 files changed, 100 insertions, 0 deletions
diff --git a/src/FbTk/TextureRender.hh b/src/FbTk/TextureRender.hh
new file mode 100644
index 0000000..f07a5c7
--- /dev/null
+++ b/src/FbTk/TextureRender.hh
@@ -0,0 +1,100 @@
1// TextureRender.hh for fluxbox
2// Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3//
4// Image.hh for Blackbox - an X11 Window manager
5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at 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: TextureRender.hh,v 1.2 2003/04/28 22:27:29 fluxgen Exp $
26
27#ifndef FBTK_TEXTURRENDER_HH
28#define FBTK_TEXTURRENDER_HH
29
30#include "Texture.hh"
31
32#include <X11/Xlib.h>
33
34namespace FbTk {
35
36class ImageControl;
37
38
39/// Renders texture to pixmap
40/**
41 This is used with BImageControl to render textures
42*/
43class TextureRender {
44public:
45 TextureRender(ImageControl &ic, unsigned int width, unsigned int height,
46 XColor *_colors=0, size_t num_colors=0);
47 ~TextureRender();
48 /// render to pixmap
49 Pixmap render(const FbTk::Texture &src_texture);
50 /// render solid texture to pixmap
51 Pixmap renderSolid(const FbTk::Texture &src_texture);
52 /// render gradient texture to pixmap
53 Pixmap renderGradient(const FbTk::Texture &src_texture);
54 /// scales and renders a pixmap
55 Pixmap renderPixmap(const FbTk::Texture &src_texture);
56private:
57 /**
58 Render to pixmap
59 @return rendered pixmap
60 */
61 Pixmap renderPixmap();
62 /**
63 Render to XImage
64 @returns allocated and rendered XImage, user is responsible to deallocate
65 */
66 XImage *renderXImage();
67 /**
68 @name render functions
69 */
70 //@{
71 void invert();
72 void bevel1();
73 void bevel2();
74 void dgradient();
75 void egradient();
76 void hgradient();
77 void pgradient();
78 void rgradient();
79 void vgradient();
80 void cdgradient();
81 void pcgradient();
82 //@}
83 void makeGradientBuffers();
84
85 ImageControl &control;
86 bool interlaced;
87
88 XColor *colors; // color table
89
90 const FbTk::Color *from, *to;
91 int red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits,
92 ncolors, cpc, cpccpc;
93 unsigned char *red, *green, *blue;
94 const unsigned char *red_table, *green_table, *blue_table;
95 unsigned int width, height;
96 unsigned int *xtable, *ytable;
97};
98
99}; // end namespace FbTk
100#endif // FBTK_TEXTURERENDER_HH