[gimp] app: some disabled cairo bling code
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: some disabled cairo bling code
- Date: Fri, 18 Jun 2010 11:55:04 +0000 (UTC)
commit 8ab8a25c999df682dbb9640f939b18955944903b
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]