summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src/PsSpecialHandler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'dviware/dvisvgm/src/PsSpecialHandler.hpp')
-rw-r--r--dviware/dvisvgm/src/PsSpecialHandler.hpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/dviware/dvisvgm/src/PsSpecialHandler.hpp b/dviware/dvisvgm/src/PsSpecialHandler.hpp
index 8b66499041..72586ba659 100644
--- a/dviware/dvisvgm/src/PsSpecialHandler.hpp
+++ b/dviware/dvisvgm/src/PsSpecialHandler.hpp
@@ -2,7 +2,7 @@
** PsSpecialHandler.hpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2020 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2021 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -28,12 +28,13 @@
#include <vector>
#include "GraphicsPath.hpp"
#include "PSInterpreter.hpp"
-#include "SpecialHandler.hpp"
+#include "Opacity.hpp"
#include "PSPattern.hpp"
#include "PSPreviewFilter.hpp"
-
+#include "SpecialHandler.hpp"
class PSPattern;
+class SVGElement;
class XMLElement;
class PsSpecialHandler : public SpecialHandler, protected PSActions {
@@ -104,7 +105,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
void executeAndSync (std::istream &is, bool updatePos);
void processHeaderFile (const char *fname);
void imgfile (FileType type, const std::string &fname, const std::map<std::string,std::string> &attr);
- std::unique_ptr<XMLElement> createImageNode (FileType type, const std::string &fname, int pageno, BoundingBox bbox, bool clip);
+ std::unique_ptr<SVGElement> createImageNode (FileType type, const std::string &fname, int pageno, BoundingBox bbox, bool clip);
void dviBeginPage (unsigned int pageno, SpecialActions &actions) override;
void dviEndPage (unsigned pageno, SpecialActions &actions) override;
void clip (Path path, bool evenodd);
@@ -138,14 +139,14 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
void rotate (std::vector<double> &p) override;
void save (std::vector<double> &p) override;
void scale (std::vector<double> &p) override;
- void setblendmode (std::vector<double> &p) override {_blendmode = int(p[0]);}
+ void setalphaisshape (std::vector<double> &p) override { _isshapealpha = bool(p[0]);}
+ void setblendmode (std::vector<double> &p) override;
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 setfillconstantalpha (std::vector<double> &p) override;
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);}
@@ -155,7 +156,7 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
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 setstrokeconstantalpha (std::vector<double> &p) override;
void shfill (std::vector<double> &p) override;
void stroke (std::vector<double> &p) override;
void translate (std::vector<double> &p) override;
@@ -176,15 +177,14 @@ class PsSpecialHandler : public SpecialHandler, protected PSActions {
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
+ bool _isshapealpha; ///< if true, opacity operators act on shape component, otherwise on constant component
+ Opacity _opacity;
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;
+ bool _makingPattern=false; ///< true if executing makepattern operator
std::map<int, std::unique_ptr<PSPattern>> _patterns;
PSTilingPattern *_pattern; ///< current pattern
bool _patternEnabled; ///< true if active color space is a pattern