]> Dogcows Code - chaz/openbox/blob - render/render.h
keep XVisualInfo around in preparation for opengl stuff
[chaz/openbox] / 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 } SurfaceColorType;
38
39 typedef enum {
40 Bitmask,
41 Text,
42 RGBA,
43 NoTexture
44 } TextureType;
45
46 struct Appearance;
47
48 typedef struct PlanarSurface {
49 SurfaceColorType grad;
50 ReliefType relief;
51 BevelType bevel;
52 color_rgb *primary;
53 color_rgb *secondary;
54 color_rgb *border_color;
55 color_rgb *bevel_dark;
56 color_rgb *bevel_light;
57 gboolean interlaced;
58 gboolean border;
59 struct Appearance *parent;
60 int parentx;
61 int parenty;
62 pixel32 *pixel_data;
63 } PlanarSurface;
64
65 typedef struct NonplanarSurface {
66 int poo;
67 } NonplanarSurface;
68
69 typedef union {
70 PlanarSurface planar;
71 NonplanarSurface nonplanar;
72 } SurfaceData;
73
74 typedef struct Surface {
75 SurfaceType type;
76 SurfaceColorType colortype;
77 SurfaceData data;
78 } Surface;
79
80 typedef struct {
81 XftFont *xftfont;
82 int height;
83 int elipses_length;
84 } ObFont;
85
86 typedef enum {
87 Justify_Center,
88 Justify_Left,
89 Justify_Right
90 } Justify;
91
92 typedef struct TextureText {
93 ObFont *font;
94 Justify justify;
95 int shadow;
96 char tint;
97 unsigned char offset;
98 color_rgb *color;
99 char *string;
100 } TextureText;
101
102 typedef struct {
103 Pixmap mask;
104 guint w, h;
105 char *data;
106 } pixmap_mask;
107
108 typedef struct TextureMask {
109 color_rgb *color;
110 pixmap_mask *mask;
111 } TextureMask;
112
113 typedef struct TextureRGBA {
114 guint width;
115 guint height;
116 pixel32 *data;
117 /* cached scaled so we don't have to scale often */
118 guint cwidth;
119 guint cheight;
120 pixel32 *cache;
121 } TextureRGBA;
122
123 typedef union {
124 TextureRGBA rgba;
125 TextureText text;
126 TextureMask mask;
127 } TextureData;
128
129 typedef struct Texture {
130 Rect position;
131 TextureType type;
132 TextureData data;
133 } Texture;
134
135 typedef struct Appearance {
136 Surface surface;
137 Rect area;
138 int textures;
139 Texture *texture;
140 Pixmap pixmap;
141 XftDraw *xftdraw;
142 } Appearance;
143
144 extern Visual *render_visual;
145 extern XVisualInfo render_visual_info;
146 extern int render_depth;
147 extern Colormap render_colormap;
148
149 void (*paint)(Window win, Appearance *l);
150
151 void render_startup(void);
152 void init_appearance(Appearance *l);
153 void x_paint(Window win, Appearance *l);
154 void render_shutdown(void);
155 Appearance *appearance_new(SurfaceType type, int numtex);
156 Appearance *appearance_copy(Appearance *a);
157 void appearance_free(Appearance *a);
158 void truecolor_startup(void);
159 void pseudocolor_startup(void);
160 void pixel32_to_pixmap(pixel32 *in, Pixmap out, int x, int y, int w, int h);
161
162 void appearance_minsize(Appearance *l, int *w, int *h);
163
164 gboolean render_pixmap_to_rgba(Pixmap pmap, Pixmap mask,
165 int *w, int *h, pixel32 **data);
166
167 #endif /*__render_h*/
This page took 0.047953 seconds and 5 git commands to generate.