From eaaa3520562b9e72d3ced47dc5e85f7118944a10 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 27 Aug 2007 21:36:59 -0700 Subject: [PATCH] Change animation to use correct background colors --- xoboot.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/xoboot.c b/xoboot.c index eee192f..ee68289 100644 --- a/xoboot.c +++ b/xoboot.c @@ -8,6 +8,23 @@ typedef struct _state { double progress; } state_t; +typedef struct _color { + double r; + double g; + double b; +} color_t; + +#define HEX_COLOR(r,g,b) {(r) / 255.0, (g) / 255.0, (b) / 255.0} + +color_t background[2] = { + HEX_COLOR (0x75, 0x75, 0x75), + HEX_COLOR (0xdb, 0xdc, 0xdf) +}; + +#define LERP(a,b,t) ((a) + (t) * ((b) - (a))) +#define LERP_COLORS(c0, c1, t) LERP((c0).r, (c1).r, (t)), \ + LERP((c0).g, (c1).g, (t)), \ + LERP((c0).b, (c1).b, (t)) static gboolean xoboot_expose_event (GtkWidget *widget, GdkEventExpose *event, @@ -18,7 +35,9 @@ xoboot_expose_event (GtkWidget *widget, cr = gdk_cairo_create (widget->window); - cairo_set_source_rgb (cr, state->progress, 0, 0); + cairo_set_source_rgb (cr, LERP_COLORS (background[0], + background[1], + state->progress)); cairo_paint (cr); cairo_destroy (cr); -- 2.43.0