]> icculus.org git repositories - dana/openbox.git/blob - render/render.h
remove non-planar surfaces
[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 height;
63     int elipses_length;
64 } ObFont;
65
66 typedef enum {
67     Justify_Center,
68     Justify_Left,
69     Justify_Right
70 } Justify;
71
72 typedef struct TextureText {
73     ObFont *font;
74     Justify justify;
75     int shadow;
76     char tint;
77     unsigned char offset;
78     color_rgb *color;
79     char *string;
80 } TextureText;   
81
82 typedef struct {
83     Pixmap mask;
84     guint w, h;
85     char *data;
86 } pixmap_mask;
87
88 typedef struct TextureMask {
89     color_rgb *color;
90     pixmap_mask *mask;
91 } TextureMask;
92
93 typedef struct TextureRGBA {
94     guint width;
95     guint height;
96     pixel32 *data;
97 /* cached scaled so we don't have to scale often */
98     guint cwidth;
99     guint cheight;
100     pixel32 *cache;
101 } TextureRGBA;
102
103 typedef union {
104     TextureRGBA rgba;
105     TextureText text;
106     TextureMask mask;
107 } TextureData;
108
109 typedef struct Texture {
110     Rect position;
111     TextureType type;
112     TextureData data;
113 } Texture;
114
115 typedef struct Appearance {
116     Surface surface;
117     Rect area;
118     int textures;
119     Texture *texture;
120     Pixmap pixmap;
121     XftDraw *xftdraw;
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 (*paint)(Window win, Appearance *l);
130
131 void render_startup(void);
132 void init_appearance(Appearance *l);
133 void x_paint(Window win, Appearance *l);
134 void gl_paint(Window win, Appearance *l);
135 void render_shutdown(void);
136 Appearance *appearance_new(int numtex);
137 Appearance *appearance_copy(Appearance *a);
138 void appearance_free(Appearance *a);
139 void truecolor_startup(void);
140 void pseudocolor_startup(void);
141 void pixel32_to_pixmap(pixel32 *in, Pixmap out, int x, int y, int w, int h);
142
143 void appearance_minsize(Appearance *l, int *w, int *h);
144
145 gboolean render_pixmap_to_rgba(Pixmap pmap, Pixmap mask,
146                                int *w, int *h, pixel32 **data);
147
148 #endif /*__render_h*/