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