debian: Import version 0.95.6-1.
[wmaker-crm.git] / src / texture.h
blob7997304b3ce12fa7e12a49aece92489295ba28c8
1 /*
2 * Window Maker window manager
4 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef WMTEXTURE_H_
23 #define WMTEXTURE_H_
25 #include "screen.h"
26 #include "wcore.h"
28 /* texture relief */
29 #define WREL_RAISED 0
30 #define WREL_SUNKEN 1
31 #define WREL_FLAT 2
32 #define WREL_ICON 4
33 #define WREL_MENUENTRY 6
35 /* texture types */
36 #define WREL_BORDER_MASK 1
38 #define WTEX_SOLID ((1<<1)|WREL_BORDER_MASK)
39 #define WTEX_HGRADIENT ((1<<2)|WREL_BORDER_MASK)
40 #define WTEX_VGRADIENT ((1<<3)|WREL_BORDER_MASK)
41 #define WTEX_DGRADIENT ((1<<4)|WREL_BORDER_MASK)
42 #define WTEX_MHGRADIENT ((1<<5)|WREL_BORDER_MASK)
43 #define WTEX_MVGRADIENT ((1<<6)|WREL_BORDER_MASK)
44 #define WTEX_MDGRADIENT ((1<<7)|WREL_BORDER_MASK)
45 #define WTEX_IGRADIENT ((1<<8)|WREL_BORDER_MASK)
46 #define WTEX_PIXMAP (1<<10)
47 #define WTEX_THGRADIENT ((1<<11)|WREL_BORDER_MASK)
48 #define WTEX_TVGRADIENT ((1<<12)|WREL_BORDER_MASK)
49 #define WTEX_TDGRADIENT ((1<<13)|WREL_BORDER_MASK)
50 #define WTEX_FUNCTION ((1<<14)|WREL_BORDER_MASK)
52 /* pixmap subtypes */
53 #define WTP_TILE 2
54 #define WTP_SCALE 4
55 #define WTP_CENTER 6
58 typedef struct {
59 short type; /* type of texture */
60 char subtype; /* subtype of the texture */
61 XColor color; /* default background color */
62 GC gc; /* gc for the background color */
63 } WTexAny;
66 typedef struct WTexSolid {
67 short type;
68 char subtype;
69 XColor normal;
70 GC normal_gc;
72 GC light_gc;
73 GC dim_gc;
74 GC dark_gc;
76 XColor light;
77 XColor dim;
78 XColor dark;
79 } WTexSolid;
82 typedef struct WTexGradient {
83 short type;
84 char subtype;
85 XColor normal;
86 GC normal_gc;
88 RColor color1;
89 RColor color2;
90 } WTexGradient;
93 typedef struct WTexMGradient {
94 short type;
95 char subtype;
96 XColor normal;
97 GC normal_gc;
99 RColor **colors;
100 } WTexMGradient;
103 typedef struct WTexIGradient {
104 short type;
105 char dummy;
106 XColor normal;
107 GC normal_gc;
109 RColor colors1[2];
110 RColor colors2[2];
111 int thickness1;
112 int thickness2;
113 } WTexIGradient;
116 typedef struct WTexPixmap {
117 short type;
118 char subtype;
119 XColor normal;
120 GC normal_gc;
122 struct RImage *pixmap;
123 } WTexPixmap;
125 typedef struct WTexTGradient {
126 short type;
127 char subtype;
128 XColor normal;
129 GC normal_gc;
131 RColor color1;
132 RColor color2;
133 struct RImage *pixmap;
134 int opacity;
135 } WTexTGradient;
137 typedef struct WTexFunction {
138 short type;
139 char subtype;
140 XColor normal;
141 GC normal_gc;
143 void *handle;
144 RImage *(*render) (int, char**, int, int, int);
145 int argc;
146 char **argv;
147 } WTexFunction;
149 typedef union WTexture {
150 WTexAny any;
151 WTexSolid solid;
152 WTexGradient gradient;
153 WTexIGradient igradient;
154 WTexMGradient mgradient;
155 WTexPixmap pixmap;
156 WTexTGradient tgradient;
157 WTexFunction function;
158 } WTexture;
161 WTexSolid *wTextureMakeSolid(WScreen*, XColor*);
162 WTexGradient *wTextureMakeGradient(WScreen*, int, const RColor*, const RColor*);
163 WTexMGradient *wTextureMakeMGradient(WScreen*, int, RColor**);
164 WTexTGradient *wTextureMakeTGradient(WScreen*, int, const RColor*, const RColor*, const char *, int);
165 WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
166 WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, const char *pixmap_file,
167 XColor *color);
168 void wTextureDestroy(WScreen*, WTexture*);
169 void wTexturePaint(WTexture *, Pixmap *, WCoreWindow*, int, int);
170 void wTextureRender(WScreen*, WTexture*, Pixmap*, int, int, int);
171 struct RImage *wTextureRenderImage(WTexture*, int, int, int);
174 void wTexturePaintTitlebar(struct WWindow *wwin, WTexture *texture, Pixmap *tdata,
175 int repaint);
178 #define FREE_PIXMAP(p) if ((p)!=None) XFreePixmap(dpy, (p)), (p)=None
180 void wDrawBevel(Drawable d, unsigned width, unsigned height,
181 WTexSolid *texture, int relief);
183 #endif