aboutsummaryrefslogtreecommitdiff
path: root/src/ImageControl.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/ImageControl.hh')
-rw-r--r--src/ImageControl.hh132
1 files changed, 66 insertions, 66 deletions
diff --git a/src/ImageControl.hh b/src/ImageControl.hh
index d8e7148..7377081 100644
--- a/src/ImageControl.hh
+++ b/src/ImageControl.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: ImageControl.hh,v 1.2 2002/11/30 20:59:54 fluxgen Exp $ 25// $Id: ImageControl.hh,v 1.3 2002/12/01 13:41:57 rathnor Exp $
26 26
27#ifndef IMAGECONTROL_HH 27#ifndef IMAGECONTROL_HH
28#define IMAGECONTROL_HH 28#define IMAGECONTROL_HH
@@ -39,85 +39,85 @@
39*/ 39*/
40class BImageControl : public TimeoutHandler { 40class BImageControl : public TimeoutHandler {
41public: 41public:
42 BImageControl(int screen_num, bool dither = false, int colors_per_channel = 4, 42 BImageControl(int screen_num, bool dither = false, int colors_per_channel = 4,
43 unsigned long cache_timeout = 300000l, unsigned long cache_max = 200l); 43 unsigned long cache_timeout = 300000l, unsigned long cache_max = 200l);
44 virtual ~BImageControl(); 44 virtual ~BImageControl();
45 45
46 inline bool doDither() const { return m_dither; } 46 inline bool doDither() const { return m_dither; }
47 inline int bitsPerPixel() const { return bits_per_pixel; } 47 inline int bitsPerPixel() const { return bits_per_pixel; }
48 inline int depth() const { return m_screen_depth; } 48 inline int depth() const { return m_screen_depth; }
49 inline int colorsPerChannel() const { return m_colors_per_channel; } 49 inline int colorsPerChannel() const { return m_colors_per_channel; }
50 int screenNum() const { return m_screen_num; } 50 int screenNum() const { return m_screen_num; }
51 Visual *visual() const { return m_visual; } 51 Visual *visual() const { return m_visual; }
52 unsigned long getSqrt(unsigned int val) const; 52 unsigned long getSqrt(unsigned int val) const;
53 53
54 /** 54 /**
55 Render to pixmap 55 Render to pixmap
56 @param width width of pixmap 56 @param width width of pixmap
57 @param height height of pixmap 57 @param height height of pixmap
58 @param src_texture texture type to render 58 @param src_texture texture type to render
59 @return pixmap of the rendered image, on failure None 59 @return pixmap of the rendered image, on failure None
60 */ 60 */
61 Pixmap renderImage(unsigned int width, unsigned int height, 61 Pixmap renderImage(unsigned int width, unsigned int height,
62 const FbTk::Texture &src_texture); 62 const FbTk::Texture &src_texture);
63 63
64 void installRootColormap(); 64 void installRootColormap();
65 void removeImage(Pixmap thepix); 65 void removeImage(Pixmap thepix);
66 void colorTables(const unsigned char **, const unsigned char **, const unsigned char **, 66 void colorTables(const unsigned char **, const unsigned char **, const unsigned char **,
67 int *, int *, int *, int *, int *, int *) const; 67 int *, int *, int *, int *, int *, int *) const;
68 void getXColorTable(XColor **, int *); 68 void getXColorTable(XColor **, int *);
69 void getGradientBuffers(unsigned int, unsigned int, 69 void getGradientBuffers(unsigned int, unsigned int,
70 unsigned int **, unsigned int **); 70 unsigned int **, unsigned int **);
71 void setDither(bool d) { m_dither = d; } 71 void setDither(bool d) { m_dither = d; }
72 void setColorsPerChannel(int cpc); 72 void setColorsPerChannel(int cpc);
73 73
74 virtual void timeout(); 74 virtual void timeout();
75 75
76private: 76private:
77 /** 77 /**
78 Search cache for a specific pixmap 78 Search cache for a specific pixmap
79 @return None if no cache was found 79 @return None if no cache was found
80 */ 80 */
81 Pixmap searchCache(unsigned int width, unsigned int height, unsigned long texture_type, 81 Pixmap searchCache(unsigned int width, unsigned int height, unsigned long texture_type,
82 const FbTk::Color &color, const FbTk::Color &color_to) const; 82 const FbTk::Color &color, const FbTk::Color &color_to) const;
83 83
84 void createColorTable(); 84 void createColorTable();
85 bool m_dither; 85 bool m_dither;
86 86
87 BTimer m_timer; 87 BTimer m_timer;
88 88
89 Colormap m_colormap; 89 Colormap m_colormap;
90 90
91 Window m_root_window; 91 Window m_root_window;
92 92
93 XColor *m_colors; ///< color table 93 XColor *m_colors; ///< color table
94 unsigned int m_num_colors; ///< number of colors in color table 94 unsigned int m_num_colors; ///< number of colors in color table
95 95
96 Visual *m_visual; 96 Visual *m_visual;
97 97
98 int bits_per_pixel, red_offset, green_offset, blue_offset, 98 int bits_per_pixel, red_offset, green_offset, blue_offset,
99 red_bits, green_bits, blue_bits; 99 red_bits, green_bits, blue_bits;
100 int m_colors_per_channel; ///< number of colors per channel 100 int m_colors_per_channel; ///< number of colors per channel
101 int m_screen_depth; ///< bit depth of screen 101 int m_screen_depth; ///< bit depth of screen
102 int m_screen_num; ///< screen number 102 int m_screen_num; ///< screen number
103 unsigned char red_color_table[256], green_color_table[256], 103 unsigned char red_color_table[256], green_color_table[256],
104 blue_color_table[256]; 104 blue_color_table[256];
105 unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width, 105 unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width,
106 grad_buffer_height; 106 grad_buffer_height;
107 107
108 static unsigned long *sqrt_table; /// sqrt lookup table 108 static unsigned long *sqrt_table; /// sqrt lookup table
109 109
110 typedef struct Cache { 110 typedef struct Cache {
111 Pixmap pixmap; 111 Pixmap pixmap;
112 112
113 unsigned int count, width, height; 113 unsigned int count, width, height;
114 unsigned long pixel1, pixel2, texture; 114 unsigned long pixel1, pixel2, texture;
115 } Cache; 115 } Cache;
116 116
117 unsigned long cache_max; 117 unsigned long cache_max;
118 typedef std::list<Cache *> CacheList; 118 typedef std::list<Cache *> CacheList;
119 119
120 mutable CacheList cache; 120 mutable CacheList cache;
121}; 121};
122 122
123 123