]> icculus.org git repositories - mikachu/openbox.git/blob - otk_c/imagecontrol.h
change the default style to fieron2
[mikachu/openbox.git] / otk_c / imagecontrol.h
1 // -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef   __imagecontrol_h
3 #define   __imagecontrol_h
4
5 #include <X11/Xlib.h>
6 #include <X11/Xutil.h>
7 #include <Python.h>
8
9 struct OtkScreenInfo;
10 struct OtkTimer;
11
12 extern PyTypeObject OtkImageControl_Type;
13
14 typedef struct OtkImageControl {
15   struct OtkScreenInfo *screen;
16
17   // for the pixmap cache
18   struct OtkTimer *timer;
19   unsigned long cache_max;
20
21   Bool dither;
22
23   int cpc; // colors-per-channel: must be a value between [2,6]
24   int bpp; // bits-per-pixel
25
26   unsigned int *grad_xbuffer;
27   unsigned int *grad_ybuffer;
28   unsigned int grad_buffer_width;
29   unsigned int grad_buffer_height;
30
31   unsigned long *sqrt_table;
32
33   // These values are all determined based on a visual
34   
35   int red_bits;    // the number of bits (1-255) that each shade of color
36   int green_bits;  // spans across. best case is 1, which gives 255 shades.
37   int blue_bits;
38   unsigned char red_color_table[256];
39   unsigned char green_color_table[256];
40   unsigned char blue_color_table[256];
41
42   // These are only used for TrueColor visuals
43   int red_offset;  // the offset of each color in a color mask
44   int green_offset;
45   int blue_offset;
46
47   // These are only used for !TrueColor visuals
48   XColor *colors;
49   int ncolors;
50
51 } OtkImageControl;
52
53 PyObject *OtkImageControl_New(int screen);
54
55
56 /*
57   inline bool doDither(void) { return dither; }
58
59   inline const ScreenInfo* getScreenInfo() const { return screeninfo; }
60
61   inline Window getDrawable(void) const { return window; }
62
63   inline Visual *getVisual(void) { return screeninfo->visual(); }
64
65   inline int getBitsPerPixel(void) const { return bits_per_pixel; }
66   inline int getDepth(void) const { return screen_depth; }
67   inline int getColorsPerChannel(void) const
68     { return colors_per_channel; }
69
70   unsigned long getSqrt(unsigned int x);
71
72   Pixmap renderImage(unsigned int width, unsigned int height,
73                      const BTexture &texture);
74
75   void installRootColormap(void);
76   void removeImage(Pixmap pixmap);
77   void getColorTables(unsigned char **rmt, unsigned char **gmt,
78                       unsigned char **bmt,
79                       int *roff, int *goff, int *boff,
80                       int *rbit, int *gbit, int *bbit);
81   void getXColorTable(XColor **c, int *n);
82   void getGradientBuffers(unsigned int w, unsigned int h,
83                           unsigned int **xbuf, unsigned int **ybuf);
84   void setDither(bool d) { dither = d; }
85
86   static void timeout(BImageControl *t);
87
88 private:
89   bool dither;
90   const ScreenInfo *screeninfo;
91   OBTimer *timer;
92
93   Colormap colormap;
94
95   Window window;
96   XColor *colors;
97   int colors_per_channel, ncolors, screen_number, screen_depth,
98     bits_per_pixel, red_offset, green_offset, blue_offset,
99     red_bits, green_bits, blue_bits;
100   unsigned char red_color_table[256], green_color_table[256],
101     blue_color_table[256];
102   unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width,
103     grad_buffer_height;
104   unsigned long *sqrt_table, cache_max;
105
106   typedef std::list<CachedImage> CacheContainer;
107   CacheContainer cache;
108
109   Pixmap searchCache(const unsigned int width, const unsigned int height,
110                      const unsigned long texture,
111                      const BColor &c1, const BColor &c2);
112 };
113 */
114
115 #endif // __imagecontrol_h