]> Dogcows Code - chaz/openbox/blob - render/render.h
try another scaling algo for the icons
[chaz/openbox] / render / render.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 render.h for the Openbox window manager
4 Copyright (c) 2003 Ben Jansens
5 Copyright (c) 2003 Derek Foreman
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #ifndef __render_h
21 #define __render_h
22
23 #include "geom.h"
24 #include "version.h"
25
26 #include <X11/Xlib.h> /* some platforms dont include this as needed for Xft */
27 #define _XFT_NO_COMPAT_ /* no Xft 1 API */
28 #include <X11/Xft/Xft.h>
29 #include <glib.h>
30
31 G_BEGIN_DECLS
32
33 typedef union _RrTextureData RrTextureData;
34 typedef struct _RrAppearance RrAppearance;
35 typedef struct _RrSurface RrSurface;
36 typedef struct _RrFont RrFont;
37 typedef struct _RrTexture RrTexture;
38 typedef struct _RrTextureMask RrTextureMask;
39 typedef struct _RrTextureRGBA RrTextureRGBA;
40 typedef struct _RrTextureText RrTextureText;
41 typedef struct _RrTextureLineArt RrTextureLineArt;
42 typedef struct _RrPixmapMask RrPixmapMask;
43 typedef struct _RrInstance RrInstance;
44 typedef struct _RrColor RrColor;
45
46 typedef guint32 RrPixel32;
47 typedef guint16 RrPixel16;
48
49 typedef enum {
50 RR_RELIEF_FLAT,
51 RR_RELIEF_RAISED,
52 RR_RELIEF_SUNKEN
53 } RrReliefType;
54
55 typedef enum {
56 RR_BEVEL_1,
57 RR_BEVEL_2
58 } RrBevelType;
59
60 typedef enum {
61 RR_SURFACE_NONE,
62 RR_SURFACE_PARENTREL,
63 RR_SURFACE_SOLID,
64 RR_SURFACE_HORIZONTAL,
65 RR_SURFACE_VERTICAL,
66 RR_SURFACE_DIAGONAL,
67 RR_SURFACE_CROSS_DIAGONAL,
68 RR_SURFACE_PYRAMID
69 } RrSurfaceColorType;
70
71 typedef enum {
72 RR_TEXTURE_NONE,
73 RR_TEXTURE_MASK,
74 RR_TEXTURE_TEXT,
75 RR_TEXTURE_LINE_ART,
76 RR_TEXTURE_RGBA
77 } RrTextureType;
78
79 typedef enum {
80 RR_JUSTIFY_LEFT,
81 RR_JUSTIFY_CENTER,
82 RR_JUSTIFY_RIGHT
83 } RrJustify;
84
85 struct _RrSurface {
86 RrSurfaceColorType grad;
87 RrReliefType relief;
88 RrBevelType bevel;
89 RrColor *primary;
90 RrColor *secondary;
91 RrColor *border_color;
92 RrColor *bevel_dark;
93 RrColor *bevel_light;
94 RrColor *interlace_color;
95 gboolean interlaced;
96 gboolean border;
97 RrAppearance *parent;
98 gint parentx;
99 gint parenty;
100 RrPixel32 *pixel_data;
101 };
102
103 struct _RrTextureText {
104 RrFont *font;
105 RrJustify justify;
106 RrColor *color;
107 gchar *string;
108 };
109
110 struct _RrPixmapMask {
111 const RrInstance *inst;
112 Pixmap mask;
113 gint width;
114 gint height;
115 gchar *data;
116 };
117
118 struct _RrTextureMask {
119 RrColor *color;
120 RrPixmapMask *mask;
121 };
122
123 struct _RrTextureRGBA {
124 gint width;
125 gint height;
126 RrPixel32 *data;
127 /* cached scaled so we don't have to scale often */
128 gint cwidth;
129 gint cheight;
130 RrPixel32 *cache;
131 };
132
133 struct _RrTextureLineArt {
134 RrColor *color;
135 gint x1;
136 gint y1;
137 gint x2;
138 gint y2;
139 };
140
141 union _RrTextureData {
142 RrTextureRGBA rgba;
143 RrTextureText text;
144 RrTextureMask mask;
145 RrTextureLineArt lineart;
146 };
147
148 struct _RrTexture {
149 RrTextureType type;
150 RrTextureData data;
151 };
152
153 struct _RrAppearance {
154 const RrInstance *inst;
155
156 RrSurface surface;
157 gint textures;
158 RrTexture *texture;
159 Pixmap pixmap;
160 XftDraw *xftdraw;
161
162 /* cached for internal use */
163 gint w, h;
164 };
165
166 /* these are the same on all endian machines because it seems to be dependant
167 on the endianness of the gfx card, not the cpu. */
168 #define RrDefaultAlphaOffset 24
169 #define RrDefaultRedOffset 16
170 #define RrDefaultGreenOffset 8
171 #define RrDefaultBlueOffset 0
172
173 RrInstance* RrInstanceNew (Display *display, gint screen);
174 void RrInstanceFree (RrInstance *inst);
175
176 Display* RrDisplay (const RrInstance *inst);
177 gint RrScreen (const RrInstance *inst);
178 Window RrRootWindow (const RrInstance *inst);
179 Visual* RrVisual (const RrInstance *inst);
180 gint RrDepth (const RrInstance *inst);
181 Colormap RrColormap (const RrInstance *inst);
182 gint RrRedOffset (const RrInstance *inst);
183 gint RrGreenOffset (const RrInstance *inst);
184 gint RrBlueOffset (const RrInstance *inst);
185 gint RrRedShift (const RrInstance *inst);
186 gint RrGreenShift (const RrInstance *inst);
187 gint RrBlueShift (const RrInstance *inst);
188 gint RrRedMask (const RrInstance *inst);
189 gint RrGreenMask (const RrInstance *inst);
190 gint RrBlueMask (const RrInstance *inst);
191
192 RrColor *RrColorNew (const RrInstance *inst, gint r, gint g, gint b);
193 RrColor *RrColorParse (const RrInstance *inst, gchar *colorname);
194 void RrColorFree (RrColor *in);
195
196 gint RrColorRed (const RrColor *c);
197 gint RrColorGreen (const RrColor *c);
198 gint RrColorBlue (const RrColor *c);
199 gulong RrColorPixel (const RrColor *c);
200 GC RrColorGC (RrColor *c);
201
202 RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
203 RrAppearance *RrAppearanceCopy (RrAppearance *a);
204 void RrAppearanceFree (RrAppearance *a);
205
206 RrSize *RrFontMeasureString (const RrFont *f, const gchar *str);
207 gint RrFontHeight (const RrFont *f);
208 gint RrFontMaxCharWidth (const RrFont *f);
209
210 void RrPaint (RrAppearance *a, Window win, gint w, gint h);
211 void RrMinsize (RrAppearance *a, gint *w, gint *h);
212 void RrMargins (RrAppearance *a, gint *l, gint *t, gint *r, gint *b);
213
214 gboolean RrPixmapToRGBA(const RrInstance *inst,
215 Pixmap pmap, Pixmap mask,
216 gint *w, gint *h, RrPixel32 **data);
217
218 G_END_DECLS
219
220 #endif /*__render_h*/
This page took 0.042708 seconds and 4 git commands to generate.