]> Dogcows Code - chaz/openbox/blob - render/render.h
include Xlib.h for other platforms
[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/Xlib.h> /* some platforms dont include this as needed for Xft */
6 #include <X11/Xft/Xft.h>
7 #include <X11/Xlib.h>
8 #include <glib.h>
9
10 typedef union _RrTextureData RrTextureData;
11 typedef struct _RrAppearance RrAppearance;
12 typedef struct _RrSurface RrSurface;
13 typedef struct _RrFont RrFont;
14 typedef struct _RrTexture RrTexture;
15 typedef struct _RrTextureMask RrTextureMask;
16 typedef struct _RrTextureRGBA RrTextureRGBA;
17 typedef struct _RrTextureText RrTextureText;
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_RGBA
52 } RrTextureType;
53
54 typedef enum {
55 RR_JUSTIFY_LEFT,
56 RR_JUSTIFY_CENTER,
57 RR_JUSTIFY_RIGHT
58 } RrJustify;
59
60 struct _RrSurface {
61 RrSurfaceColorType grad;
62 RrReliefType relief;
63 RrBevelType bevel;
64 RrColor *primary;
65 RrColor *secondary;
66 RrColor *border_color;
67 RrColor *bevel_dark;
68 RrColor *bevel_light;
69 gboolean interlaced;
70 gboolean border;
71 RrAppearance *parent;
72 gint parentx;
73 gint parenty;
74 RrPixel32 *pixel_data;
75 };
76
77 struct _RrTextureText {
78 RrFont *font;
79 RrJustify justify;
80 RrColor *color;
81 gchar *string;
82 };
83
84 struct _RrPixmapMask {
85 const RrInstance *inst;
86 Pixmap mask;
87 gint width;
88 gint height;
89 gchar *data;
90 };
91
92 struct _RrTextureMask {
93 RrColor *color;
94 RrPixmapMask *mask;
95 };
96
97 struct _RrTextureRGBA {
98 gint width;
99 gint height;
100 RrPixel32 *data;
101 /* cached scaled so we don't have to scale often */
102 gint cwidth;
103 gint cheight;
104 RrPixel32 *cache;
105 };
106
107 union _RrTextureData {
108 RrTextureRGBA rgba;
109 RrTextureText text;
110 RrTextureMask mask;
111 };
112
113 struct _RrTexture {
114 RrTextureType type;
115 RrTextureData data;
116 };
117
118 struct _RrAppearance {
119 const RrInstance *inst;
120
121 RrSurface surface;
122 gint textures;
123 RrTexture *texture;
124 Pixmap pixmap;
125 XftDraw *xftdraw;
126
127 /* cached for internal use */
128 gint w, h;
129 };
130
131 /* these are the same on all endian machines because it seems to be dependant
132 on the endianness of the gfx card, not the cpu. */
133 #define RrDefaultAlphaOffset 24
134 #define RrDefaultRedOffset 16
135 #define RrDefaultGreenOffset 8
136 #define RrDefaultBlueOffset 0
137
138 RrInstance* RrInstanceNew (Display *display, gint screen);
139 void RrInstanceFree (RrInstance *inst);
140
141 Display* RrDisplay (const RrInstance *inst);
142 gint RrScreen (const RrInstance *inst);
143 Window RrRootWindow (const RrInstance *inst);
144 Visual* RrVisual (const RrInstance *inst);
145 gint RrDepth (const RrInstance *inst);
146 Colormap RrColormap (const RrInstance *inst);
147 gint RrRedOffset (const RrInstance *inst);
148 gint RrGreenOffset (const RrInstance *inst);
149 gint RrBlueOffset (const RrInstance *inst);
150 gint RrRedShift (const RrInstance *inst);
151 gint RrGreenShift (const RrInstance *inst);
152 gint RrBlueShift (const RrInstance *inst);
153 gint RrRedMask (const RrInstance *inst);
154 gint RrGreenMask (const RrInstance *inst);
155 gint RrBlueMask (const RrInstance *inst);
156 guint RrPseudoBPC (const RrInstance *inst);
157 XColor* RrPseudoColors (const RrInstance *inst);
158
159 RrColor *RrColorNew (const RrInstance *inst, gint r, gint g, gint b);
160 RrColor *RrColorParse (const RrInstance *inst, gchar *colorname);
161 void RrColorFree (RrColor *in);
162
163 gint RrColorRed (const RrColor *c);
164 gint RrColorGreen (const RrColor *c);
165 gint RrColorBlue (const RrColor *c);
166 gulong RrColorPixel (const RrColor *c);
167
168 RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
169 RrAppearance *RrAppearanceCopy (RrAppearance *a);
170 void RrAppearanceFree (RrAppearance *a);
171
172 int RrFontMeasureString (const RrFont *f, const gchar *str);
173 int RrFontHeight (const RrFont *f);
174 int RrFontMaxCharWidth (const RrFont *f);
175
176 void RrPaint (RrAppearance *l, Window win, gint w, gint h);
177 void RrMinsize (RrAppearance *l, gint *w, gint *h);
178
179 gboolean RrPixmapToRGBA(const RrInstance *inst,
180 Pixmap pmap, Pixmap mask,
181 gint *w, gint *h, RrPixel32 **data);
182
183 #endif /*__render_h*/
This page took 0.045755 seconds and 5 git commands to generate.