SVG: implement fill opacity

This makes the `eoFill` method similar to the `eoStroke` method and the
ones in `src/display/canvas.js`.
This commit is contained in:
Tim van der Meij 2017-06-23 00:19:20 +02:00
parent 8e9b4b5ff2
commit 440914e49b
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -807,6 +807,9 @@ SVGGraphics = (function SVGGraphicsClosure() {
var color = Util.makeCssRgb(r, g, b);
this.current.strokeColor = color;
},
setFillAlpha: function SVGGraphics_setFillAlpha(fillAlpha) {
this.current.fillAlpha = fillAlpha;
},
setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) {
var color = Util.makeCssRgb(r, g, b);
this.current.fillColor = color;
@ -970,6 +973,9 @@ SVGGraphics = (function SVGGraphicsClosure() {
case 'Font':
this.setFont(value);
break;
case 'ca':
this.setFillAlpha(value);
break;
default:
warn('Unimplemented graphic state ' + key);
break;
@ -980,6 +986,7 @@ SVGGraphics = (function SVGGraphicsClosure() {
fill: function SVGGraphics_fill() {
var current = this.current;
current.element.setAttributeNS(null, 'fill', current.fillColor);
current.element.setAttributeNS(null, 'fill-opacity', current.fillAlpha);
},
stroke: function SVGGraphics_stroke() {
@ -989,9 +996,8 @@ SVGGraphics = (function SVGGraphicsClosure() {
},
eoFill: function SVGGraphics_eoFill() {
var current = this.current;
current.element.setAttributeNS(null, 'fill', current.fillColor);
current.element.setAttributeNS(null, 'fill-rule', 'evenodd');
this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd');
this.fill();
},
fillStroke: function SVGGraphics_fillStroke() {