diff options
author | fluxgen <fluxgen> | 2002-11-30 20:07:49 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-11-30 20:07:49 (GMT) |
commit | 5754cfd26ee645b4bdcb819adbaebeb4094dd8e7 (patch) | |
tree | f732d71e93cfd84100aa111829ffa01d498c8232 /src/TextureRender.hh | |
parent | 49491d32b6385634227f779828bb6de97449f273 (diff) | |
download | fluxbox-5754cfd26ee645b4bdcb819adbaebeb4094dd8e7.zip fluxbox-5754cfd26ee645b4bdcb819adbaebeb4094dd8e7.tar.bz2 |
moved from BImage class to TextureRender
Diffstat (limited to 'src/TextureRender.hh')
-rw-r--r-- | src/TextureRender.hh | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/TextureRender.hh b/src/TextureRender.hh new file mode 100644 index 0000000..8e1a9b3 --- /dev/null +++ b/src/TextureRender.hh | |||
@@ -0,0 +1,91 @@ | |||
1 | // TextureRender.hh for fluxbox | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen at fluxbox.org) | ||
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: TextureRender.hh,v 1.1 2002/11/30 20:07:49 fluxgen Exp $ | ||
23 | |||
24 | #ifndef TEXTURRENDER_HH | ||
25 | #define TEXTURRENDER_HH | ||
26 | |||
27 | #include "Texture.hh" | ||
28 | |||
29 | #include <X11/Xlib.h> | ||
30 | |||
31 | class BImageControl; | ||
32 | |||
33 | /** | ||
34 | Renders texture to pixmap | ||
35 | */ | ||
36 | class TextureRender { | ||
37 | public: | ||
38 | TextureRender(BImageControl &ic, unsigned int width, unsigned int height, | ||
39 | XColor *_colors=0, size_t num_colors=0); | ||
40 | ~TextureRender(); | ||
41 | /// render to pixmap | ||
42 | Pixmap render(const FbTk::Texture &src_texture); | ||
43 | /// render solid texture to pixmap | ||
44 | Pixmap renderSolid(const FbTk::Texture &src_texture); | ||
45 | /// render gradient texture to pixmap | ||
46 | Pixmap renderGradient(const FbTk::Texture &src_texture); | ||
47 | |||
48 | private: | ||
49 | /** | ||
50 | Render to pixmap | ||
51 | @return rendered pixmap | ||
52 | */ | ||
53 | Pixmap renderPixmap(); | ||
54 | /** | ||
55 | Render to XImage | ||
56 | @returns allocated and rendered XImage, user is responsible to deallocate | ||
57 | */ | ||
58 | XImage *renderXImage(); | ||
59 | /** | ||
60 | @name render functions | ||
61 | */ | ||
62 | //@{ | ||
63 | void invert(); | ||
64 | void bevel1(); | ||
65 | void bevel2(); | ||
66 | void dgradient(); | ||
67 | void egradient(); | ||
68 | void hgradient(); | ||
69 | void pgradient(); | ||
70 | void rgradient(); | ||
71 | void vgradient(); | ||
72 | void cdgradient(); | ||
73 | void pcgradient(); | ||
74 | //@} | ||
75 | void makeGradientBuffers(); | ||
76 | |||
77 | BImageControl &control; | ||
78 | bool interlaced; | ||
79 | |||
80 | XColor *colors; // color table | ||
81 | |||
82 | const FbTk::Color *from, *to; | ||
83 | int red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits, | ||
84 | ncolors, cpc, cpccpc; | ||
85 | unsigned char *red, *green, *blue; | ||
86 | const unsigned char *red_table, *green_table, *blue_table; | ||
87 | unsigned int width, height; | ||
88 | unsigned int *xtable, *ytable; | ||
89 | }; | ||
90 | |||
91 | #endif // TEXTURERENDER_HH | ||