]>
Dogcows Code - chaz/openbox/blob - otk/image.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
13 #include "screeninfo.hh"
14 #include "src/timer.hh"
24 BImageControl
*control
;
29 int red_offset
, green_offset
, blue_offset
, red_bits
, green_bits
, blue_bits
,
31 unsigned char *red
, *green
, *blue
, *red_table
, *green_table
, *blue_table
;
32 unsigned int width
, height
, *xtable
, *ytable
;
34 void TrueColorDither(unsigned int bit_depth
, int bytes_per_line
,
35 unsigned char *pixel_data
);
36 void PseudoColorDither(int bytes_per_line
, unsigned char *pixel_data
);
38 void OrderedPseudoColorDither(int bytes_per_line
, unsigned char *pixel_data
);
41 Pixmap
renderPixmap(void);
42 Pixmap
render_solid(const BTexture
&texture
);
43 Pixmap
render_gradient(const BTexture
&texture
);
45 XImage
*renderXImage(void);
50 void border(const BTexture
&texture
);
57 void cdgradient(void);
58 void pcgradient(void);
62 BImage(BImageControl
*c
, int w
, int h
);
65 Pixmap
render(const BTexture
&texture
);
69 class BImageControl
: public ob::TimeoutHandler
{
74 unsigned int count
, width
, height
;
75 unsigned long pixel1
, pixel2
, texture
;
78 BImageControl(const ScreenInfo
*scrn
,
79 bool _dither
= False
, int _cpc
= 4,
80 unsigned long cache_timeout
= 300000l,
81 unsigned long cmax
= 200l);
82 virtual ~BImageControl(void);
84 inline bool doDither(void) { return dither
; }
86 inline const ScreenInfo
* getScreenInfo() const { return screeninfo
; }
88 inline Window
getDrawable(void) const { return window
; }
90 inline Visual
*getVisual(void) { return screeninfo
->getVisual(); }
92 inline int getBitsPerPixel(void) const { return bits_per_pixel
; }
93 inline int getDepth(void) const { return screen_depth
; }
94 inline int getColorsPerChannel(void) const
95 { return colors_per_channel
; }
97 unsigned long getSqrt(unsigned int x
);
99 Pixmap
renderImage(unsigned int width
, unsigned int height
,
100 const BTexture
&texture
);
102 void installRootColormap(void);
103 void removeImage(Pixmap pixmap
);
104 void getColorTables(unsigned char **rmt
, unsigned char **gmt
,
106 int *roff
, int *goff
, int *boff
,
107 int *rbit
, int *gbit
, int *bbit
);
108 void getXColorTable(XColor
**c
, int *n
);
109 void getGradientBuffers(unsigned int w
, unsigned int h
,
110 unsigned int **xbuf
, unsigned int **ybuf
);
111 void setDither(bool d
) { dither
= d
; }
112 void setColorsPerChannel(int cpc
);
114 virtual void timeout(void);
118 const ScreenInfo
*screeninfo
;
125 int colors_per_channel
, ncolors
, screen_number
, screen_depth
,
126 bits_per_pixel
, red_offset
, green_offset
, blue_offset
,
127 red_bits
, green_bits
, blue_bits
;
128 unsigned char red_color_table
[256], green_color_table
[256],
129 blue_color_table
[256];
130 unsigned int *grad_xbuffer
, *grad_ybuffer
, grad_buffer_width
,
132 unsigned long *sqrt_table
, cache_max
;
134 typedef std::list
<CachedImage
> CacheContainer
;
135 CacheContainer cache
;
137 Pixmap
searchCache(const unsigned int width
, const unsigned int height
,
138 const unsigned long texture
,
139 const BColor
&c1
, const BColor
&c2
);
This page took 0.040698 seconds and 5 git commands to generate.