]> Dogcows Code - chaz/openbox/blobdiff - obrender/render.h
Need to allocate appearances!
[chaz/openbox] / obrender / render.h
index 7bea1b54bc75b7b639383676e2463a843edead0a..1ec47a265238c41218da291c54d01e3ebcbb02ad 100644 (file)
@@ -54,12 +54,14 @@ typedef guchar  RrPixel8;
 typedef enum {
     RR_RELIEF_FLAT,
     RR_RELIEF_RAISED,
-    RR_RELIEF_SUNKEN
+    RR_RELIEF_SUNKEN,
+    RR_RELIEF_NUM_TYPES
 } RrReliefType;
 
 typedef enum {
     RR_BEVEL_1,
-    RR_BEVEL_2
+    RR_BEVEL_2,
+    RR_BEVEL_NUM_TYPES
 } RrBevelType;
 
 typedef enum {
@@ -72,7 +74,8 @@ typedef enum {
     RR_SURFACE_DIAGONAL,
     RR_SURFACE_CROSS_DIAGONAL,
     RR_SURFACE_PYRAMID,
-    RR_SURFACE_MIRROR_HORIZONTAL
+    RR_SURFACE_MIRROR_HORIZONTAL,
+    RR_SURFACE_NUM_TYPES
 } RrSurfaceColorType;
 
 typedef enum {
@@ -81,13 +84,15 @@ typedef enum {
     RR_TEXTURE_TEXT,
     RR_TEXTURE_LINE_ART,
     RR_TEXTURE_RGBA,
-    RR_TEXTURE_IMAGE
+    RR_TEXTURE_IMAGE,
+    RR_TEXTURE_NUM_TYPES
 } RrTextureType;
 
 typedef enum {
     RR_JUSTIFY_LEFT,
     RR_JUSTIFY_CENTER,
-    RR_JUSTIFY_RIGHT
+    RR_JUSTIFY_RIGHT,
+    RR_JUSTIFY_NUM_TYPES
 } RrJustify;
 
 /* Put middle first so it's the default */
@@ -95,7 +100,8 @@ typedef enum {
     RR_ELLIPSIZE_MIDDLE,
     RR_ELLIPSIZE_NONE,
     RR_ELLIPSIZE_START,
-    RR_ELLIPSIZE_END
+    RR_ELLIPSIZE_END,
+    RR_ELLIPSIZE_NUM_TYPES
 } RrEllipsizeMode;
 
 typedef enum {
@@ -103,13 +109,15 @@ typedef enum {
     RR_FONTWEIGHT_NORMAL,
     RR_FONTWEIGHT_SEMIBOLD,
     RR_FONTWEIGHT_BOLD,
-    RR_FONTWEIGHT_ULTRABOLD
+    RR_FONTWEIGHT_ULTRABOLD,
+    RR_FONTWEIGHT_NUM_TYPES
 } RrFontWeight;
 
 typedef enum {
     RR_FONTSLANT_NORMAL,
     RR_FONTSLANT_ITALIC,
-    RR_FONTSLANT_OBLIQUE
+    RR_FONTSLANT_OBLIQUE,
+    RR_FONTSLANT_NUM_TYPES
 } RrFontSlant;
 
 struct _RrSurface {
@@ -230,8 +238,14 @@ struct _RrImagePic {
     /* The sum of all the pixels.  This is used to compare pictures if their
        hashes match. */
     gint sum;
+    /* The name of the image.  This is used to determine
+       if the named image already is loaded.  May be NULL if the image
+       was not loaded from disk. */
+    gchar *name;
 };
 
+typedef void (*RrImageDestroyFunc)(RrImage *image, gpointer data);
+
 /*! 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 */
@@ -250,6 +264,11 @@ struct _RrImage {
       RrImage. */
     RrImagePic **resized;
     gint n_resized;
+
+    /* This function (if not NULL) will be called just before destroying
+      RrImage. */
+    RrImageDestroyFunc destroy_func;
+    gpointer           destroy_data;
 };
 
 /* these are the same on all endian machines because it seems to be dependant
@@ -284,6 +303,7 @@ gint     RrGreenMask    (const RrInstance *inst);
 gint     RrBlueMask     (const RrInstance *inst);
 
 RrColor *RrColorNew   (const RrInstance *inst, gint r, gint g, gint b);
+RrColor *RrColorCopy  (RrColor *c);
 RrColor *RrColorParse (const RrInstance *inst, gchar *colorname);
 void     RrColorFree  (RrColor *in);
 
@@ -305,6 +325,8 @@ RrFont *RrFontOpen          (const RrInstance *inst, const gchar *name,
                              gint size, RrFontWeight weight, RrFontSlant slant);
 RrFont *RrFontOpenDefault   (const RrInstance *inst);
 void    RrFontClose         (RrFont *f);
+/*! Returns an RrSize, that was allocated with g_slice_new().  Use g_slice_free() to
+  free it. */
 RrSize *RrFontMeasureString (const RrFont *f, const gchar *str,
                              gint shadow_offset_x, gint shadow_offset_y,
                              gboolean flow, gint maxwidth);
@@ -337,12 +359,19 @@ void          RrImageCacheUnref(RrImageCache *self);
 /*! Finds an image in the cache, if it is already in there */
 RrImage*      RrImageCacheFind(RrImageCache *self,
                                RrPixel32 *data, gint w, gint h);
+/*! Finds an image in the cache, by searching for the name of the image */
+RrImage*      RrImageCacheFindName(RrImageCache *self,
+                                   const gchar *name);
 
 RrImage* RrImageNew(RrImageCache *cache);
 void     RrImageRef(RrImage *im);
 void     RrImageUnref(RrImage *im);
 
-void     RrImageAddPicture(RrImage *im, RrPixel32 *data, gint w, gint h);
+void     RrImageAddPicture(RrImage *im, const RrPixel32 *data, gint w, gint h);
+/*! Adds a picture by name, from a file on disk. 
+  @name Can be a full path to an image, or it can be a name as per the
+        freedesktop.org icon spec. */
+gboolean RrImageAddPictureName(RrImage *im, const gchar *name);
 void     RrImageRemovePicture(RrImage *im, gint w, gint h);
 
 G_END_DECLS
This page took 0.023945 seconds and 4 git commands to generate.