]> icculus.org git repositories - mikachu/openbox.git/blob - render/render.h
pass the x,y,w,h to font_draw.
[mikachu/openbox.git] / render / render.h
1 #ifndef __render_h
2 #define __render_h
3
4 #include <X11/Xlib.h>
5 #define _XFT_NO_COMPAT_ /* no Xft 1 API */
6 #include <X11/Xft/Xft.h>
7 #include <glib.h>
8 #include "color.h"
9
10 #ifdef HAVE_STDINT_H
11 #  include <stdint.h>
12 #else
13 #  ifdef HAVE_SYS_TYPES_H
14 #    include <sys/types.h>
15 #  endif
16 #endif
17
18 #ifdef HAVE_STDINT_H
19 typedef uint32_t pixel32;
20 typedef uint16_t pixel16;
21 #else
22 typedef u_int32_t pixel32;
23 typedef u_int16_t pixel16;
24 #endif /* HAVE_STDINT_H */
25
26 #if (G_ENDIAN == G_BIG_ENDIAN)
27 #define default_red_shift 0
28 #define default_green_shift 8
29 #define default_blue_shift 16
30 #define endian MSBFirst
31 #else
32 #define default_red_shift 16
33 #define default_green_shift 8
34 #define default_blue_shift 0
35 #define endian LSBFirst
36 #endif /* G_ENDIAN == G_BIG_ENDIAN */
37
38 typedef enum {
39     Surface_Planar,
40     Surface_Nonplanar
41 } SurfaceType;
42
43 typedef enum {
44     Flat,
45     Raised,
46     Sunken
47 } ReliefType;
48
49 typedef enum {
50     Bevel1,
51     Bevel2
52 } BevelType;
53
54 typedef enum {
55     Background_ParentRelative,
56     Background_Solid,
57     Background_Horizontal,
58     Background_Vertical,
59     Background_Diagonal,
60     Background_CrossDiagonal,
61     Background_PipeCross,
62     Background_Rectangle,
63     Background_Pyramid,
64     Background_Elliptic
65 } SurfaceColorType;
66
67 typedef enum {
68     Bitmask,
69     Text,
70     RGBA
71 } TextureType;
72
73 typedef struct PlanarSurface {
74     SurfaceColorType grad;
75     ReliefType relief;
76     BevelType bevel;
77     color_rgb *primary;
78     color_rgb *secondary;
79     color_rgb *border_color;
80     gboolean interlaced;
81     gboolean border;
82     pixel32 *pixel_data;
83 } PlanarSurface;
84
85 typedef struct NonplanarSurface {
86     int poo;
87 } NonplanarSurface;
88
89 typedef union {
90     PlanarSurface planar;
91     NonplanarSurface nonplanar;
92 } SurfaceData;
93
94 typedef struct Surface {
95     SurfaceType type;
96     SurfaceColorType colortype;
97     SurfaceData data;
98 } Surface;
99
100 typedef struct {
101     XftFont *xftfont;
102     int height;
103 } ObFont;
104
105 typedef enum {
106     Justify_Center,
107     Justify_Left,
108     Justify_Right
109 } Justify;
110
111 typedef struct TextureText {
112     ObFont *font;
113     Justify justify;
114     int shadow;
115     unsigned char tint;
116     unsigned char offset;
117     color_rgb *color;
118     char *string;
119 } TextureText;   
120
121 typedef struct {
122     Pixmap mask;
123     guint w, h;
124 } pixmap_mask;
125
126 typedef struct TextureMask {
127     color_rgb *color;
128     pixmap_mask *mask;
129 } TextureMask;
130
131 typedef struct TextureRGBA {
132     int poo;
133 } TextureRGBA;
134
135 typedef union {
136     TextureRGBA rgba;
137     TextureText text;
138     TextureMask mask;
139 } TextureData;
140
141 typedef struct Texture {
142     TextureType type;
143     TextureData data;
144 } Texture;
145
146 typedef struct Appearance {
147     Surface surface;
148     int textures;
149     Texture *texture;
150     Pixmap pixmap;
151     XftDraw *xftdraw;
152 } Appearance;
153
154 extern Visual *render_visual;
155 extern int render_depth;
156 extern Colormap render_colormap;
157
158 void (*paint)(Window win, Appearance *l, int x, int y, int w, int h);
159
160 void render_startup(void);
161 void init_appearance(Appearance *l);
162 void x_paint(Window win, Appearance *l, int x, int y, int w, int h);
163 void render_shutdown(void);
164 Appearance *appearance_new(SurfaceType type, int numtex);
165 Appearance *appearance_copy(Appearance *a);
166 void appearance_free(Appearance *a);
167 #endif /*__render_h*/