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 *RrInstanceNew(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 RrInstanceFree(struct RrInstance *inst);
25 int RrInstanceDepth(struct RrInstance *inst);
26 Colormap RrInstanceColormap(struct RrInstance *inst);
27 Visual *RrInstanceVisual(struct RrInstance *inst);
31 /*! A Color (including alpha component) for the Render library. This should be
32 treated as an opaque data type, and be accessed only via the available
35 /*! The red component. */
37 /*! The green component. */
39 /*! The blue component. */
41 /*! The alpha component. */
45 /*! Returns if an RrColor is non-opaque */
46 #define RrColorHasAlpha(c) ((c).a > 0.0000001)
48 /*! Sets the values of all components for an RrColor */
49 #define RrColorSet(c, w, x, y, z) (c)->r = (w), (c)->g = (x), \
50 (c)->b = (y), (c)->a = z
53 /*! Gets color values from a colorname.
54 @param inst An instance of the library
55 @param colorname The name of the color.
56 @param ret The RrColor to set the colorvalues in.
57 @return nonzero if the colorname could be parsed; on error, it returns zero.
59 int RrColorParse(struct RrInstance *inst, const char *colorname,
66 struct RrFont *RrFontOpen(struct RrInstance *inst, const char *fontstring);
67 void RrFontClose(struct RrFont *font);
69 int RrFontMeasureString(struct RrFont *font, const char *string);
70 int RrFontHeight(struct RrFont *font);
71 int RrFontMaxCharWidth(struct RrFont *font);
83 /*! Create a new RrSurface prototype that can't render. A prototype can be
84 copied to a new RrSurface that can render. */
85 struct RrSurface *RrSurfaceNewProto(enum RrSurfaceType type,
87 /*! Create a new top-level RrSurface for a Window. The new RrSurface defaults
88 to a non-visible state.*/
89 struct RrSurface *RrSurfaceNew(struct RrInstance *inst,
90 enum RrSurfaceType type,
93 /*! Create a new RrSurface which is a child of another. The new RrSurface
94 defaults to a visible state. */
95 struct RrSurface *RrSurfaceNewChild(enum RrSurfaceType type,
96 struct RrSurface *parent,
98 /*! Copy an RrSurface, creating a new top-level RrSurface for a Window. The
99 new RrSurface defaults to a non-visible state.*/
100 struct RrSurface *RrSurfaceCopy(struct RrInstance *inst,
101 struct RrSurface *sur,
103 /*! Copy an RrSurface, creating a nwe RrSurface which is a child of another.
104 The new RrSurface defaults to a visible state.*/
105 struct RrSurface *RrSurfaceCopyChild(struct RrSurface *sur,
106 struct RrSurface *parent);
107 /*! Destroys an RrSurface. */
108 void RrSurfaceFree(struct RrSurface *sur);
110 void RrSurfaceSetArea(struct RrSurface *sur,
115 void RrSurfaceSetPos(struct RrSurface *sur,
118 void RrSurfaceSetSize(struct RrSurface *sur,
122 Window RrSurfaceWindow(struct RrSurface *sur);
124 void RrSurfaceShow(struct RrSurface *sur);
125 void RrSurfaceHide(struct RrSurface *sur);
126 int RrSurfaceVisible(struct RrSurface *sur);
128 void RrSurfaceMinSize(struct RrSurface *sur,
132 /*! Shape a surface to its children. This is not done implicitly inside the
133 library at *any* time. You must call this for each surface you want to
134 shape, when you want to update it. This means when you resize the surface
135 or change its base shape, or move/resize any of its children, you will need
136 to call this explicitly. Also, please note that you must call it on the
137 children surfaces first and work your way up to the top level surface for it
138 to function properly.
140 void RrSurfaceShape(struct RrSurface *sur);
142 /*! Set the base shape for a surface. To clear the base, pass 0 for all
143 of the arguments (except for the surface of course!)
145 void RrSurfaceShapeSetBase(struct RrSurface *sur,
150 /* planar surfaces */
152 /*! The options available for the background of an RrSurface */
153 enum RrSurfaceColorType {
154 /*! No rendering on the surface background, its contents will be
157 /*! Solid color fill. */
159 /*! Horizontal gradient. */
160 RR_PLANAR_HORIZONTAL,
161 /*! Vertical gradient. */
163 /*! Diagonal (TL->BR) gradient. */
165 /*! Cross-Diagonal (TR->BL) gradient. */
166 RR_PLANAR_CROSSDIAGONAL,
167 /*! Pipecross gradient. */
169 /*! Rectangle gradient. */
171 /*! Pyramid gradient. */
175 void RrPlanarSet(struct RrSurface *sur,
176 enum RrSurfaceColorType type,
177 struct RrColor *primary,
178 struct RrColor *secondary);
195 typedef long RrData32;
197 typedef int RrData32;
200 void RrTextureSetRGBA(struct RrSurface *sur,
207 void RrTextureSetText(struct RrSurface *sur,
210 enum RrLayout layout,
212 void RrTextureSetNone(struct RrSurface *sur,
217 /*! Paints the surface, and all its children */
218 void RrPaint(struct RrSurface *sur);
220 void RrExpose(struct RrInstance *inst, XExposeEvent *e);