1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 render.h for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
6 Copyright (c) 2003 Derek Foreman
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 See the COPYING file for a copy of the GNU General Public License.
27 #include <X11/Xlib.h> /* some platforms dont include this as needed for Xft */
28 #include <pango/pangoxft.h>
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
;
46 typedef guint32 RrPixel32
;
47 typedef guint16 RrPixel16
;
48 typedef guchar RrPixel8
;
65 RR_SURFACE_SPLIT_VERTICAL
,
66 RR_SURFACE_HORIZONTAL
,
69 RR_SURFACE_CROSS_DIAGONAL
,
71 RR_SURFACE_MIRROR_HORIZONTAL
88 /* Put middle first so it's the default */
99 RR_FONTWEIGHT_SEMIBOLD
,
101 RR_FONTWEIGHT_ULTRABOLD
111 RrSurfaceColorType grad
;
116 RrColor
*border_color
;
118 RrColor
*bevel_light
;
119 RrColor
*interlace_color
;
122 RrAppearance
*parent
;
125 RrPixel32
*pixel_data
;
126 gint bevel_dark_adjust
; /* 0-255, default is 64 */
127 gint bevel_light_adjust
; /* 0-255, default is 128 */
128 RrColor
*split_primary
;
129 RrColor
*split_secondary
;
132 struct _RrTextureText
{
137 gint shadow_offset_x
;
138 gint shadow_offset_y
;
139 RrColor
*shadow_color
;
141 gboolean shortcut
; /*!< Underline a character */
142 guint shortcut_pos
; /*!< Position in bytes of the character to underline */
143 RrEllipsizeMode ellipsize
;
146 struct _RrPixmapMask
{
147 const RrInstance
*inst
;
154 struct _RrTextureMask
{
159 struct _RrTextureRGBA
{
164 /* cached scaled so we don't have to scale often */
168 /* size and position to draw at */
175 struct _RrTextureLineArt
{
183 union _RrTextureData
{
187 RrTextureLineArt lineart
;
195 struct _RrAppearance
{
196 const RrInstance
*inst
;
204 /* cached for internal use */
208 /* these are the same on all endian machines because it seems to be dependant
209 on the endianness of the gfx card, not the cpu. */
210 #define RrDefaultAlphaOffset 24
211 #define RrDefaultRedOffset 16
212 #define RrDefaultGreenOffset 8
213 #define RrDefaultBlueOffset 0
215 #define RrDefaultFontFamily "arial,sans"
216 #define RrDefaultFontSize 8
217 #define RrDefaultFontWeight RR_FONTWEIGHT_NORMAL
218 #define RrDefaultFontSlant RR_FONTSLANT_NORMAL
220 RrInstance
* RrInstanceNew (Display
*display
, gint screen
);
221 void RrInstanceFree (RrInstance
*inst
);
223 Display
* RrDisplay (const RrInstance
*inst
);
224 gint
RrScreen (const RrInstance
*inst
);
225 Window
RrRootWindow (const RrInstance
*inst
);
226 Visual
* RrVisual (const RrInstance
*inst
);
227 gint
RrDepth (const RrInstance
*inst
);
228 Colormap
RrColormap (const RrInstance
*inst
);
229 gint
RrRedOffset (const RrInstance
*inst
);
230 gint
RrGreenOffset (const RrInstance
*inst
);
231 gint
RrBlueOffset (const RrInstance
*inst
);
232 gint
RrRedShift (const RrInstance
*inst
);
233 gint
RrGreenShift (const RrInstance
*inst
);
234 gint
RrBlueShift (const RrInstance
*inst
);
235 gint
RrRedMask (const RrInstance
*inst
);
236 gint
RrGreenMask (const RrInstance
*inst
);
237 gint
RrBlueMask (const RrInstance
*inst
);
239 RrColor
*RrColorNew (const RrInstance
*inst
, gint r
, gint g
, gint b
);
240 RrColor
*RrColorParse (const RrInstance
*inst
, gchar
*colorname
);
241 void RrColorFree (RrColor
*in
);
243 gint
RrColorRed (const RrColor
*c
);
244 gint
RrColorGreen (const RrColor
*c
);
245 gint
RrColorBlue (const RrColor
*c
);
246 gulong
RrColorPixel (const RrColor
*c
);
247 GC
RrColorGC (RrColor
*c
);
249 RrAppearance
*RrAppearanceNew (const RrInstance
*inst
, gint numtex
);
250 RrAppearance
*RrAppearanceCopy (RrAppearance
*a
);
251 void RrAppearanceFree (RrAppearance
*a
);
252 void RrAppearanceAddTextures(RrAppearance
*a
, gint numtex
);
254 RrFont
*RrFontOpen (const RrInstance
*inst
, const gchar
*name
,
255 gint size
, RrFontWeight weight
, RrFontSlant slant
);
256 RrFont
*RrFontOpenDefault (const RrInstance
*inst
);
257 void RrFontClose (RrFont
*f
);
258 RrSize
*RrFontMeasureString (const RrFont
*f
, const gchar
*str
,
259 gint shadow_offset_x
, gint shadow_offset_y
);
260 gint
RrFontHeight (const RrFont
*f
, gint shadow_offset_y
);
261 gint
RrFontMaxCharWidth (const RrFont
*f
);
263 /* Paint into the appearance. The old pixmap is returned (if there was one). It
264 is the responsibility of the caller to call XFreePixmap on the return when
266 Pixmap
RrPaintPixmap (RrAppearance
*a
, gint w
, gint h
);
267 void RrPaint (RrAppearance
*a
, Window win
, gint w
, gint h
);
268 void RrMinSize (RrAppearance
*a
, gint
*w
, gint
*h
);
269 gint
RrMinWidth (RrAppearance
*a
);
270 gint
RrMinHeight (RrAppearance
*a
);
271 void RrMargins (RrAppearance
*a
, gint
*l
, gint
*t
, gint
*r
, gint
*b
);
273 gboolean
RrPixmapToRGBA(const RrInstance
*inst
,
274 Pixmap pmap
, Pixmap mask
,
275 gint
*w
, gint
*h
, RrPixel32
**data
);
279 #endif /*__render_h*/