[gimp/soc-2010-cage] app: some disabled cairo bling code
- From: Michael Muré <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2010-cage] app: some disabled cairo bling code
- Date: Wed, 30 Jun 2010 22:10:03 +0000 (UTC)
commit a40cc25f7699f6838b48c30f57ecfa6f06f04050
Author: Michael Natterer <mitch gimp org>
Date: Fri Jun 18 13:51:49 2010 +0200
app: some disabled cairo bling code
that draws a gradient in the background of the frame. Not meant
seriously, just something to play with for everybody interested.
app/widgets/gimpoverlayframe.c | 67 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpoverlayframe.c b/app/widgets/gimpoverlayframe.c
index 8897f82..2d99fdf 100644
--- a/app/widgets/gimpoverlayframe.c
+++ b/app/widgets/gimpoverlayframe.c
@@ -22,9 +22,12 @@
#include <gtk/gtk.h>
+#include "libgimpmath/gimpmath.h"
+
#include "widgets-types.h"
#include "gimpoverlayframe.h"
+#include "gimpwidgets-utils.h"
static void gimp_overlay_frame_size_request (GtkWidget *widget,
@@ -181,8 +184,72 @@ gimp_overlay_frame_expose (GtkWidget *widget,
gdk_cairo_region (cr, eevent->region);
}
+/* #define BLING 1 */
+
+#ifdef BLING
+
+ {
+ GtkAllocation allocation;
+ cairo_pattern_t *gradient;
+ GimpRGB color;
+ gdouble x0, y0;
+ gdouble x1, y1;
+ gdouble w, h;
+ gdouble d, n;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ w = allocation.width - allocation.x;
+ h = allocation.height - allocation.y;
+
+ d = sqrt (SQR (w) + SQR (h));
+ n = w * h / d;
+
+ x0 = allocation.x + w / 2 - h * (n / d);
+ y0 = allocation.y + h / 2 - w * (n / d);
+
+ x1 = allocation.x + w / 2 + h * (n / d);
+ y1 = allocation.y + h / 2 + w * (n / d);
+
+ gradient = cairo_pattern_create_linear (x0, y0, x1, y1);
+
+ gimp_rgb_set_gdk_color (&color, &style->bg[GTK_STATE_NORMAL]);
+ cairo_pattern_add_color_stop_rgba (gradient,
+ 0.0,
+ color.r,
+ color.g,
+ color.b,
+ 1.0);
+ cairo_pattern_add_color_stop_rgba (gradient,
+ 1.0,
+ color.r,
+ color.g,
+ color.b,
+ 1.0);
+
+ gimp_rgb_set_gdk_color (&color, &style->bg[GTK_STATE_SELECTED]);
+ cairo_pattern_add_color_stop_rgba (gradient,
+ 0.5,
+ color.r,
+ color.g,
+ color.b,
+ 1.0);
+
+ cairo_set_source (cr, gradient);
+
+ cairo_pattern_destroy (gradient);
+
+ cairo_clip (cr);
+ }
+
+ cairo_paint (cr);
+
+#else
+
cairo_fill (cr);
+#endif
+
cairo_destroy (cr);
return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, eevent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]