Commit 47570452 authored by Caleb Michael Moore's avatar Caleb Michael Moore

cairo transperancy fixes

parent 2f88a46d
2005-10-07 Caleb Moore <c.moore@student.unsw.edu.au>
* rsvg-cairo-draw.c: made opacity work
* test-display.c: changed set_default_dpi_x_y to set_default_dpi
2005-10-06 Dom Lachowicz <cinamod@hotmail.com>
* autogen.sh: Let librsvg build out of srcdir. Bug #158331
......@@ -6,7 +11,7 @@
* rsvg-structure.c: Related to bug #318025, don't set has_width or has_height unless they are > 0.
* rsvg.c: Bug #168567, mega hack to make multiImage sort-of work.
2005-10-4 Caleb Moore <c.moore@student.unsw.edu.au>
2005-10-04 Caleb Moore <c.moore@student.unsw.edu.au>
* most-cairo-related-places: added lots of stuff to do with gradients, objectBoundBox positioning and spreading. Made currentColor work with cairo. Made courners look great in cairo but crap in libart... I just can't win.
......
......@@ -234,13 +234,21 @@ rsvg_cairo_render_path (RsvgDrawingCtx *ctx, const RsvgBpathDef *bpath_def)
{
RsvgCairoRender *render = (RsvgCairoRender *)ctx->render;
RsvgState *state = rsvg_state_current (ctx);
cairo_t *cr = render->cr;
cairo_t *cr;
RsvgBpath *bpath;
int i;
gdouble xmin = 0, ymin = 0, xmax = 0, ymax = 0;
int virgin = 1;
int virgin = 1, need_tmpbuf = 0;
RsvgCairoBbox bbox;
need_tmpbuf = (state->fill != NULL) && (state->stroke != NULL) &&
state->opacity != 0xff;
if (need_tmpbuf)
rsvg_cairo_push_discrete_layer (ctx);
cr = render->cr;
cairo_save (cr);
_set_rsvg_affine (cr, state->affine);
......@@ -292,15 +300,21 @@ rsvg_cairo_render_path (RsvgDrawingCtx *ctx, const RsvgBpathDef *bpath_def)
bbox.h = ymax - ymin;
if (state->fill != NULL) {
int opacity;
if (state->fill_rule == FILL_RULE_EVENODD)
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
else /* state->fill_rule == FILL_RULE_NONZERO */
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
if (!need_tmpbuf)
opacity = (state->fill_opacity * state->opacity) / 255;
else
opacity = state->fill_opacity;
_set_source_rsvg_paint_server (cr,
state->current_color,
state->fill,
state->fill_opacity,
opacity,
bbox,
rsvg_state_current(ctx)->current_color);
......@@ -311,17 +325,25 @@ rsvg_cairo_render_path (RsvgDrawingCtx *ctx, const RsvgBpathDef *bpath_def)
}
if (state->stroke != NULL) {
int opacity;
if (!need_tmpbuf)
opacity = (state->stroke_opacity * state->opacity) / 255;
else
opacity = state->stroke_opacity;
_set_source_rsvg_paint_server (cr,
state->current_color,
state->stroke,
state->stroke_opacity,
opacity,
bbox,
rsvg_state_current(ctx)->current_color);
cairo_stroke (cr);
}
cairo_restore (cr);
if (need_tmpbuf)
rsvg_cairo_pop_discrete_layer (ctx);
}
void rsvg_cairo_render_image (RsvgDrawingCtx *ctx, const GdkPixbuf * pixbuf,
......@@ -341,6 +363,8 @@ void rsvg_cairo_render_image (RsvgDrawingCtx *ctx, const GdkPixbuf * pixbuf,
static const cairo_user_data_key_t key;
int j;
rsvg_cairo_push_discrete_layer (ctx);
cairo_save (render->cr);
_set_rsvg_affine (render->cr, state->affine);
cairo_scale (render->cr, w / width, h / height);
......@@ -412,12 +436,14 @@ void rsvg_cairo_render_image (RsvgDrawingCtx *ctx, const GdkPixbuf * pixbuf,
gdk_pixels += gdk_rowstride;
cairo_pixels += 4 * width;
}
cairo_set_source_surface (render->cr, surface, pixbuf_x, pixbuf_y);
cairo_paint (render->cr);
cairo_surface_destroy (surface);
cairo_restore (render->cr);
rsvg_cairo_pop_discrete_layer (ctx);
}
void
......@@ -463,7 +489,7 @@ rsvg_cairo_pop_discrete_layer (RsvgDrawingCtx *ctx)
cairo_set_source_surface (render->cr,
cairo_get_target (child_cr),
0, 0);
cairo_paint (render->cr);
cairo_paint_with_alpha (render->cr, (double)state->opacity / 255.0);
cairo_destroy (child_cr);
}
......
......@@ -670,7 +670,7 @@ main (int argc, char **argv)
gtk_init (&argc, &argv) ;
rsvg_init ();
rsvg_set_default_dpi_x_y (dpi_x, dpi_y);
rsvg_set_default_dpi (dpi_x, dpi_y);
/* if both are unspecified, assume user wants to zoom the pixbuf in at least 1 dimension */
if (width == -1 && height == -1)
......
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