diff options
Diffstat (limited to 'dviware/dvisvgm/src/PsSpecialHandler.cpp')
-rw-r--r-- | dviware/dvisvgm/src/PsSpecialHandler.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/dviware/dvisvgm/src/PsSpecialHandler.cpp b/dviware/dvisvgm/src/PsSpecialHandler.cpp index 9641556dd5..f7b5508b65 100644 --- a/dviware/dvisvgm/src/PsSpecialHandler.cpp +++ b/dviware/dvisvgm/src/PsSpecialHandler.cpp @@ -81,8 +81,9 @@ void PsSpecialHandler::initgraphics () { _linecap = _linejoin = 0; // butt end caps and miter joins _miterlimit = 4; _xmlnode = _savenode = nullptr; - _opacityalpha = _shapealpha = 1; // fully opaque - _blendmode = 0; // "normal" mode (no blending) + _isshapealpha = false; // opacity operators change constant component by default + _fillalpha = _strokealpha = {1, 1}; // set constant and shape opacity to non-transparent + _blendmode = 0; // "normal" mode (no blending) _sx = _sy = _cos = 1.0; _pattern = nullptr; _patternEnabled = false; @@ -555,8 +556,9 @@ void PsSpecialHandler::setpagedevice (std::vector<double> &p) { _linewidth = 1; _linecap = _linejoin = 0; // butt end caps and miter joins _miterlimit = 4; - _opacityalpha = _shapealpha = 1; // fully opaque - _blendmode = 0; // "normal" mode (no blending) + _isshapealpha = false; // opacity operators change constant component by default + _fillalpha = _strokealpha = {1, 1}; // set constant and shape opacity to non-transparent + _blendmode = 0; // "normal" mode (no blending) _sx = _sy = _cos = 1.0; _pattern = nullptr; _currentcolor = Color::BLACK; @@ -671,8 +673,8 @@ void PsSpecialHandler::stroke (vector<double> &p) { path->addAttribute("stroke-linecap", _linecap == 1 ? "round" : "square"); if (_linejoin > 0) // default value is "miter", no need to set it explicitly path->addAttribute("stroke-linejoin", _linecap == 1 ? "round" : "bevel"); - if (_opacityalpha < 1 || _shapealpha < 1) - path->addAttribute("stroke-opacity", _opacityalpha*_shapealpha); + if (_strokealpha[0] < 1 || _strokealpha[1] < 1) + path->addAttribute("stroke-opacity", _strokealpha[0] * _strokealpha[1]); if (_blendmode > 0 && _blendmode < 16) path->addAttribute("style", "mix-blend-mode:"+css_blendmode_name(_blendmode)); if (!_dashpattern.empty()) { @@ -735,8 +737,8 @@ void PsSpecialHandler::fill (vector<double> &p, bool evenodd) { } if (evenodd) // SVG default fill rule is "nonzero" algorithm path->addAttribute("fill-rule", "evenodd"); - if (_opacityalpha < 1 || _shapealpha < 1) - path->addAttribute("fill-opacity", _opacityalpha*_shapealpha); + if (_fillalpha[0] < 1 || _fillalpha[1] < 1) + path->addAttribute("fill-opacity", _fillalpha[0] * _fillalpha[1]); if (_blendmode > 0 && _blendmode < 16) path->addAttribute("style", "mix-blend-mode:"+css_blendmode_name(_blendmode)); if (_xmlnode) |