Initial revision
[wmaker-crm.git] / src / texture.h
blob15559d008102174bb09fc07f419537a8f75b92b8
1 /*
2 * WindowMaker window manager
3 *
4 * Copyright (c) 1997, 1998 Alfredo K. Kojima
5 *
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
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 * USA.
23 #ifndef WMTEXTURE_H_
24 #define WMTEXTURE_H_
26 #include "screen.h"
27 #include "wcore.h"
29 /* texture relief */
30 #define WREL_RAISED 0
31 #define WREL_SUNKEN 1
32 #define WREL_FLAT 2
33 #define WREL_ICON 4
34 #define WREL_MENUENTRY 6
36 /* texture types */
37 #define WREL_BORDER_MASK 1
39 #define WTEX_SOLID ((1<<1)|WREL_BORDER_MASK)
40 #define WTEX_HGRADIENT ((1<<2)|WREL_BORDER_MASK)
41 #define WTEX_VGRADIENT ((1<<3)|WREL_BORDER_MASK)
42 #define WTEX_DGRADIENT ((1<<4)|WREL_BORDER_MASK)
43 #define WTEX_MHGRADIENT ((1<<5)|WREL_BORDER_MASK)
44 #define WTEX_MVGRADIENT ((1<<6)|WREL_BORDER_MASK)
45 #define WTEX_MDGRADIENT ((1<<7)|WREL_BORDER_MASK)
46 #define WTEX_PIXMAP (1<<8)
48 /* pixmap subtypes */
49 #define WTP_TILE 2
50 #define WTP_SCALE 4
51 #define WTP_CENTER 6
54 * (solid <color>)
55 * (hgradient <color> <color>)
56 * (vgradient <color> <color>)
57 * (dgradient <color> <color>)
58 * (pixmap <file> <mode>)
62 typedef struct {
63 short type; /* type of texture */
64 char subtype; /* subtype of the texture */
65 XColor color; /* default background color */
66 GC gc; /* gc for the background color */
67 } WTexAny;
70 typedef struct WTexSolid {
71 short type;
72 char subtype;
73 XColor normal;
74 GC normal_gc;
76 GC light_gc;
77 GC dim_gc;
78 GC dark_gc;
80 XColor light;
81 XColor dim;
82 XColor dark;
83 } WTexSolid;
86 typedef struct WTexGradient {
87 short type;
88 char subtype;
89 XColor normal;
90 GC normal_gc;
92 XColor color1;
93 XColor color2;
94 } WTexGradient;
97 typedef struct WTexMGradient {
98 short type;
99 char subtype;
100 XColor normal;
101 GC normal_gc;
103 RColor **colors;
104 } WTexMGradient;
107 typedef struct WTexPixmap {
108 short type;
109 char subtype;
110 XColor normal;
111 GC normal_gc;
113 struct RImage *pixmap;
114 } WTexPixmap;
116 typedef struct WTexCompose {
117 short type;
118 char subtype;
119 XColor normal;
120 GC normal_gc;
122 union WTexture *back;
123 union WTexture *fore;
124 int opacity;
125 } WTexCompose;
127 typedef union WTexture {
128 WTexAny any;
129 WTexSolid solid;
130 WTexGradient gradient;
131 WTexMGradient mgradient;
132 WTexPixmap pixmap;
133 WTexCompose compose;
134 } WTexture;
137 WTexSolid *wTextureMakeSolid(WScreen*, XColor*);
138 WTexGradient *wTextureMakeGradient(WScreen*, int, XColor*, XColor*);
139 WTexMGradient *wTextureMakeMGradient(WScreen*, int, RColor**);
140 WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file,
141 XColor *color);
142 void wTextureDestroy(WScreen*, WTexture*);
143 void wTexturePaint(WTexture *, Pixmap *, WCoreWindow*, int, int);
144 void wTextureRender(WScreen*, WTexture*, Pixmap*, int, int, int);
145 struct RImage *wTextureRenderImage(WTexture*, int, int, int);
148 void wTexturePaintTitlebar(struct WWindow *wwin, WTexture *texture, Pixmap *tdata,
149 int repaint);
152 #define FREE_PIXMAP(p) if ((p)!=None) XFreePixmap(dpy, (p)), (p)=None
154 void wDrawBevel(WCoreWindow *core, WTexSolid *texture, int relief);
156 #endif