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