fix stroke linewidth and dashes, I hope. Emit stroke-dashoffset.

This commit is contained in:
Emmanuel Pacaud 2005-12-19 15:33:32 +00:00
parent a83a42b248
commit d0eaab305c
2 changed files with 15 additions and 2 deletions

View file

@ -9,6 +9,11 @@
Use NULL clip instead of special serial zero cairo_clip_t
Should make using surfaces easier.
2005-12-19 Emmanuel Pacaud <emmanuel.pacaud@free.fr>
* src/cairo-svg-surface.c (_cairo_svg_surface_stroke): fix stroke
linewidth and dashes, I hope. Emit stroke-dashoffset.
2005-12-19 Emmanuel Pacaud <emmanuel.pacaud@free.fr>
* configure.in: CAIRO_CAN_TEST_SVG_SURFACE depends on librsvg.

View file

@ -1147,7 +1147,7 @@ _cairo_svg_surface_stroke (void *abstract_dst,
style = xmlBufferCreate ();
emit_pattern (surface, source, style, 1);
xmlBufferCat (style, CC2XML ("fill: none; stroke-width: "));
_cairo_dtostr (buffer, sizeof buffer, (rx + ry) / 2.0);
_cairo_dtostr (buffer, sizeof buffer, sqrt ((rx * rx + ry * ry) / 2.0));
xmlBufferCat (style, C2XML (buffer));
xmlBufferCat (style, CC2XML (";"));
@ -1183,10 +1183,18 @@ _cairo_svg_surface_stroke (void *abstract_dst,
/* FIXME: Is is really what we want ? */
rx = ry = stroke_style->dash[i];
cairo_matrix_transform_distance (ctm, &rx, &ry);
_cairo_dtostr (buffer, sizeof buffer, (rx + ry) / 2.0);
_cairo_dtostr (buffer, sizeof buffer, sqrt ((rx * rx + ry * ry) / 2.0));
xmlBufferCat (style, C2XML (buffer));
}
xmlBufferCat (style, ";");
if (stroke_style->dash_offset != 0.0) {
xmlBufferCat (style, CC2XML (" stroke-dashoffset: "));
rx = ry = stroke_style->dash_offset;
cairo_matrix_transform_distance (ctm, &rx, &ry);
_cairo_dtostr (buffer, sizeof buffer, sqrt ((rx * rx + ry * ry) / 2.0));
xmlBufferCat (style, C2XML (buffer));
xmlBufferCat (style, ";");
}
}
xmlBufferCat (style, CC2XML (" stroke-miterlimit: "));