]> Dogcows Code - chaz/openbox/blob - render/render.h
couple more xrdb theme format cleanups:
[chaz/openbox] / render / render.h
1 #ifndef __render_h
2 #define __render_h
3
4 #include <X11/Xlib.h> /* some platforms dont include this as needed for Xft */
5 #define _XFT_NO_COMPAT_ /* no Xft 1 API */
6 #include <X11/Xft/Xft.h>
7 #include <glib.h>
8
9 typedef union _RrTextureData RrTextureData;
10 typedef struct _RrAppearance RrAppearance;
11 typedef struct _RrSurface RrSurface;
12 typedef struct _RrFont RrFont;
13 typedef struct _RrTexture RrTexture;
14 typedef struct _RrTextureMask RrTextureMask;
15 typedef struct _RrTextureRGBA RrTextureRGBA;
16 typedef struct _RrTextureText RrTextureText;
17 typedef struct _RrTextureLineArt RrTextureLineArt;
18 typedef struct _RrPixmapMask RrPixmapMask;
19 typedef struct _RrInstance RrInstance;
20 typedef struct _RrColor RrColor;
21
22 typedef guint32 RrPixel32;
23 typedef guint16 RrPixel16;
24
25 typedef enum {
26 RR_RELIEF_FLAT,
27 RR_RELIEF_RAISED,
28 RR_RELIEF_SUNKEN
29 } RrReliefType;
30
31 typedef enum {
32 RR_BEVEL_1,
33 RR_BEVEL_2
34 } RrBevelType;
35
36 typedef enum {
37 RR_SURFACE_NONE,
38 RR_SURFACE_PARENTREL,
39 RR_SURFACE_SOLID,
40 RR_SURFACE_HORIZONTAL,
41 RR_SURFACE_VERTICAL,
42 RR_SURFACE_DIAGONAL,
43 RR_SURFACE_CROSS_DIAGONAL,
44 RR_SURFACE_PYRAMID
45 } RrSurfaceColorType;
46
47 typedef enum {
48 RR_TEXTURE_NONE,
49 RR_TEXTURE_MASK,
50 RR_TEXTURE_TEXT,
51 RR_TEXTURE_LINE_ART,
52 RR_TEXTURE_RGBA
53 } RrTextureType;
54
55 typedef enum {
56 RR_JUSTIFY_LEFT,
57 RR_JUSTIFY_CENTER,
58 RR_JUSTIFY_RIGHT
59 } RrJustify;
60
61 struct _RrSurface {
62 RrSurfaceColorType grad;
63 RrReliefType relief;
64 RrBevelType bevel;
65 RrColor *primary;
66 RrColor *secondary;
67 RrColor *border_color;
68 RrColor *bevel_dark;
69 RrColor *bevel_light;
70 RrColor *interlace_color;
71 gboolean interlaced;
72 gboolean border;
73 RrAppearance *parent;
74 gint parentx;
75 gint parenty;
76 RrPixel32 *pixel_data;
77 };
78
79 struct _RrTextureText {
80 RrFont *font;
81 RrJustify justify;
82 RrColor *color;
83 gchar *string;
84 };
85
86 struct _RrPixmapMask {
87 const RrInstance *inst;
88 Pixmap mask;
89 gint width;
90 gint height;
91 gchar *data;
92 };
93
94 struct _RrTextureMask {
95 RrColor *color;
96 RrPixmapMask *mask;
97 };
98
99 struct _RrTextureRGBA {
100 gint width;
101 gint height;
102 RrPixel32 *data;
103 /* cached scaled so we don't have to scale often */
104 gint cwidth;
105 gint cheight;
106 RrPixel32 *cache;
107 };
108
109 struct _RrTextureLineArt {
110 RrColor *color;
111 gint x1;
112 gint y1;
113 gint x2;
114 gint y2;
115 };
116
117 union _RrTextureData {
118 RrTextureRGBA rgba;
119 RrTextureText text;
120 RrTextureMask mask;
121 RrTextureLineArt lineart;
122 };
123
124 struct _RrTexture {
125 RrTextureType type;
126 RrTextureData data;
127 };
128
129 struct _RrAppearance {
130 const RrInstance *inst;
131
132 RrSurface surface;
133 gint textures;
134 RrTexture *texture;
135 Pixmap pixmap;
136 XftDraw *xftdraw;
137
138 /* cached for internal use */
139 gint w, h;
140 };
141
142 /* these are the same on all endian machines because it seems to be dependant
143 on the endianness of the gfx card, not the cpu. */
144 #define RrDefaultAlphaOffset 24
145 #define RrDefaultRedOffset 16
146 #define RrDefaultGreenOffset 8
147 #define RrDefaultBlueOffset 0
148
149 RrInstance* RrInstanceNew (Display *display, gint screen);
150 void RrInstanceFree (RrInstance *inst);
151
152 Display* RrDisplay (const RrInstance *inst);
153 gint RrScreen (const RrInstance *inst);
154 Window RrRootWindow (const RrInstance *inst);
155 Visual* RrVisual (const RrInstance *inst);
156 gint RrDepth (const RrInstance *inst);
157 Colormap RrColormap (const RrInstance *inst);
158 gint RrRedOffset (const RrInstance *inst);
159 gint RrGreenOffset (const RrInstance *inst);
160 gint RrBlueOffset (const RrInstance *inst);
161 gint RrRedShift (const RrInstance *inst);
162 gint RrGreenShift (const RrInstance *inst);
163 gint RrBlueShift (const RrInstance *inst);
164 gint RrRedMask (const RrInstance *inst);
165 gint RrGreenMask (const RrInstance *inst);
166 gint RrBlueMask (const RrInstance *inst);
167 guint RrPseudoBPC (const RrInstance *inst);
168 XColor* RrPseudoColors (const RrInstance *inst);
169
170 RrColor *RrColorNew (const RrInstance *inst, gint r, gint g, gint b);
171 RrColor *RrColorParse (const RrInstance *inst, gchar *colorname);
172 void RrColorFree (RrColor *in);
173
174 gint RrColorRed (const RrColor *c);
175 gint RrColorGreen (const RrColor *c);
176 gint RrColorBlue (const RrColor *c);
177 gulong RrColorPixel (const RrColor *c);
178 GC RrColorGC (RrColor *c);
179
180 RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
181 RrAppearance *RrAppearanceCopy (RrAppearance *a);
182 void RrAppearanceFree (RrAppearance *a);
183
184 int RrFontMeasureString (const RrFont *f, const gchar *str);
185 int RrFontHeight (const RrFont *f);
186 int RrFontMaxCharWidth (const RrFont *f);
187
188 void RrPaint (RrAppearance *l, Window win, gint w, gint h);
189 void RrMinsize (RrAppearance *l, gint *w, gint *h);
190
191 gboolean RrPixmapToRGBA(const RrInstance *inst,
192 Pixmap pmap, Pixmap mask,
193 gint *w, gint *h, RrPixel32 **data);
194
195 #endif /*__render_h*/
This page took 0.040365 seconds and 4 git commands to generate.