--- gradient.c.orig	2005-11-13 00:48:40.000000000 +1000
+++ gradient.c	2005-11-14 01:25:37.000000000 +1000
@@ -23,6 +23,7 @@
 #include "gradient.h"
 #include "util.h"
 #include <string.h>
+#include <math.h>
 
 /* This is all Alfredo's and Dan's usual very nice WindowMaker code,
  * slightly GTK-ized
@@ -379,6 +380,67 @@
 
 /*
  *----------------------------------------------------------------------
+ * meta_gradient_create_radial--
+ *      Renders a radial linear gradient of the specified size in the
+ * GdkPixbuf format with a border of the specified type.
+ *
+ * Returns:
+ *      A 24bit GdkPixbuf with the gradient (no alpha channel).
+ *
+ * Side effects:
+ *      None
+ *----------------------------------------------------------------------
+ */
+
+
+static GdkPixbuf*
+meta_gradient_create_radial (int width, int height,
+                               int x1, int y1,
+                               int x2, int y2,
+                               const GdkColor *from,
+                               const GdkColor *to)
+{
+  GdkPixbuf *pixbuf, *tmp;
+  int x, y;
+  unsigned char *ptr;
+  unsigned char *pixels;
+  int rowstride;
+  int n_channels;
+  int radius = (int)sqrt((float)((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
+ 
+  pixbuf = blank_pixbuf (width, height, FALSE);
+  if (pixbuf == NULL)
+    return NULL;
+    
+  pixels = gdk_pixbuf_get_pixels (pixbuf);
+  rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+
+  tmp = meta_gradient_create_horizontal (radius, 1, from, to);
+  if (!tmp)
+    {
+      g_object_unref (G_OBJECT (pixbuf));
+      return NULL;
+    }
+  
+  ptr = gdk_pixbuf_get_pixels (tmp);
+  n_channels = gdk_pixbuf_get_n_channels(pixbuf);
+
+  for (x = 0; x < width; x++)
+    for (y = 0; y < height; y++)
+    {
+      int current_distance = (int)sqrt((float)((x - x1) * (x - x1) + (y - y1) * (y - y1)));
+      if(current_distance >= radius)
+        current_distance = radius - 1;
+      memcpy(&pixels[y * rowstride + n_channels * x], &ptr[3 * current_distance], 3);
+    }
+
+  g_object_unref (G_OBJECT (tmp));
+  return pixbuf;
+}
+
+
+/*
+ *----------------------------------------------------------------------
  * meta_gradient_create_diagonal--
  *      Renders a diagonal linear gradient of the specified size in the
  * GdkPixbuf format with a border of the specified type.
