]> Dogcows Code - chaz/openbox/blob - render/render.h
fb48bd5fd183ee8982c873e19eab507053f538fb
[chaz/openbox] / render / render.h
1 #ifndef __render_h
2 #define __render_h
3
4 #define _XFT_NO_COMPAT_ /* no Xft 1 API */
5 #include <X11/Xft/Xft.h>
6 #include <X11/Xlib.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 _RrPixmapMask RrPixmapMask;
18 typedef struct _RrInstance RrInstance;
19 typedef struct _RrColor RrColor;
20
21 typedef guint32 pixel32; /* XXX prefix */
22 typedef guint16 pixel16;
23
24 typedef enum {
25 RR_RELIEF_FLAT,
26 RR_RELIEF_RAISED,
27 RR_RELIEF_SUNKEN
28 } RrReliefType;
29
30 typedef enum {
31 RR_BEVEL_1,
32 RR_BEVEL_2
33 } RrBevelType;
34
35 typedef enum {
36 RR_SURFACE_NONE,
37 RR_SURFACE_PARENTREL,
38 RR_SURFACE_SOLID,
39 RR_SURFACE_HORIZONTAL,
40 RR_SURFACE_VERTICAL,
41 RR_SURFACE_DIAGONAL,
42 RR_SURFACE_CROSS_DIAGONAL,
43 RR_SURFACE_PIPECROSS,
44 RR_SURFACE_RECTANGLE,
45 RR_SURFACE_PYRAMID
46 } RrSurfaceColorType;
47
48 typedef enum {
49 RR_TEXTURE_NONE,
50 RR_TEXTURE_MASK,
51 RR_TEXTURE_TEXT,
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 gboolean interlaced;
71 gboolean border;
72 RrAppearance *parent;
73 gint parentx;
74 gint parenty;
75 pixel32 *pixel_data;
76 };
77
78 struct _RrTextureText {
79 RrFont *font;
80 RrJustify justify;
81 gint shadow;
82 gchar tint;
83 guchar offset;
84 RrColor *color;
85 gchar *string;
86 };
87
88 struct _RrPixmapMask {
89 const RrInstance *inst;
90 Pixmap mask;
91 gint width;
92 gint height;
93 gchar *data;
94 };
95
96 struct _RrTextureMask {
97 RrColor *color;
98 RrPixmapMask *mask;
99 };
100
101 struct _RrTextureRGBA {
102 gint width;
103 gint height;
104 pixel32 *data;
105 /* cached scaled so we don't have to scale often */
106 gint cwidth;
107 gint cheight;
108 pixel32 *cache;
109 };
110
111 union _RrTextureData {
112 RrTextureRGBA rgba;
113 RrTextureText text;
114 RrTextureMask mask;
115 };
116
117 struct _RrTexture {
118 RrTextureType type;
119 RrTextureData data;
120 };
121
122 struct _RrAppearance {
123 const RrInstance *inst;
124
125 RrSurface surface;
126 gint textures;
127 RrTexture *texture;
128 Pixmap pixmap;
129 XftDraw *xftdraw;
130
131 /* cached for internal use */
132 gint w, h;
133 };
134
135 RrInstance* RrInstanceNew (Display *display, gint screen);
136 void RrInstanceFree (RrInstance *inst);
137
138 Display* RrDisplay (const RrInstance *inst);
139 gint RrScreen (const RrInstance *inst);
140 Window RrRootWindow (const RrInstance *inst);
141 Visual* RrVisual (const RrInstance *inst);
142 gint RrDepth (const RrInstance *inst);
143 Colormap RrColormap (const RrInstance *inst);
144 gint RrRedOffset (const RrInstance *inst);
145 gint RrGreenOffset (const RrInstance *inst);
146 gint RrBlueOffset (const RrInstance *inst);
147 gint RrRedShift (const RrInstance *inst);
148 gint RrGreenShift (const RrInstance *inst);
149 gint RrBlueShift (const RrInstance *inst);
150 gint RrRedMask (const RrInstance *inst);
151 gint RrGreenMask (const RrInstance *inst);
152 gint RrBlueMask (const RrInstance *inst);
153 guint RrPseudoBPC (const RrInstance *inst);
154 XColor* RrPseudoColors (const RrInstance *inst);
155
156 RrColor *RrColorNew (const RrInstance *inst, gint r, gint g, gint b);
157 RrColor *RrColorParse (const RrInstance *inst, gchar *colorname);
158 void RrColorFree (RrColor *in);
159
160 RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
161 RrAppearance *RrAppearanceCopy (RrAppearance *a);
162 void RrAppearanceFree (RrAppearance *a);
163
164 void RrPaint (RrAppearance *l, Window win, gint w, gint h);
165 void RrMinsize (RrAppearance *l, gint *w, gint *h);
166
167 gboolean RrPixmapToRGBA(const RrInstance *inst,
168 Pixmap pmap, Pixmap mask,
169 gint *w, gint *h, pixel32 **data);
170
171 #endif /*__render_h*/
This page took 0.043216 seconds and 3 git commands to generate.