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