]>
Dogcows Code - chaz/openbox/blob - src/image.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
13 #include "basedisplay.hh"
21 BImageControl
*control
;
26 int red_offset
, green_offset
, blue_offset
, red_bits
, green_bits
, blue_bits
,
28 unsigned char *red
, *green
, *blue
, *red_table
, *green_table
, *blue_table
;
29 unsigned int width
, height
, *xtable
, *ytable
;
31 void TrueColorDither(unsigned int bit_depth
, int bytes_per_line
,
32 unsigned char *pixel_data
);
33 void PseudoColorDither(int bytes_per_line
, unsigned char *pixel_data
);
35 void OrderedPseudoColorDither(int bytes_per_line
, unsigned char *pixel_data
);
38 Pixmap
renderPixmap(void);
39 Pixmap
render_solid(const BTexture
&texture
);
40 Pixmap
render_gradient(const BTexture
&texture
);
42 XImage
*renderXImage(void);
47 void border(const BTexture
&texture
);
54 void cdgradient(void);
55 void pcgradient(void);
59 BImage(BImageControl
*c
, int w
, int h
);
62 Pixmap
render(const BTexture
&texture
);
66 class BImageControl
: public TimeoutHandler
{
71 unsigned int count
, width
, height
;
72 unsigned long pixel1
, pixel2
, texture
;
75 BImageControl(BaseDisplay
*dpy
, const ScreenInfo
*scrn
,
76 bool _dither
= False
, int _cpc
= 4,
77 unsigned long cache_timeout
= 300000l,
78 unsigned long cmax
= 200l);
79 virtual ~BImageControl(void);
81 inline BaseDisplay
*getBaseDisplay(void) const { return basedisplay
; }
83 inline bool doDither(void) { return dither
; }
85 inline const ScreenInfo
*getScreenInfo(void) { return screeninfo
; }
87 inline Window
getDrawable(void) const { return window
; }
89 inline Visual
*getVisual(void) { return screeninfo
->getVisual(); }
91 inline int getBitsPerPixel(void) const { return bits_per_pixel
; }
92 inline int getDepth(void) const { return screen_depth
; }
93 inline int getColorsPerChannel(void) const
94 { return colors_per_channel
; }
96 unsigned long getSqrt(unsigned int x
);
98 Pixmap
renderImage(unsigned int width
, unsigned int height
,
99 const BTexture
&texture
);
101 void installRootColormap(void);
102 void removeImage(Pixmap pixmap
);
103 void getColorTables(unsigned char **rmt
, unsigned char **gmt
,
105 int *roff
, int *goff
, int *boff
,
106 int *rbit
, int *gbit
, int *bbit
);
107 void getXColorTable(XColor
**c
, int *n
);
108 void getGradientBuffers(unsigned int w
, unsigned int h
,
109 unsigned int **xbuf
, unsigned int **ybuf
);
110 void setDither(bool d
) { dither
= d
; }
111 void setColorsPerChannel(int cpc
);
113 virtual void timeout(void);
117 BaseDisplay
*basedisplay
;
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.039835 seconds and 5 git commands to generate.