SVG: implement stroke opacity

This commit is contained in:
Tim van der Meij 2017-06-23 00:24:47 +02:00
parent 440914e49b
commit f9eafefa09
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -803,6 +803,9 @@ SVGGraphics = (function SVGGraphicsClosure() {
setMiterLimit: function SVGGraphics_setMiterLimit(limit) { setMiterLimit: function SVGGraphics_setMiterLimit(limit) {
this.current.miterLimit = limit; this.current.miterLimit = limit;
}, },
setStrokeAlpha: function SVGGraphics_setStrokeAlpha(strokeAlpha) {
this.current.strokeAlpha = strokeAlpha;
},
setStrokeRGBColor: function SVGGraphics_setStrokeRGBColor(r, g, b) { setStrokeRGBColor: function SVGGraphics_setStrokeRGBColor(r, g, b) {
var color = Util.makeCssRgb(r, g, b); var color = Util.makeCssRgb(r, g, b);
this.current.strokeColor = color; this.current.strokeColor = color;
@ -973,6 +976,9 @@ SVGGraphics = (function SVGGraphicsClosure() {
case 'Font': case 'Font':
this.setFont(value); this.setFont(value);
break; break;
case 'CA':
this.setStrokeAlpha(value);
break;
case 'ca': case 'ca':
this.setFillAlpha(value); this.setFillAlpha(value);
break; break;
@ -992,6 +998,8 @@ SVGGraphics = (function SVGGraphicsClosure() {
stroke: function SVGGraphics_stroke() { stroke: function SVGGraphics_stroke() {
var current = this.current; var current = this.current;
current.element.setAttributeNS(null, 'stroke', current.strokeColor); current.element.setAttributeNS(null, 'stroke', current.strokeColor);
current.element.setAttributeNS(null, 'stroke-opacity',
current.strokeAlpha);
current.element.setAttributeNS(null, 'fill', 'none'); current.element.setAttributeNS(null, 'fill', 'none');
}, },