diff options
author | fluxgen <fluxgen> | 2003-01-09 21:09:49 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-01-09 21:09:49 (GMT) |
commit | 7dd4823340ae5f710a08ff3a8fbe4276defc6b85 (patch) | |
tree | f4b6623ecf435a643fcf247d3075aaf79d6e82f3 /src/FbTk/TextureRender.hh | |
parent | 7a74a56fe48b319fecf56cede8e16f9c03dfaa96 (diff) | |
download | fluxbox-7dd4823340ae5f710a08ff3a8fbe4276defc6b85.zip fluxbox-7dd4823340ae5f710a08ff3a8fbe4276defc6b85.tar.bz2 |
moved from fluxbox to fbtk
Diffstat (limited to 'src/FbTk/TextureRender.hh')
-rw-r--r-- | src/FbTk/TextureRender.hh | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/FbTk/TextureRender.hh b/src/FbTk/TextureRender.hh new file mode 100644 index 0000000..5b77753 --- /dev/null +++ b/src/FbTk/TextureRender.hh | |||
@@ -0,0 +1,99 @@ | |||
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.1 2003/01/09 21:09:49 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 | |||
34 | namespace FbTk { | ||
35 | |||
36 | class ImageControl; | ||
37 | |||
38 | |||
39 | /// Renders texture to pixmap | ||
40 | /** | ||
41 | This is used with BImageControl to render textures | ||
42 | */ | ||
43 | class TextureRender { | ||
44 | public: | ||
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 | |||
55 | private: | ||
56 | /** | ||
57 | Render to pixmap | ||
58 | @return rendered pixmap | ||
59 | */ | ||
60 | Pixmap renderPixmap(); | ||
61 | /** | ||
62 | Render to XImage | ||
63 | @returns allocated and rendered XImage, user is responsible to deallocate | ||
64 | */ | ||
65 | XImage *renderXImage(); | ||
66 | /** | ||
67 | @name render functions | ||
68 | */ | ||
69 | //@{ | ||
70 | void invert(); | ||
71 | void bevel1(); | ||
72 | void bevel2(); | ||
73 | void dgradient(); | ||
74 | void egradient(); | ||
75 | void hgradient(); | ||
76 | void pgradient(); | ||
77 | void rgradient(); | ||
78 | void vgradient(); | ||
79 | void cdgradient(); | ||
80 | void pcgradient(); | ||
81 | //@} | ||
82 | void makeGradientBuffers(); | ||
83 | |||
84 | ImageControl &control; | ||
85 | bool interlaced; | ||
86 | |||
87 | XColor *colors; // color table | ||
88 | |||
89 | const FbTk::Color *from, *to; | ||
90 | int red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits, | ||
91 | ncolors, cpc, cpccpc; | ||
92 | unsigned char *red, *green, *blue; | ||
93 | const unsigned char *red_table, *green_table, *blue_table; | ||
94 | unsigned int width, height; | ||
95 | unsigned int *xtable, *ytable; | ||
96 | }; | ||
97 | |||
98 | }; // end namespace FbTk | ||
99 | #endif // FBTK_TEXTURERENDER_HH | ||