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.
16 struct RrInstance *RrInit(Display *display,
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.
23 void RrDestroy(struct RrInstance *inst);
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
32 /*! The red component. */
34 /*! The green component. */
36 /*! The blue component. */
38 /*! The alpha component. */
42 /*! Returns if an RrColor is non-opaque */
43 #define RrColorHasAlpha(c) ((c).a > 0.0000001)
45 /*! Sets the values of all components for an RrColor */
46 #define RrColorSet(c, w, x, y, z) (c)->r = (w), (c)->g = (x), \
47 (c)->b = (y), (c)->a = z
50 /*! Gets color values from a colorname.
51 @param inst An instance of the library
52 @param colorname The name of the color.
53 @param ret The RrColor to set the colorvalues in.
54 @return nonzero if the colorname could be parsed; on error, it returns zero.
56 int RrColorParse(struct RrInstance *inst, const char *colorname,
63 struct RrFont *RrFontOpen(struct RrInstance *inst, const char *fontstring);
64 void RrFontClose(struct RrFont *font);
66 int RrFontMeasureString(struct RrFont *font, const char *string);
67 int RrFontHeight(struct RrFont *font);
68 int RrFontMaxCharWidth(struct RrFont *font);
79 /*! Create a new RrSurface prototype that can't render. A prototype can be
80 copied to a new RrSurface that can render. */
81 struct RrSurface *RrSurfaceNewProto(enum RrSurfaceType type,
83 /*! Create a new top-level RrSurface for a Window. */
84 struct RrSurface *RrSurfaceNew(struct RrInstance *inst,
85 enum RrSurfaceType type,
88 /*! Create a new RrSurface which is a child of another. */
89 struct RrSurface *RrSurfaceNewChild(enum RrSurfaceType type,
90 struct RrSurface *parent,
92 /*! Copy an RrSurface, creating a new top-level RrSurface for a Window. */
93 struct RrSurface *RrSurfaceCopy(struct RrInstance *inst,
94 struct RrSurface *sur,
96 /*! Copy an RrSurface, creating a nwe RrSurface which is a child of another. */
97 struct RrSurface *RrSurfaceCopyChild(struct RrSurface *sur,
98 struct RrSurface *parent);
99 void RrSurfaceFree(struct RrSurface *sur);
101 void RrSurfaceSetArea(struct RrSurface *sur,
107 Window RrSurfaceWindow(struct RrSurface *sur);
109 /* planar surfaces */
111 /*! The options available for the background of an RrSurface */
112 enum RrSurfaceColorType {
113 /*! No rendering on the surface background, its contents will be
116 /*! Solid color fill. */
118 /*! Horizontal gradient. */
119 RR_PLANAR_HORIZONTAL,
120 /*! Vertical gradient. */
122 /*! Diagonal (TL->BR) gradient. */
124 /*! Cross-Diagonal (TR->BL) gradient. */
125 RR_PLANAR_CROSSDIAGONAL,
126 /*! Pipecross gradient. */
128 /*! Rectangle gradient. */
130 /*! Pyramid gradient. */
134 void RrPlanarSet(struct RrSurface *sur,
135 enum RrSurfaceColorType type,
136 struct RrColor *primary,
137 struct RrColor *secondary);
154 typedef long RrData32;
156 typedef int RrData32;
159 void RrTextureSetRGBA(struct RrSurface *sur,
166 void RrTextureSetText(struct RrSurface *sur,
169 enum RrLayout layout,
174 /*! Paints the surface, and all its children */
175 void RrPaint(struct RrSurface *sur);
176 /*! Paints the surface, and all its children, but only in the given area. */
177 void RrPaintArea(struct RrSurface *sur,