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