File indexing completed on 2024-06-09 04:20:48
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2003, 2005 Rob Buis <buis@kde.org> 0003 * SPDX-FileCopyrightText: 2007, 2009 Jan Hambrecht <jaham@gmx.net> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef SVGGRAPHICCONTEXT_H 0009 #define SVGGRAPHICCONTEXT_H 0010 0011 #include "kritaflake_export.h" 0012 #include <KoShapeStroke.h> 0013 #include <QFont> 0014 #include <QTransform> 0015 #include <text/KoSvgTextProperties.h> 0016 0017 class KRITAFLAKE_EXPORT SvgGraphicsContext 0018 { 0019 public: 0020 // Fill/stroke styles 0021 enum StyleType { 0022 None, ///< no style 0023 Solid, ///< solid style 0024 Complex ///< gradient or pattern style 0025 }; 0026 0027 SvgGraphicsContext(); 0028 SvgGraphicsContext(const SvgGraphicsContext &gc); 0029 0030 void workaroundClearInheritedFillProperties(); 0031 0032 StyleType fillType {Solid}; ///< the current fill type 0033 Qt::FillRule fillRule {Qt::WindingFill}; ///< the current fill rule 0034 QColor fillColor {QColor(Qt::black)}; ///< the current fill color. Default is black fill as per svg spec 0035 QString fillId; ///< the current fill id (used for gradient/pattern fills) 0036 0037 StyleType strokeType {None};///< the current stroke type 0038 QString strokeId; ///< the current stroke id (used for gradient strokes) 0039 KoShapeStrokeSP stroke; ///< the current stroke 0040 0041 QString filterId; ///< the current filter id 0042 QString clipPathId; ///< the current clip path id 0043 QString clipMaskId; ///< the current clip mask id 0044 Qt::FillRule clipRule {Qt::WindingFill}; ///< the current clip rule 0045 qreal opacity {1.0}; ///< the shapes opacity 0046 0047 QTransform matrix; ///< the current transformation matrix 0048 QColor currentColor {Qt::black}; ///< the current color 0049 QString xmlBaseDir; ///< the current base directory (used for loading external content) 0050 bool preserveWhitespace {false}; ///< preserve whitespace in element text 0051 0052 QRectF currentBoundingBox; ///< the current bound box used for bounding box units 0053 bool forcePercentage {false}; ///< force parsing coordinates/length as percentages of currentBoundbox 0054 QTransform viewboxTransform; ///< view box transformation 0055 0056 bool display {true}; ///< controls display of shape 0057 bool visible {true}; ///< controls visibility of the shape (inherited) 0058 bool isResolutionFrame {false}; 0059 qreal pixelsPerInch {72.0}; ///< controls the resolution of the image raster 0060 0061 QString markerStartId; 0062 QString markerMidId; 0063 QString markerEndId; 0064 0065 bool autoFillMarkers {false}; 0066 0067 KoSvgTextProperties textProperties; 0068 QString shapeInsideValue; ///< String of value shape-inside, will be parsed later. 0069 QString shapeSubtractValue; ///< String of value shape-subtract, will be parsed later. 0070 0071 QString paintOrder; ///< String list indicating paint order; 0072 private: 0073 SvgGraphicsContext& operator=(const SvgGraphicsContext &gc) = default; ///< used by copy constructor, shouldn't be public 0074 }; 0075 0076 #endif // SVGGRAPHICCONTEXT_H