]> icculus.org git repositories - dana/openbox.git/blob - render/render.h
filled out rgba
[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     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 width;
106     int height;
107     unsigned long *data;
108 /* cached scaled so we don't have to scale often */
109     int cwidth;
110     int cheight;
111     unsigned long *cache;
112 } TextureRGBA;
113
114 typedef union {
115     TextureRGBA rgba;
116     TextureText text;
117     TextureMask mask;
118 } TextureData;
119
120 typedef struct Texture {
121     Rect position;
122     TextureType type;
123     TextureData data;
124 } Texture;
125
126 typedef struct Appearance {
127     Surface surface;
128     int textures;
129     Texture *texture;
130     Pixmap pixmap;
131     XftDraw *xftdraw;
132 } Appearance;
133
134 extern Visual *render_visual;
135 extern int render_depth;
136 extern Colormap render_colormap;
137
138 void (*paint)(Window win, Appearance *l, int x, int y, int w, int h);
139
140 void render_startup(void);
141 void init_appearance(Appearance *l);
142 void x_paint(Window win, Appearance *l, int x, int y, int w, int h);
143 void render_shutdown(void);
144 Appearance *appearance_new(SurfaceType type, int numtex);
145 Appearance *appearance_copy(Appearance *a);
146 void appearance_free(Appearance *a);
147 void truecolor_startup(void);
148 #endif /*__render_h*/