diff options
Diffstat (limited to 'dviware/dvisvgm/src/PsSpecialHandler.hpp')
-rw-r--r-- | dviware/dvisvgm/src/PsSpecialHandler.hpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/dviware/dvisvgm/src/PsSpecialHandler.hpp b/dviware/dvisvgm/src/PsSpecialHandler.hpp index 9dcbc2d4ce..8b66499041 100644 --- a/dviware/dvisvgm/src/PsSpecialHandler.hpp +++ b/dviware/dvisvgm/src/PsSpecialHandler.hpp @@ -142,19 +142,20 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { void setcolorspace (std::vector<double> &p) override {_patternEnabled = bool(p[0]);} void setcmykcolor (std::vector<double> &cmyk) override; void setdash (std::vector<double> &p) override; + void setfillconstantalpha (std::vector<double> &p) override {_fillalpha[_isshapealpha ? 1 : 0] = p[0];} void setgray (std::vector<double> &p) override; void sethsbcolor (std::vector<double> &hsb) override; + void setisshapealpha (std::vector<double> &p) override {_isshapealpha = bool(p[0]);} void setlinecap (std::vector<double> &p) override {_linecap = uint8_t(p[0]);} void setlinejoin (std::vector<double> &p) override {_linejoin = uint8_t(p[0]);} void setlinewidth (std::vector<double> &p) override {_linewidth = scale(p[0] ? p[0] : 0.5);} void setmatrix (std::vector<double> &p) override; void setmiterlimit (std::vector<double> &p) override {_miterlimit = p[0];} void setnulldevice (std::vector<double> &p) override; - void setopacityalpha (std::vector<double> &p) override {_opacityalpha = p[0];} - void setshapealpha (std::vector<double> &p) override {_shapealpha = p[0];} void setpagedevice (std::vector<double> &p) override; void setpattern (std::vector<double> &p) override; void setrgbcolor (std::vector<double> &rgb) override; + void setstrokeconstantalpha (std::vector<double> &p) override {_strokealpha[_isshapealpha ? 1 : 0] = p[0];} void shfill (std::vector<double> &p) override; void stroke (std::vector<double> &p) override; void translate (std::vector<double> &p) override; @@ -163,29 +164,30 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions { private: PSInterpreter _psi; SpecialActions *_actions=nullptr; - PSPreviewFilter _previewFilter; ///< filter to extract information generated by the preview package - PsSection _psSection=PS_NONE; ///< current section processed (nothing yet, headers, or body specials) - XMLElement *_xmlnode=nullptr; ///< if != 0, created SVG elements are appended to this node - XMLElement *_savenode=nullptr; ///< pointer to temporaryly store _xmlnode - std::string _headerCode; ///< collected literal PS header code + PSPreviewFilter _previewFilter; ///< filter to extract information generated by the preview package + PsSection _psSection=PS_NONE; ///< current section processed (nothing yet, headers, or body specials) + XMLElement *_xmlnode=nullptr; ///< if != 0, created SVG elements are appended to this node + XMLElement *_savenode=nullptr; ///< pointer to temporaryly store _xmlnode + std::string _headerCode; ///< collected literal PS header code Path _path; - DPair _currentpoint; ///< current PS position in bp units - Color _currentcolor; ///< current stroke/fill color - double _sx, _sy; ///< horizontal and vertical scale factors retrieved by operator "applyscalevals" - double _cos; ///< cosine of angle between (1,0) and transform(1,0) - double _linewidth; ///< current line width in bp units - double _miterlimit; ///< current miter limit in bp units - double _opacityalpha; ///< opacity level (0=fully transparent, ..., 1=opaque) - double _shapealpha; ///< shape opacity level (0=fully transparent, ..., 1=opaque) - int _blendmode; ///< blend mode used when overlaying colored areas - uint8_t _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square) - uint8_t _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel) - double _dashoffset; ///< current dash offset + DPair _currentpoint; ///< current PS position in bp units + Color _currentcolor; ///< current stroke/fill color + double _sx, _sy; ///< horizontal and vertical scale factors retrieved by operator "applyscalevals" + double _cos; ///< cosine of angle between (1,0) and transform(1,0) + double _linewidth; ///< current line width in bp units + double _miterlimit; ///< current miter limit in bp units + bool _isshapealpha; ///< if true, opacity operators act on index 1 (shape component), otherwise on index 0 (constant component) + std::array<double,2> _fillalpha; ///< constant and shape opacity used for fill operations (0=fully transparent, ..., 1=opaque) + std::array<double,2> _strokealpha; ///< constant and shape opacity used for stroke operations (0=fully transparent, ..., 1=opaque) + int _blendmode; ///< blend mode used when overlaying colored areas + uint8_t _linecap : 2; ///< current line cap (0=butt, 1=round, 2=projecting square) + uint8_t _linejoin : 2; ///< current line join (0=miter, 1=round, 2=bevel) + double _dashoffset; ///< current dash offset std::vector<double> _dashpattern; ClippingStack _clipStack; std::map<int, std::unique_ptr<PSPattern>> _patterns; - PSTilingPattern *_pattern; ///< current pattern - bool _patternEnabled; ///< true if active color space is a pattern + PSTilingPattern *_pattern; ///< current pattern + bool _patternEnabled; ///< true if active color space is a pattern }; #endif |