]> Dogcows Code - chaz/openbox/blob - render/render.h
initial commit of split gradient, looks like some RrColor leaking perhaps
[chaz/openbox] / render / render.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 render.h for the Openbox window manager
4 Copyright (c) 2003 Ben Jansens
5 Copyright (c) 2003 Derek Foreman
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #ifndef __render_h
21 #define __render_h
22
23 #include "geom.h"
24 #include "version.h"
25
26 #include <X11/Xlib.h> /* some platforms dont include this as needed for Xft */
27 #define _XFT_NO_COMPAT_ /* no Xft 1 API */
28 #include <X11/Xft/Xft.h>
29 #include <glib.h>
30
31 G_BEGIN_DECLS
32
33 typedef union _RrTextureData RrTextureData;
34 typedef struct _RrAppearance RrAppearance;
35 typedef struct _RrSurface RrSurface;
36 typedef struct _RrFont RrFont;
37 typedef struct _RrTexture RrTexture;
38 typedef struct _RrTextureMask RrTextureMask;
39 typedef struct _RrTextureRGBA RrTextureRGBA;
40 typedef struct _RrTextureText RrTextureText;
41 typedef struct _RrTextureLineArt RrTextureLineArt;
42 typedef struct _RrPixmapMask RrPixmapMask;
43 typedef struct _RrInstance RrInstance;
44 typedef struct _RrColor RrColor;
45
46 typedef guint32 RrPixel32;
47 typedef guint16 RrPixel16;
48
49 typedef enum {
50 RR_RELIEF_FLAT,
51 RR_RELIEF_RAISED,
52 RR_RELIEF_SUNKEN
53 } RrReliefType;
54
55 typedef enum {
56 RR_BEVEL_1,
57 RR_BEVEL_2
58 } RrBevelType;
59
60 typedef enum {
61 RR_SURFACE_NONE,
62 RR_SURFACE_PARENTREL,
63 RR_SURFACE_SOLID,
64 RR_SURFACE_SPLIT,
65 RR_SURFACE_HORIZONTAL,
66 RR_SURFACE_VERTICAL,
67 RR_SURFACE_DIAGONAL,
68 RR_SURFACE_CROSS_DIAGONAL,
69 RR_SURFACE_PYRAMID
70 } RrSurfaceColorType;
71
72 typedef enum {
73 RR_TEXTURE_NONE,
74 RR_TEXTURE_MASK,
75 RR_TEXTURE_TEXT,
76 RR_TEXTURE_LINE_ART,
77 RR_TEXTURE_RGBA
78 } RrTextureType;
79
80 typedef enum {
81 RR_JUSTIFY_LEFT,
82 RR_JUSTIFY_CENTER,
83 RR_JUSTIFY_RIGHT
84 } RrJustify;
85
86 struct _RrSurface {
87 RrSurfaceColorType grad;
88 RrReliefType relief;
89 RrBevelType bevel;
90 RrColor *primary;
91 RrColor *secondary;
92 RrColor *border_color;
93 RrColor *bevel_dark;
94 RrColor *bevel_light;
95 RrColor *interlace_color;
96 gboolean interlaced;
97 gboolean border;
98 RrAppearance *parent;
99 gint parentx;
100 gint parenty;
101 RrPixel32 *pixel_data;
102 };
103
104 struct _RrTextureText {
105 RrFont *font;
106 RrJustify justify;
107 RrColor *color;
108 gchar *string;
109 };
110
111 struct _RrPixmapMask {
112 const RrInstance *inst;
113 Pixmap mask;
114 gint width;
115 gint height;
116 gchar *data;
117 };
118
119 struct _RrTextureMask {
120 RrColor *color;
121 RrPixmapMask *mask;
122 };
123
124 struct _RrTextureRGBA {
125 gint width;
126 gint height;
127 RrPixel32 *data;
128 /* cached scaled so we don't have to scale often */
129 gint cwidth;
130 gint cheight;
131 RrPixel32 *cache;
132 };
133
134 struct _RrTextureLineArt {
135 RrColor *color;
136 gint x1;
137 gint y1;
138 gint x2;
139 gint y2;
140 };
141
142 union _RrTextureData {
143 RrTextureRGBA rgba;
144 RrTextureText text;
145 RrTextureMask mask;
146 RrTextureLineArt lineart;
147 };
148
149 struct _RrTexture {
150 RrTextureType type;
151 RrTextureData data;
152 };
153
154 struct _RrAppearance {
155 const RrInstance *inst;
156
157 RrSurface surface;
158 gint textures;
159 RrTexture *texture;
160 Pixmap pixmap;
161 XftDraw *xftdraw;
162
163 /* cached for internal use */
164 gint w, h;
165 };
166
167 /* these are the same on all endian machines because it seems to be dependant
168 on the endianness of the gfx card, not the cpu. */
169 #define RrDefaultAlphaOffset 24
170 #define RrDefaultRedOffset 16
171 #define RrDefaultGreenOffset 8
172 #define RrDefaultBlueOffset 0
173
174 RrInstance* RrInstanceNew (Display *display, gint screen);
175 void RrInstanceFree (RrInstance *inst);
176
177 Display* RrDisplay (const RrInstance *inst);
178 gint RrScreen (const RrInstance *inst);
179 Window RrRootWindow (const RrInstance *inst);
180 Visual* RrVisual (const RrInstance *inst);
181 gint RrDepth (const RrInstance *inst);
182 Colormap RrColormap (const RrInstance *inst);
183 gint RrRedOffset (const RrInstance *inst);
184 gint RrGreenOffset (const RrInstance *inst);
185 gint RrBlueOffset (const RrInstance *inst);
186 gint RrRedShift (const RrInstance *inst);
187 gint RrGreenShift (const RrInstance *inst);
188 gint RrBlueShift (const RrInstance *inst);
189 gint RrRedMask (const RrInstance *inst);
190 gint RrGreenMask (const RrInstance *inst);
191 gint RrBlueMask (const RrInstance *inst);
192
193 RrColor *RrColorNew (const RrInstance *inst, gint r, gint g, gint b);
194 RrColor *RrColorParse (const RrInstance *inst, gchar *colorname);
195 void RrColorFree (RrColor *in);
196
197 gint RrColorRed (const RrColor *c);
198 gint RrColorGreen (const RrColor *c);
199 gint RrColorBlue (const RrColor *c);
200 gulong RrColorPixel (const RrColor *c);
201 GC RrColorGC (RrColor *c);
202
203 RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
204 RrAppearance *RrAppearanceCopy (RrAppearance *a);
205 void RrAppearanceFree (RrAppearance *a);
206
207 RrSize *RrFontMeasureString (const RrFont *f, const gchar *str);
208 gint RrFontHeight (const RrFont *f);
209 gint RrFontMaxCharWidth (const RrFont *f);
210
211 void RrPaint (RrAppearance *a, Window win, gint w, gint h);
212 void RrMinsize (RrAppearance *a, gint *w, gint *h);
213 void RrMargins (RrAppearance *a, gint *l, gint *t, gint *r, gint *b);
214
215 gboolean RrPixmapToRGBA(const RrInstance *inst,
216 Pixmap pmap, Pixmap mask,
217 gint *w, gint *h, RrPixel32 **data);
218
219 G_END_DECLS
220
221 #endif /*__render_h*/
This page took 0.051536 seconds and 5 git commands to generate.