Commit 9725c8d7 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

gtk/gtkstyle.c gtk/gtkcolorsel.c gtk/gtkhsv.c gtk/gtkiconview.c Update to

2005-04-18  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkstyle.c gtk/gtkcolorsel.c gtk/gtkhsv.c gtk/gtkiconview.c
        * gdk/gdkcolor.c gdk/gdkwindow.c gdk/gdkpixbuf-render.c
        gdk/gdkpango.c tests/testcairo.c: Update to new Cairo API for
        setting color and opacity. (#301066, Vincent Noel)
parent 9bd53c86
2005-04-18 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c gtk/gtkcolorsel.c gtk/gtkhsv.c gtk/gtkiconview.c
* gdk/gdkcolor.c gdk/gdkwindow.c gdk/gdkpixbuf-render.c
gdk/gdkpango.c tests/testcairo.c: Update to new Cairo API for
setting color and opacity. (#301066, Vincent Noel)
2005-04-15 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-6:
......
2005-04-18 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c gtk/gtkcolorsel.c gtk/gtkhsv.c gtk/gtkiconview.c
* gdk/gdkcolor.c gdk/gdkwindow.c gdk/gdkpixbuf-render.c
gdk/gdkpango.c tests/testcairo.c: Update to new Cairo API for
setting color and opacity. (#301066, Vincent Noel)
2005-04-15 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-6:
......
2005-04-18 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c gtk/gtkcolorsel.c gtk/gtkhsv.c gtk/gtkiconview.c
* gdk/gdkcolor.c gdk/gdkwindow.c gdk/gdkpixbuf-render.c
gdk/gdkpango.c tests/testcairo.c: Update to new Cairo API for
setting color and opacity. (#301066, Vincent Noel)
2005-04-15 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-6:
......
......@@ -383,10 +383,10 @@ void
gdk_cairo_set_source_color (cairo_t *cr,
GdkColor *color)
{
cairo_set_rgb_color (cr,
color->red / 65535.,
color->green / 65535.,
color->blue / 65535.);
cairo_set_source_rgb (cr,
color->red / 65535.,
color->green / 65535.,
color->blue / 65535.);
}
#define __GDK_COLOR_C__
......
......@@ -129,7 +129,7 @@ emboss_context (cairo_t *cr)
tmp_matrix.y0 += 1.0;
cairo_set_matrix (cr, &tmp_matrix);
cairo_set_rgb_color (cr, 1.0, 1.0, 1.0);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
}
static void
......@@ -141,10 +141,10 @@ set_part_color (GdkPangoRenderer *gdk_renderer,
part);
if (color)
{
cairo_set_rgb_color (cr,
color->red / 65535.,
color->green / 65535.,
color->blue / 65535.);
cairo_set_source_rgb (cr,
color->red / 65535.,
color->green / 65535.,
color->blue / 65535.);
}
else
{
......@@ -224,7 +224,7 @@ create_cairo_context (GdkPangoRenderer *gdk_renderer,
cairo_matrix_destroy (matrix);
}
cairo_set_pattern (cr, pattern);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
}
else
......
......@@ -433,7 +433,7 @@ gdk_pixbuf_set_as_cairo_source (GdkPixbuf *pixbuf,
cairo_pattern_set_matrix (pattern, matrix);
cairo_matrix_destroy (matrix);
cairo_set_pattern (cr, pattern);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
}
......
......@@ -1755,7 +1755,7 @@ gdk_window_set_bg_pattern (GdkWindow *window,
}
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
cairo_set_pattern (cr, pattern);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
}
else
......
......@@ -413,11 +413,11 @@ color_sample_draw_sample (GtkColorSelection *colorsel, int which)
{
/* Draw checks in background */
cairo_set_rgb_color (cr, 0.5, 0.5, 0.5);
cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
cairo_rectangle (cr, 0, 0, wid, heig);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0.75, 0.75, 0.75);
cairo_set_source_rgb (cr, 0.75, 0.75, 0.75);
for (x = goff & -CHECK_SIZE; x < goff + wid; x += CHECK_SIZE)
for (y = 0; y < heig; y += CHECK_SIZE)
if ((x / CHECK_SIZE + y / CHECK_SIZE) % 2 == 0)
......@@ -427,21 +427,23 @@ color_sample_draw_sample (GtkColorSelection *colorsel, int which)
if (which == 0)
{
cairo_set_rgb_color (cr,
priv->old_color[COLORSEL_RED],
priv->old_color[COLORSEL_GREEN],
priv->old_color[COLORSEL_BLUE]);
if (priv->has_opacity)
cairo_set_alpha (cr, priv->old_color[COLORSEL_OPACITY]);
cairo_set_source_rgba (cr,
priv->old_color[COLORSEL_RED],
priv->old_color[COLORSEL_GREEN],
priv->old_color[COLORSEL_BLUE],
priv->has_opacity ?
priv->old_color[COLORSEL_OPACITY] : 1.0);
}
else
{
cairo_set_rgb_color (cr,
priv->color[COLORSEL_RED],
priv->color[COLORSEL_GREEN],
priv->color[COLORSEL_BLUE]);
if (priv->has_opacity)
cairo_set_alpha (cr, priv->color[COLORSEL_OPACITY]);
cairo_set_source_rgba (cr,
priv->color[COLORSEL_RED],
priv->color[COLORSEL_GREEN],
priv->color[COLORSEL_BLUE],
priv->has_opacity ?
priv->color[COLORSEL_OPACITY] : 1.0);
}
cairo_rectangle (cr, 0, 0, wid, heig);
......@@ -654,9 +656,9 @@ set_focus_line_attributes (GtkWidget *drawing_area,
palette_get_color (drawing_area, color);
if (INTENSITY (color[0], color[1], color[2]) > 0.5)
cairo_set_rgb_color (cr, 0., 0., 0.);
cairo_set_source_rgb (cr, 0., 0., 0.);
else
cairo_set_rgb_color (cr, 1., 1., 1.);
cairo_set_source_rgb (cr, 1., 1., 1.);
cairo_set_line_width (cr, *focus_width);
......
......@@ -933,7 +933,7 @@ set_source_surface (cairo_t *cr,
cairo_pattern_set_matrix (pattern, matrix);
cairo_matrix_destroy (matrix);
cairo_set_pattern (cr, pattern);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
}
......@@ -1027,9 +1027,9 @@ paint_ring (GtkHSV *hsv,
hsv_to_rgb (&r, &g, &b);
if (INTENSITY (r, g, b) > 0.5)
cairo_set_rgb_color (source_cr, 0., 0., 0.);
cairo_set_source_rgb (source_cr, 0., 0., 0.);
else
cairo_set_rgb_color (source_cr, 1., 1., 1.);
cairo_set_source_rgb (source_cr, 1., 1., 1.);
cairo_move_to (source_cr, -x + center, - y + center);
cairo_line_to (source_cr,
......@@ -1245,12 +1245,12 @@ paint_triangle (GtkHSV *hsv,
if (INTENSITY (r, g, b) > 0.5)
{
detail = "colorwheel_light";
cairo_set_rgb_color (cr, 0., 0., 0.);
cairo_set_source_rgb (cr, 0., 0., 0.);
}
else
{
detail = "colorwheel_dark";
cairo_set_rgb_color (cr, 1., 1., 1.);
cairo_set_source_rgb (cr, 1., 1., 1.);
}
#define RADIUS 4
......
......@@ -2124,15 +2124,22 @@ gtk_icon_view_paint_rubberband (GtkIconView *icon_view,
if (!fill_color_gdk)
fill_color_gdk = gdk_color_copy (&GTK_WIDGET (icon_view)->style->base[GTK_STATE_SELECTED]);
gdk_cairo_set_source_color (cr, fill_color_gdk);
cairo_set_alpha (cr, fill_color_alpha / 255.);
cairo_set_source_rgba (cr,
fill_color_gdk->red / 65535.,
fill_color_gdk->green / 65535.,
fill_color_gdk->blue / 65535.,
fill_color_alpha / 255.);
cairo_save (cr);
cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
cairo_clip (cr);
cairo_fill (cr);
cairo_set_alpha (cr, 1.0);
/* Draw the border without alpha */
cairo_set_source_rgb (cr,
fill_color_gdk->red / 65535.,
fill_color_gdk->green / 65535.,
fill_color_gdk->blue / 65535.);
cairo_rectangle (cr,
rubber_rect.x + 0.5, rubber_rect.y + 0.5,
rubber_rect.width - 1, rubber_rect.height - 1);
......
......@@ -4560,9 +4560,9 @@ gtk_default_draw_focus (GtkStyle *style,
cr = gdk_drawable_create_cairo_context (window);
if (detail && !strcmp (detail, "colorwheel_light"))
cairo_set_rgb_color (cr, 0., 0., 0.);
cairo_set_source_rgb (cr, 0., 0., 0.);
else if (detail && !strcmp (detail, "colorwheel_dark"))
cairo_set_rgb_color (cr, 1., 1., 1.);
cairo_set_source_rgb (cr, 1., 1., 1.);
else
gdk_cairo_set_source_color (cr, &style->fg[state_type]);
......
......@@ -68,7 +68,7 @@ fill_checks (cairo_t *cr,
#define CHECK_SIZE 32
cairo_rectangle (cr, x, y, width, height);
cairo_set_rgb_color (cr, 0.4, 0.4, 0.4);
cairo_set_source_rgb (cr, 0.4, 0.4, 0.4);
cairo_fill (cr);
/* Only works for CHECK_SIZE a power of 2 */
......@@ -82,7 +82,7 @@ fill_checks (cairo_t *cr,
cairo_rectangle (cr, i, j, CHECK_SIZE, CHECK_SIZE);
}
cairo_set_rgb_color (cr, 0.7, 0.7, 0.7);
cairo_set_source_rgb (cr, 0.7, 0.7, 0.7);
cairo_fill (cr);
}
......@@ -92,25 +92,26 @@ fill_checks (cairo_t *cr,
static void
draw_3circles (cairo_t *cr,
double xc, double yc,
double radius)
double radius,
double alpha)
{
double subradius = radius * (2 / 3. - 0.1);
cairo_set_rgb_color (cr, 1., 0., 0.);
cairo_set_source_rgba (cr, 1., 0., 0., alpha);
oval_path (cr,
xc + radius / 3. * cos (G_PI * (0.5)),
yc - radius / 3. * sin (G_PI * (0.5)),
subradius, subradius);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0., 1., 0.);
cairo_set_source_rgba (cr, 0., 1., 0., alpha);
oval_path (cr,
xc + radius / 3. * cos (G_PI * (0.5 + 2/.3)),
yc - radius / 3. * sin (G_PI * (0.5 + 2/.3)),
subradius, subradius);
cairo_fill (cr);
cairo_set_rgb_color (cr, 0., 0., 1.);
cairo_set_source_rgba (cr, 0., 0., 1., alpha);
oval_path (cr,
xc + radius / 3. * cos (G_PI * (0.5 + 4/.3)),
yc - radius / 3. * sin (G_PI * (0.5 + 4/.3)),
......@@ -156,7 +157,7 @@ draw (cairo_t *cr,
/* Draw a black circle on the overlay
*/
cairo_set_rgb_color (cr, 0., 0., 0.);
cairo_set_source_rgb (cr, 0., 0., 0.);
oval_path (cr, xc, yc, radius, radius);
cairo_fill (cr);
......@@ -166,7 +167,7 @@ draw (cairo_t *cr,
/* Draw 3 circles to the punch surface, then cut
* that out of the main circle in the overlay
*/
draw_3circles (cr, xc, yc, radius);
draw_3circles (cr, xc, yc, radius, 1.0);
cairo_restore (cr);
......@@ -180,9 +181,8 @@ draw (cairo_t *cr,
cairo_save (cr);
cairo_set_target_surface (cr, circles);
cairo_set_alpha (cr, 0.5);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
draw_3circles (cr, xc, yc, radius);
draw_3circles (cr, xc, yc, radius, 0.5);
cairo_restore (cr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment