Krita Source Code Documentation
Loading...
Searching...
No Matches
SvgGraphicsContext Class Reference

#include <SvgGraphicContext.h>

Public Types

enum  StyleType { None , Solid , Complex , Inherit }
 

Public Member Functions

 SvgGraphicsContext ()
 
 SvgGraphicsContext (const SvgGraphicsContext &gc)
 
void workaroundClearInheritedFillProperties ()
 

Public Attributes

bool autoFillMarkers {false}
 
QString clipMaskId
 the current clip mask id
 
QString clipPathId
 the current clip path id
 
Qt::FillRule clipRule {Qt::WindingFill}
 the current clip rule
 
QRectF currentBoundingBox
 the current bound box used for bounding box units
 
QColor currentColor {Qt::black}
 the current color
 
bool display {true}
 controls display of shape
 
QColor fillColor {QColor(Qt::black)}
 the current fill color. Default is black fill as per svg spec
 
QString fillId
 the current fill id (used for gradient/pattern fills)
 
Qt::FillRule fillRule {Qt::WindingFill}
 the current fill rule
 
StyleType fillType {Solid}
 the current fill type
 
QString filterId
 the current filter id
 
bool forcePercentage {false}
 force parsing coordinates/length as percentages of currentBoundbox
 
bool isResolutionFrame {false}
 
QString markerEndId
 
QString markerMidId
 
QString markerStartId
 
QTransform matrix
 the current transformation matrix
 
qreal opacity {1.0}
 the shapes opacity
 
QString paintOrder
 String list indicating paint order;.
 
qreal pixelsPerInch {72.0}
 controls the resolution of the image raster
 
bool preserveWhitespace {false}
 preserve whitespace in element text
 
QString shapeInsideValue
 String of value shape-inside, will be parsed later.
 
QString shapeSubtractValue
 String of value shape-subtract, will be parsed later.
 
KoShapeStrokeSP stroke
 the current stroke
 
QString strokeId
 the current stroke id (used for gradient strokes)
 
StyleType strokeType {None}
 the current stroke type
 
KoSvgTextProperties textProperties
 Stores textProperties.
 
QTransform viewboxTransform
 view box transformation
 
bool visible {true}
 controls visibility of the shape (inherited)
 
QString xmlBaseDir
 the current base directory (used for loading external content)
 

Private Member Functions

SvgGraphicsContextoperator= (const SvgGraphicsContext &gc)=default
 used by copy constructor, shouldn't be public
 

Detailed Description

Definition at line 16 of file SvgGraphicContext.h.

Member Enumeration Documentation

◆ StyleType

Enumerator
None 

no style

Solid 

solid style

Complex 

gradient or pattern style

Inherit 

Definition at line 20 of file SvgGraphicContext.h.

20 {
21 None,
22 Solid,
23 Complex,
25 };
@ Complex
gradient or pattern style

Constructor & Destructor Documentation

◆ SvgGraphicsContext() [1/2]

SvgGraphicsContext::SvgGraphicsContext ( )

Definition at line 13 of file SvgGraphicContext.cpp.

16{
17 stroke->setLineStyle(Qt::NoPen, QVector<qreal>()); // default is no stroke
18 stroke->setLineWidth(1.0);
19 stroke->setCapStyle(Qt::FlatCap);
20 stroke->setJoinStyle(Qt::MiterJoin);
21}
KoSvgTextProperties textProperties
Stores textProperties.
KoShapeStrokeSP stroke
the current stroke
QSharedPointer< T > toQShared(T *ptr)

References stroke.

◆ SvgGraphicsContext() [2/2]

SvgGraphicsContext::SvgGraphicsContext ( const SvgGraphicsContext & gc)

Definition at line 23 of file SvgGraphicContext.cpp.

24 : stroke(toQShared(new KoShapeStroke(*(gc.stroke.data()))))
25{
26 KoShapeStrokeSP newStroke = stroke;
27 *this = gc;
28 this->stroke = newStroke;
29}

References stroke.

Member Function Documentation

◆ operator=()

SvgGraphicsContext & SvgGraphicsContext::operator= ( const SvgGraphicsContext & gc)
privatedefault

used by copy constructor, shouldn't be public

◆ workaroundClearInheritedFillProperties()

void SvgGraphicsContext::workaroundClearInheritedFillProperties ( )

HACK ALERT: according to SVG patterns, clip paths and clip masks must not inherit any properties from the referencing element. We still don't support it, therefore we reset only fill/stroke properties to avoid cyclic fill inheritance, which may cause infinite recursion.

Definition at line 31 of file SvgGraphicContext.cpp.

32{
43
45 stroke->setLineStyle(Qt::NoPen, QVector<qreal>()); // default is no stroke
46 stroke->setLineWidth(1.0);
47 stroke->setCapStyle(Qt::FlatCap);
48 stroke->setJoinStyle(Qt::MiterJoin);
49
51 fillRule = Qt::WindingFill;
52 fillColor = QColor(Qt::black); // default is black fill as per svg spec
53
54 opacity = 1.0;
55
56 currentColor = Qt::black;
57}
Qt::FillRule fillRule
the current fill rule
StyleType strokeType
the current stroke type
StyleType fillType
the current fill type
qreal opacity
the shapes opacity
QColor currentColor
the current color
QColor fillColor
the current fill color. Default is black fill as per svg spec

References currentColor, fillColor, fillRule, fillType, None, opacity, Solid, stroke, strokeType, and toQShared().

Member Data Documentation

◆ autoFillMarkers

bool SvgGraphicsContext::autoFillMarkers {false}

Definition at line 65 of file SvgGraphicContext.h.

65{false};

◆ clipMaskId

QString SvgGraphicsContext::clipMaskId

the current clip mask id

Definition at line 43 of file SvgGraphicContext.h.

◆ clipPathId

QString SvgGraphicsContext::clipPathId

the current clip path id

Definition at line 42 of file SvgGraphicContext.h.

◆ clipRule

Qt::FillRule SvgGraphicsContext::clipRule {Qt::WindingFill}

the current clip rule

Definition at line 44 of file SvgGraphicContext.h.

44{Qt::WindingFill};

◆ currentBoundingBox

QRectF SvgGraphicsContext::currentBoundingBox

the current bound box used for bounding box units

Definition at line 52 of file SvgGraphicContext.h.

◆ currentColor

QColor SvgGraphicsContext::currentColor {Qt::black}

the current color

Definition at line 48 of file SvgGraphicContext.h.

48{Qt::black};

◆ display

bool SvgGraphicsContext::display {true}

controls display of shape

Definition at line 56 of file SvgGraphicContext.h.

56{true};

◆ fillColor

QColor SvgGraphicsContext::fillColor {QColor(Qt::black)}

the current fill color. Default is black fill as per svg spec

Definition at line 34 of file SvgGraphicContext.h.

34{QColor(Qt::black)};

◆ fillId

QString SvgGraphicsContext::fillId

the current fill id (used for gradient/pattern fills)

Definition at line 35 of file SvgGraphicContext.h.

◆ fillRule

Qt::FillRule SvgGraphicsContext::fillRule {Qt::WindingFill}

the current fill rule

Definition at line 33 of file SvgGraphicContext.h.

33{Qt::WindingFill};

◆ fillType

StyleType SvgGraphicsContext::fillType {Solid}

the current fill type

Definition at line 32 of file SvgGraphicContext.h.

32{Solid};

◆ filterId

QString SvgGraphicsContext::filterId

the current filter id

Definition at line 41 of file SvgGraphicContext.h.

◆ forcePercentage

bool SvgGraphicsContext::forcePercentage {false}

force parsing coordinates/length as percentages of currentBoundbox

Definition at line 53 of file SvgGraphicContext.h.

53{false};

◆ isResolutionFrame

bool SvgGraphicsContext::isResolutionFrame {false}

Definition at line 58 of file SvgGraphicContext.h.

58{false};

◆ markerEndId

QString SvgGraphicsContext::markerEndId

Definition at line 63 of file SvgGraphicContext.h.

◆ markerMidId

QString SvgGraphicsContext::markerMidId

Definition at line 62 of file SvgGraphicContext.h.

◆ markerStartId

QString SvgGraphicsContext::markerStartId

Definition at line 61 of file SvgGraphicContext.h.

◆ matrix

QTransform SvgGraphicsContext::matrix

the current transformation matrix

Definition at line 47 of file SvgGraphicContext.h.

◆ opacity

qreal SvgGraphicsContext::opacity {1.0}

the shapes opacity

Definition at line 45 of file SvgGraphicContext.h.

45{1.0};

◆ paintOrder

QString SvgGraphicsContext::paintOrder

String list indicating paint order;.

Definition at line 71 of file SvgGraphicContext.h.

◆ pixelsPerInch

qreal SvgGraphicsContext::pixelsPerInch {72.0}

controls the resolution of the image raster

Definition at line 59 of file SvgGraphicContext.h.

59{72.0};

◆ preserveWhitespace

bool SvgGraphicsContext::preserveWhitespace {false}

preserve whitespace in element text

Definition at line 50 of file SvgGraphicContext.h.

50{false};

◆ shapeInsideValue

QString SvgGraphicsContext::shapeInsideValue

String of value shape-inside, will be parsed later.

Definition at line 68 of file SvgGraphicContext.h.

◆ shapeSubtractValue

QString SvgGraphicsContext::shapeSubtractValue

String of value shape-subtract, will be parsed later.

Definition at line 69 of file SvgGraphicContext.h.

◆ stroke

KoShapeStrokeSP SvgGraphicsContext::stroke

the current stroke

Definition at line 39 of file SvgGraphicContext.h.

◆ strokeId

QString SvgGraphicsContext::strokeId

the current stroke id (used for gradient strokes)

Definition at line 38 of file SvgGraphicContext.h.

◆ strokeType

StyleType SvgGraphicsContext::strokeType {None}

the current stroke type

Definition at line 37 of file SvgGraphicContext.h.

37{None};

◆ textProperties

KoSvgTextProperties SvgGraphicsContext::textProperties

Stores textProperties.

Definition at line 67 of file SvgGraphicContext.h.

◆ viewboxTransform

QTransform SvgGraphicsContext::viewboxTransform

view box transformation

Definition at line 54 of file SvgGraphicContext.h.

◆ visible

bool SvgGraphicsContext::visible {true}

controls visibility of the shape (inherited)

Definition at line 57 of file SvgGraphicContext.h.

57{true};

◆ xmlBaseDir

QString SvgGraphicsContext::xmlBaseDir

the current base directory (used for loading external content)

Definition at line 49 of file SvgGraphicContext.h.


The documentation for this class was generated from the following files: