]> icculus.org git repositories - dana/openbox.git/blob - render2/render.h
add colors. get ready for adding fonts. add debug() for printnig debug messages
[dana/openbox.git] / render2 / render.h
1 #ifndef __render_h__
2 #define __render_h__
3
4 #include <glib.h>
5 #include <X11/Xlib.h>
6
7 /* initialization */
8
9 struct RrInstance;
10
11 /*! Returns a struct to be used when calling members of the library.
12   If the library fails to initialize, NULL is returned.
13   @param display The X Display to use.
14   @param screen The number of the screen to use.
15 */
16 struct RrInstance *RrInit(Display *display,
17                           int screen);
18
19 /*! Destroys an instance of the library. The instance should not be used after
20   calling this function.
21   @param inst The instance to destroy.
22 */
23 void RrDestroy(struct RrInstance *inst);
24
25
26 /* colors */
27
28 /*! A Color (including alpha component) for the Render library. This should be
29   treated as an opaque data type, and be accessed only via the available
30   functions. */
31 struct RrColor {
32     /*! The red component. */
33     float r;
34     /*! The green component. */
35     float g;
36     /*! The blue component. */
37     float b;
38     /*! The alpha component. */
39     float a;
40 };
41
42 /*! Returns the red component for an RrColor */
43 #define RrColorRed(c) (c)->r
44 /*! Returns the green component for an RrColor */
45 #define RrColorGreen(c) (c)->g
46 /*! Returns the blue component for an RrColor */
47 #define RrColorBlue(c) (c)->b
48 /*! Returns the alpha component for an RrColor */
49 #define RrColorAlpha(c) (c)->a
50
51 /*! Sets the values of all components for an RrColor */
52 #define RrColorSet(c, w, x, y, z) (c)->r = (w), (c)->g = (x), \
53                                   (c)->b = (y), (c)->a = z
54
55
56 /*! Gets color values from a colorname.
57   @param inst An instance of the library
58   @param colorname The name of the color.
59   @param ret The RrColor to set the colorvalues in.
60   @return nonzero if the colorname could be parsed; on error, it returns zero.
61 */
62 int RrColorParse(struct RrInstance *inst, const char *colorname,
63                  struct RrColor *ret);
64
65 /* fonts */
66
67 struct RrFont;
68
69 #endif