- if (type == other_type && n0 == n1)
- {
- gdouble offset0, red0, green0, blue0, alpha0;
- gdouble offset1, red1, green1, blue1, alpha1;
- gdouble x00, x01, y00, y01, x10, x11, y10, y11;
- gdouble r00, r01, r10, r11;
- guint i;
-
- if (type == CAIRO_PATTERN_TYPE_LINEAR)
- {
- cairo_pattern_get_linear_points (bg->pattern, &x00, &y00, &x01, &y01);
- cairo_pattern_get_linear_points (other_pattern, &x10, &y10, &x11, &y11);
-
- new_pattern = cairo_pattern_create_linear (x00 + (x10 - x00) * progress,
- y00 + (y10 - y00) * progress,
- x01 + (x11 - x01) * progress,
- y01 + (y11 - y01) * progress);
- }
- else
- {
- cairo_pattern_get_radial_circles (bg->pattern, &x00, &y00, &r00, &x01, &y01, &r01);
- cairo_pattern_get_radial_circles (other_pattern, &x10, &y10, &r10, &x11, &y11, &r11);
-
- new_pattern = cairo_pattern_create_radial (x00 + (x10 - x00) * progress,
- y00 + (y10 - y00) * progress,
- r00 + (r10 - r00) * progress,
- x01 + (x11 - x01) * progress,
- y01 + (y11 - y01) * progress,
- r01 + (r11 - r01) * progress);
- }
-
- cairo_pattern_set_filter (new_pattern, CAIRO_FILTER_FAST);
- i = 0;
-
- /* Blend both gradients into one */
- while (i < n0 && i < n1)
- {
- cairo_pattern_get_color_stop_rgba (bg->pattern, i,
- &offset0,
- &red0, &green0, &blue0,
- &alpha0);
- cairo_pattern_get_color_stop_rgba (other_pattern, i,
- &offset1,
- &red1, &green1, &blue1,
- &alpha1);
-
- cairo_pattern_add_color_stop_rgba (new_pattern,
- offset0 + ((offset1 - offset0) * progress),
- red0 + ((red1 - red0) * progress),
- green0 + ((green1 - green0) * progress),
- blue0 + ((blue1 - blue0) * progress),
- alpha0 + ((alpha1 - alpha0) * progress));
- i++;
- }
- }
- else
- {
- cairo_save (cr);