]> icculus.org git repositories - dana/openbox.git/blob - render/render.h
simply the render interface by not requiring the setting of all the areas. only take...
[dana/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     Flat,
13     Raised,
14     Sunken
15 } ReliefType;
16
17 typedef enum {
18     Bevel1,
19     Bevel2
20 } BevelType;
21
22 typedef enum {
23     Background_ParentRelative,
24     Background_Solid,
25     Background_Horizontal,
26     Background_Vertical,
27     Background_Diagonal,
28     Background_CrossDiagonal,
29     Background_PipeCross,
30     Background_Rectangle,
31     Background_Pyramid
32 } SurfaceColorType;
33
34 typedef enum {
35     Bitmask,
36     Text,
37     RGBA,
38     NoTexture
39 } TextureType;
40
41 struct Appearance;
42
43 typedef struct Surface {
44     SurfaceColorType grad;
45     ReliefType relief;
46     BevelType bevel;
47     color_rgb *primary;
48     color_rgb *secondary;
49     color_rgb *border_color;
50     color_rgb *bevel_dark; 
51     color_rgb *bevel_light;
52     gboolean interlaced;
53     gboolean border;
54     struct Appearance *parent;
55     int parentx;
56     int parenty;
57     pixel32 *pixel_data;
58 } Surface;
59
60 typedef struct {
61     XftFont *xftfont;
62     int elipses_length;
63 } ObFont;
64
65 typedef enum {
66     Justify_Center,
67     Justify_Left,
68     Justify_Right
69 } Justify;
70
71 typedef struct TextureText {
72     ObFont *font;
73     Justify justify;
74     int shadow;
75     char tint;
76     unsigned char offset;
77     color_rgb *color;
78     char *string;
79 } TextureText;   
80
81 typedef struct {
82     Pixmap mask;
83     guint w, h;
84     char *data;
85 } pixmap_mask;
86
87 typedef struct TextureMask {
88     color_rgb *color;
89     pixmap_mask *mask;
90 } TextureMask;
91
92 typedef struct TextureRGBA {
93     guint width;
94     guint height;
95     pixel32 *data;
96 /* cached scaled so we don't have to scale often */
97     guint cwidth;
98     guint cheight;
99     pixel32 *cache;
100 } TextureRGBA;
101
102 typedef union {
103     TextureRGBA rgba;
104     TextureText text;
105     TextureMask mask;
106 } TextureData;
107
108 typedef struct Texture {
109     TextureType type;
110     TextureData data;
111 } Texture;
112
113 typedef struct Appearance {
114     Surface surface;
115     int textures;
116     Texture *texture;
117     Pixmap pixmap;
118     XftDraw *xftdraw;
119
120     /* cached for internal use */
121     int w, h;
122 } Appearance;
123
124 extern Visual *render_visual;
125 extern XVisualInfo render_visual_info;
126 extern int render_depth;
127 extern Colormap render_colormap;
128
129 void render_startup(void);
130 void init_appearance(Appearance *l);
131 void paint(Window win, Appearance *l, int w, int h);
132 void render_shutdown(void);
133 Appearance *appearance_new(int numtex);
134 Appearance *appearance_copy(Appearance *a);
135 void appearance_free(Appearance *a);
136 void truecolor_startup(void);
137 void pseudocolor_startup(void);
138 void pixel32_to_pixmap(pixel32 *in, Pixmap out, int x, int y, int w, int h);
139
140 void appearance_minsize(Appearance *l, int *w, int *h);
141
142 gboolean render_pixmap_to_rgba(Pixmap pmap, Pixmap mask,
143                                int *w, int *h, pixel32 **data);
144
145 #endif /*__render_h*/