+ /* cached for internal use */
+ gint w, h;
+};
+
+/*! Holds a RGBA image picture */
+struct _RrImagePic {
+ gint width, height;
+ RrPixel32 *data;
+ /* The sum of all the pixels. This is used to compare pictures if their
+ hashes match. */
+ gint sum;
+};
+
+/*! An RrImage is a sort of meta-image. It can contain multiple versions of
+ an image at different sizes, which may or may not be completely different
+ pictures */
+struct _RrImage {
+ gint ref;
+ RrImageCache *cache;
+
+ /*! An array of "originals", that is of RrPictures that have been added
+ to the image in various sizes, and that have not been resized. These
+ are explicitly added to the RrImage. */
+ RrImagePic **original;
+ gint n_original;
+ /*! An array of "resized" pictures. When an "original" RrPicture
+ needs to be resized for drawing, it is saved in here so that it doesn't
+ need to be resized again. These are automatically added to the
+ RrImage. */
+ RrImagePic **resized;
+ gint n_resized;
+};
+
+/* these are the same on all endian machines because it seems to be dependant
+ on the endianness of the gfx card, not the cpu. */
+#define RrDefaultAlphaOffset 24
+#define RrDefaultRedOffset 16
+#define RrDefaultGreenOffset 8
+#define RrDefaultBlueOffset 0
+
+#define RrDefaultFontFamily "arial,sans"
+#define RrDefaultFontSize 8
+#define RrDefaultFontWeight RR_FONTWEIGHT_NORMAL
+#define RrDefaultFontSlant RR_FONTSLANT_NORMAL
+
+RrInstance* RrInstanceNew (Display *display, gint screen);
+void RrInstanceFree (RrInstance *inst);
+
+Display* RrDisplay (const RrInstance *inst);
+gint RrScreen (const RrInstance *inst);
+Window RrRootWindow (const RrInstance *inst);
+Visual* RrVisual (const RrInstance *inst);
+gint RrDepth (const RrInstance *inst);
+Colormap RrColormap (const RrInstance *inst);
+gint RrRedOffset (const RrInstance *inst);
+gint RrGreenOffset (const RrInstance *inst);
+gint RrBlueOffset (const RrInstance *inst);
+gint RrRedShift (const RrInstance *inst);
+gint RrGreenShift (const RrInstance *inst);
+gint RrBlueShift (const RrInstance *inst);
+gint RrRedMask (const RrInstance *inst);
+gint RrGreenMask (const RrInstance *inst);
+gint RrBlueMask (const RrInstance *inst);
+
+RrColor *RrColorNew (const RrInstance *inst, gint r, gint g, gint b);
+RrColor *RrColorParse (const RrInstance *inst, gchar *colorname);
+void RrColorFree (RrColor *in);
+
+gint RrColorRed (const RrColor *c);
+gint RrColorGreen (const RrColor *c);
+gint RrColorBlue (const RrColor *c);
+gulong RrColorPixel (const RrColor *c);
+GC RrColorGC (RrColor *c);
+
+RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
+RrAppearance *RrAppearanceCopy (RrAppearance *a);
+void RrAppearanceFree (RrAppearance *a);
+void RrAppearanceRemoveTextures(RrAppearance *a);
+void RrAppearanceAddTextures(RrAppearance *a, gint numtex);
+/*! Always call this when changing the type of a texture in an appearance */
+void RrAppearanceClearTextures(RrAppearance *a);
+
+RrFont *RrFontOpen (const RrInstance *inst, const gchar *name,
+ gint size, RrFontWeight weight, RrFontSlant slant);
+RrFont *RrFontOpenDefault (const RrInstance *inst);
+void RrFontClose (RrFont *f);
+RrSize *RrFontMeasureString (const RrFont *f, const gchar *str,
+ gint shadow_offset_x, gint shadow_offset_y,
+ gboolean flow, gint maxwidth);
+gint RrFontHeight (const RrFont *f, gint shadow_offset_y);
+gint RrFontMaxCharWidth (const RrFont *f);
+
+/* Paint into the appearance. The old pixmap is returned (if there was one). It
+ is the responsibility of the caller to call XFreePixmap on the return when
+ it is non-null. */
+Pixmap RrPaintPixmap (RrAppearance *a, gint w, gint h);
+void RrPaint (RrAppearance *a, Window win, gint w, gint h);
+void RrMinSize (RrAppearance *a, gint *w, gint *h);
+gint RrMinWidth (RrAppearance *a);
+/* For text textures, if flow is TRUE, then the string must be set before
+ calling this, otherwise it doesn't need to be */
+gint RrMinHeight (RrAppearance *a);
+void RrMargins (RrAppearance *a, gint *l, gint *t, gint *r, gint *b);
+
+gboolean RrPixmapToRGBA(const RrInstance *inst,
+ Pixmap pmap, Pixmap mask,
+ gint *w, gint *h, RrPixel32 **data);
+
+/*! Create a new image cache for RrImages.
+ @param max_resized_saved The number of resized copies of an image to save
+*/
+RrImageCache* RrImageCacheNew(gint max_resized_saved);
+void RrImageCacheRef(RrImageCache *self);
+void RrImageCacheUnref(RrImageCache *self);