|
Krita Source Code Documentation
|
#include <SvgParser.h>
Classes | |
| struct | DeferredUseStore |
Public Types | |
| typedef std::function< QByteArray(const QString &) | FileFetcherFunc) |
Public Member Functions | |
| QString | documentDescription () const |
| QString | documentTitle () const |
| QList< QExplicitlySharedDataPointer< KoMarker > > | knownMarkers () const |
| void | parseDefsElement (const QDomElement &e) |
| QList< KoShape * > | parseSvg (const QDomElement &e, QSizeF *fragmentSize=0) |
| Parses a svg fragment, returning the list of top level child shapes. | |
| KoShape * | parseTextElement (const QDomElement &e, KoSvgTextShape *mergeIntoShape=0) |
| void | setDefaultKraTextVersion (int version) |
| void | setFileFetcher (FileFetcherFunc func) |
| void | setFillStrokeInheritByDefault (const bool enable) |
| void | setResolution (const QRectF boundsInPixels, qreal pixelsPerInch) |
| void | setResolveTextPropertiesForTopLevel (const bool enable) |
| void | setXmlBaseDir (const QString &baseDir) |
| Sets the initial xml base directory (the directory form where the file is read) | |
| QList< KoShape * > | shapes () const |
| Returns the list of all shapes of the svg document. | |
| SvgParser (KoDocumentResourceManager *documentResourceManager) | |
| QVector< KoSvgSymbol * > | takeSymbols () |
| QStringList | warnings () const |
| virtual | ~SvgParser () |
Static Public Member Functions | |
| static QDomDocument | createDocumentFromSvg (const QByteArray &data, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0) |
| static QDomDocument | createDocumentFromSvg (const QString &data, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0) |
| static QDomDocument | createDocumentFromSvg (QIODevice *device, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0) |
| static QDomDocument | createDocumentFromSvg (QXmlStreamReader reader, QString *errorMsg=0, int *errorLine=0, int *errorColumn=0) |
Protected Member Functions | |
| void | addToGroup (QList< KoShape * > shapes, KoShapeContainer *group) |
| Adds list of shapes to the given group shape. | |
| void | applyClipping (KoShape *shape, const QPointF &shapeToOriginalUserCoordinates) |
| Applies the current clip path to the object. | |
| void | applyCurrentBasicStyle (KoShape *shape) |
| void | applyCurrentStyle (KoShape *shape, const QPointF &shapeToOriginalUserCoordinates) |
| void | applyFillStyle (KoShape *shape) |
| Applies the current fill style to the object. | |
| void | applyId (const QString &id, KoShape *shape) |
| Applies id to specified shape. | |
| void | applyMarkers (KoPathShape *shape) |
| void | applyMaskClipping (KoShape *shape, const QPointF &shapeToOriginalUserCoordinates) |
| void | applyPaintOrder (KoShape *shape) |
| void | applyStrokeStyle (KoShape *shape) |
| Applies the current stroke style to the object. | |
| void | applyStyle (KoShape *, const QDomElement &, const QPointF &shapeToOriginalUserCoordinates) |
| Applies styles to the given shape. | |
| void | applyStyle (KoShape *, const SvgStyles &, const QPointF &shapeToOriginalUserCoordinates) |
| Applies styles to the given shape. | |
| void | applyViewBoxTransform (const QDomElement &element) |
| void | buildDocument (QList< KoShape * > shapes) |
| Builds the document from the given shapes list. | |
| QList< KoShape * > | createListOfShapesFromCSS (const QDomElement e, const QString value, SvgLoadingContext &context, bool hideShapesFromDefs=true) |
| Create a list of shapes from a CSS shapes definition with potentially multiple shapes. | |
| KoShape * | createObject (const QDomElement &, const SvgStyles &style=SvgStyles()) |
| Creates an object from the given xml element. | |
| KoShape * | createObjectDirect (const QDomElement &b) |
| KoShape * | createPath (const QDomElement &) |
| Create path object from the given xml element. | |
| KoShape * | createShape (const QString &shapeID) |
| creates a shape from the given shape id | |
| KoShape * | createShapeFromCSS (const QDomElement e, const QString value, SvgLoadingContext &context, bool hideShapesFromDefs=true) |
| Creates a shape from a CSS shapes definition. | |
| KoShape * | createShapeFromElement (const QDomElement &element, SvgLoadingContext &context) |
| Creates shape from specified svg element. | |
| SvgClipPathHelper * | findClipPath (const QString &id) |
| find clip path with given id in clip path map | |
| SvgGradientHelper * | findGradient (const QString &id) |
| find gradient with given id in gradient map | |
| QSharedPointer< KoVectorPatternBackground > | findPattern (const QString &id, const KoShape *shape) |
| find pattern with given id in pattern map | |
| KoShape * | getTextPath (const QDomElement &e, bool hideShapesFromDefs=true) |
| Get the path for the gives textPath element. | |
| QDomText | getTheOnlyTextChild (const QDomElement &e) |
| qreal | parseAngular (const QString &unit) |
| parses a angular attribute values, result in radians | |
| bool | parseClipMask (const QDomElement &e) |
| bool | parseClipPath (const QDomElement &) |
| Parses a clip path element. | |
| QList< KoShape * > | parseContainer (const QDomElement &) |
| Parses a container element, returning a list of child shapes. | |
| bool | parseFilter (const QDomElement &, const QDomElement &referencedBy=QDomElement()) |
| Parses a filter element. | |
| SvgGradientHelper * | parseGradient (const QDomElement &) |
| Parses a gradient element. | |
| KoShape * | parseGroup (const QDomElement &e, const QDomElement &overrideChildrenFrom=QDomElement(), bool createContext=true) |
| Parses a group-like element element, saving all its topmost properties. | |
| bool | parseMarker (const QDomElement &e) |
| SvgGradientHelper * | parseMeshGradient (const QDomElement &) |
| Parses mesh gradient element. | |
| QList< QPair< QString, QColor > > | parseMeshPatch (const QDomNode &meshpatch) |
| Parses a single meshpatch and returns the pointer. | |
| void | parseMetadataApplyToShape (const QDomElement &e, KoShape *shape) |
| This parses the SVG native title and desc elements and adds them into additional attributes. | |
| QSharedPointer< KoVectorPatternBackground > | parsePattern (const QDomElement &e, const KoShape *__shape) |
| Parses a pattern element. | |
| QList< KoShape * > | parseSingleElement (const QDomElement &b, DeferredUseStore *deferredUseStore=0) |
| XXX. | |
| bool | parseSymbol (const QDomElement &e) |
| void | parseTextChildren (const QDomElement &e, KoSvgTextLoader &textLoader, bool hideShapesFromDefs=true) |
| parse children of a <text > element into the root shape. | |
| qreal | parseUnit (const QString &, bool horiz=false, bool vert=false, const QRectF &bbox=QRectF()) |
| parses a length attribute | |
| qreal | parseUnitX (const QString &unit) |
| parses a length attribute in x-direction | |
| qreal | parseUnitXY (const QString &unit) |
| parses a length attribute in xy-direction | |
| qreal | parseUnitY (const QString &unit) |
| parses a length attribute in y-direction | |
| KoShape * | parseUse (const QDomElement &, DeferredUseStore *deferredUseStore) |
| Parses a use element, returning a list of child shapes. | |
| KoShape * | resolveUse (const QDomElement &e, const QString &key) |
| bool | shapeInDefs (const KoShape *shape) |
| Check whether the shapes are in the defs of the SVG document. | |
| void | uploadStyleToContext (const QDomElement &e) |
Private Attributes | |
| QMap< QString, QSharedPointer< KoClipMask > > | m_clipMasks |
| QMap< QString, SvgClipPathHelper > | m_clipPaths |
| SvgLoadingContext | m_context |
| QList< KoShape * > | m_defsShapes |
| QString | m_documentDescription |
| KoDocumentResourceManager * | m_documentResourceManager |
| QString | m_documentTitle |
| QMap< QString, SvgGradientHelper > | m_gradients |
| bool | m_inheritStrokeFillByDefault = false |
| bool | m_isInsideTextSubtree = false |
| QMap< QString, QExplicitlySharedDataPointer< KoMarker > > | m_markers |
| bool | m_resolveTextPropertiesForTopLevel = true |
| QMap< KoShape *, QTransform > | m_shapeParentTransform |
| QList< KoShape * > | m_shapes |
| QMap< QString, KoSvgSymbol * > | m_symbols |
| QVector< KoID > | m_warnings |
Definition at line 38 of file SvgParser.h.
| typedef std::function<QByteArray(const QString&) SvgParser::FileFetcherFunc) |
Definition at line 81 of file SvgParser.h.
|
explicit |
Definition at line 126 of file SvgParser.cpp.
|
virtual |
Definition at line 132 of file SvgParser.cpp.
References m_defsShapes, and m_symbols.
|
protected |
Adds list of shapes to the given group shape.
Definition at line 1398 of file SvgParser.cpp.
References m_shapes, KoShapeGroupCommand::redo(), and shapes().
|
protected |
Applies the current clip path to the object.
Definition at line 1305 of file SvgParser.cpp.
References KoShape::applyAbsoluteTransformation(), SvgGraphicsContext::clipPathId, SvgClipPathHelper::clipPathUnits(), KoShape::cloneShape(), SvgLoadingContext::currentGC(), findClipPath(), SvgClipPathHelper::isEmpty(), KIS_ASSERT_RECOVER, m_context, KoFlake::ObjectBoundingBox, KoShape::setClipPath(), SvgClipPathHelper::shapes(), shapes(), and KoFlake::UserSpaceOnUse.
WARNING: here is a small inconsistency with the standard: in the standard, 'display' is not inherited, but in flake it is!
NOTE: though the standard says: "A value of 'display:none' indicates that the given element and <em><strong>its children</strong></em> shall not be rendered directly". Therefore, using setVisible(false) is fully legitimate here (DK 29.11.16).
Definition at line 936 of file SvgParser.cpp.
References applyFillStyle(), applyPaintOrder(), applyStrokeStyle(), SvgLoadingContext::currentGC(), SvgGraphicsContext::display, KIS_ASSERT, m_context, SvgGraphicsContext::opacity, KoShape::setTransparency(), KoShape::setVisible(), and SvgGraphicsContext::visible.
|
protected |
Definition at line 921 of file SvgParser.cpp.
References applyClipping(), applyCurrentBasicStyle(), applyMarkers(), and applyMaskClipping().
Applies the current fill style to the object.
Definition at line 1133 of file SvgParser.cpp.
References SvgGraphicsContext::Complex, SvgLoadingContext::currentGC(), SvgGraphicsContext::fillColor, SvgGraphicsContext::fillId, SvgGraphicsContext::fillRule, SvgGraphicsContext::fillType, findGradient(), findPattern(), SvgGradientHelper::gradient(), SvgGraphicsContext::Inherit, SvgGradientHelper::isMeshGradient(), m_context, SvgGraphicsContext::None, prepareGradientForShape(), prepareMeshGradientForShape(), KoShape::setBackground(), KoPathShape::setFillRule(), KoShape::setInheritBackground(), SvgGraphicsContext::Solid, and toQShared().
Applies id to specified shape.
Definition at line 2237 of file SvgParser.cpp.
References debugFlake, m_context, SvgLoadingContext::registerShape(), KoShape::setName(), and SvgLoadingContext::shapeById().
|
protected |
Definition at line 1249 of file SvgParser.cpp.
References SvgGraphicsContext::autoFillMarkers, SvgLoadingContext::currentGC(), KoFlake::EndMarker, m_context, m_markers, SvgGraphicsContext::markerEndId, SvgGraphicsContext::markerMidId, SvgGraphicsContext::markerStartId, KoFlake::MidMarker, KoPathShape::setAutoFillMarkers(), KoPathShape::setMarker(), and KoFlake::StartMarker.
|
protected |
Definition at line 1343 of file SvgParser.cpp.
References SvgGraphicsContext::clipMaskId, SvgLoadingContext::currentGC(), m_clipMasks, m_context, KoShape::setClipMask(), and KoClipMask::setExtraShapeOffset().
Definition at line 1270 of file SvgParser.cpp.
References SvgLoadingContext::currentGC(), KoShape::defaultPaintOrder(), KoShape::Fill, m_context, KoShape::Markers, p, SvgGraphicsContext::paintOrder, KoShape::setPaintOrder(), and KoShape::Stroke.
Applies the current stroke style to the object.
Definition at line 1206 of file SvgParser.cpp.
References applyDashes(), SvgGraphicsContext::Complex, SvgLoadingContext::currentGC(), findGradient(), SvgGraphicsContext::Inherit, m_context, SvgGraphicsContext::None, prepareGradientForShape(), KoShape::setInheritStroke(), KoShape::setStroke(), SvgGraphicsContext::Solid, SvgGraphicsContext::stroke, SvgGraphicsContext::strokeId, and SvgGraphicsContext::strokeType.
|
protected |
Applies styles to the given shape.
Definition at line 967 of file SvgParser.cpp.
References applyStyle(), SvgStyleParser::collectStyles(), m_context, and SvgLoadingContext::styleParser.
|
protected |
Applies styles to the given shape.
Definition at line 972 of file SvgParser.cpp.
References applyClipping(), applyFillStyle(), applyMarkers(), applyMaskClipping(), applyPaintOrder(), applyStrokeStyle(), SvgLoadingContext::currentGC(), SvgGraphicsContext::display, m_context, m_inheritStrokeFillByDefault, SvgGraphicsContext::opacity, SvgStyleParser::parseStyle(), KoShape::setTransparency(), KoShape::setVisible(), SvgLoadingContext::styleParser, and SvgGraphicsContext::visible.
|
protected |
Applies viewBox transformation to the current graphical context NOTE: after applying the function currentBoundingBox can become null!
Definition at line 1509 of file SvgParser.cpp.
References SvgGraphicsContext::currentBoundingBox, SvgLoadingContext::currentGC(), m_context, SvgGraphicsContext::matrix, and SvgUtil::parseViewBox().
Builds the document from the given shapes list.
|
static |
Definition at line 172 of file SvgParser.cpp.
References createDocumentFromSvg(), and source().
|
static |
Definition at line 183 of file SvgParser.cpp.
References createDocumentFromSvg(), and source().
|
static |
Definition at line 162 of file SvgParser.cpp.
References createDocumentFromSvg(), and source().
|
static |
Definition at line 194 of file SvgParser.cpp.
|
protected |
Create a list of shapes from a CSS shapes definition with potentially multiple shapes.
Definition at line 2191 of file SvgParser.cpp.
References createShapeFromCSS(), and value().
|
protected |
Creates an object from the given xml element.
Definition at line 2038 of file SvgParser.cpp.
References KoShape::applyAbsoluteTransformation(), applyId(), applyStyle(), SvgStyleParser::collectStyles(), createShapeFromElement(), SvgLoadingContext::currentGC(), extraShapeOffset(), m_context, m_shapeParentTransform, SvgGraphicsContext::matrix, SvgLoadingContext::nextZIndex(), SvgStyleParser::parseFont(), parseMetadataApplyToShape(), SvgLoadingContext::popGraphicsContext(), SvgLoadingContext::pushGraphicsContext(), KoShape::setZIndex(), and SvgLoadingContext::styleParser.
|
protected |
Definition at line 2012 of file SvgParser.cpp.
References KoShape::applyAbsoluteTransformation(), applyCurrentStyle(), applyId(), createShapeFromElement(), SvgLoadingContext::currentGC(), extraShapeOffset(), m_context, m_shapeParentTransform, SvgGraphicsContext::matrix, SvgLoadingContext::nextZIndex(), parseMetadataApplyToShape(), SvgLoadingContext::popGraphicsContext(), SvgLoadingContext::pushGraphicsContext(), KoShape::setZIndex(), and uploadStyleToContext().
|
protected |
Create path object from the given xml element.
Definition at line 1942 of file SvgParser.cpp.
References KoPathShape::clear(), createShape(), SvgUtil::fromUserSpace(), KoPathShapeId, KoPathShapeLoader::parseSvg(), parseUnitX(), parseUnitY(), SvgUtil::simplifyList(), and KisDomUtils::toDouble().
|
protected |
creates a shape from the given shape id
Definition at line 2207 of file SvgParser.cpp.
References KoShapeFactoryBase::createDefaultShape(), debugFlake, KoGenericRegistry< T >::get(), KoShapeFactoryBase::id, KoShapeRegistry::instance(), m_documentResourceManager, KoShape::setBackground(), KoShape::setShapeId(), KoShape::setStroke(), KoShape::setTransformation(), and KoShape::shapeId().
|
protected |
Creates a shape from a CSS shapes definition.
Definition at line 2111 of file SvgParser.cpp.
References KoShape::absoluteTransformation(), KoShape::cloneShape(), createShapeFromElement(), SvgLoadingContext::currentGC(), m_context, m_shapeParentTransform, SvgUtil::parseUnitX(), SvgUtil::parseUnitXY(), SvgUtil::parseUnitY(), SvgLoadingContext::resolvedProperties(), KoShape::setTransformation(), KoShape::setTransparency(), SvgLoadingContext::shapeById(), shapeInDefs(), SvgUtil::simplifyList(), KoShape::size(), and value().
|
protected |
Creates shape from specified svg element.
Definition at line 2066 of file SvgParser.cpp.
References createPath(), KoShapeRegistry::factoriesForElement(), KoShapeRegistry::instance(), SvgShape::loadSvg(), m_documentResourceManager, SvgUtil::mapExtendedShapeTag(), KoShape::setBackground(), KoShape::setStroke(), KoShape::setTransformation(), KoShape::stroke(), and KoXmlNS::svg.
| QString SvgParser::documentDescription | ( | ) | const |
| QString SvgParser::documentTitle | ( | ) | const |
|
protected |
find clip path with given id in clip path map
Definition at line 319 of file SvgParser.cpp.
References m_clipPaths.
|
protected |
find gradient with given id in gradient map
Definition at line 282 of file SvgParser.cpp.
References SvgLoadingContext::definition(), SvgLoadingContext::hasDefinition(), m_context, m_gradients, parseGradient(), and parseMeshGradient().
|
protected |
find pattern with given id in pattern map
Definition at line 304 of file SvgParser.cpp.
References SvgLoadingContext::definition(), SvgLoadingContext::hasDefinition(), m_context, and parsePattern().
|
protected |
Get the path for the gives textPath element.
Definition at line 1639 of file SvgParser.cpp.
References KoShape::absoluteTransformation(), KoShape::cloneShape(), createPath(), m_context, m_shapeParentTransform, p, KoShape::setTransformation(), KoShape::setTransparency(), SvgLoadingContext::shapeById(), and shapeInDefs().
|
protected |
Definition at line 1622 of file SvgParser.cpp.
Definition at line 1535 of file SvgParser.cpp.
References m_markers.
|
protected |
parses a angular attribute values, result in radians
Definition at line 347 of file SvgParser.cpp.
References SvgLoadingContext::currentGC(), m_context, and SvgUtil::parseUnitAngular().
|
protected |
Definition at line 869 of file SvgParser.cpp.
References KoFlake::coordinatesFromString(), SvgLoadingContext::currentGC(), SvgUtil::fromPercentage(), m_clipMasks, m_context, SvgGraphicsContext::matrix, KoFlake::ObjectBoundingBox, parseGroup(), parseUnitX(), parseUnitY(), SvgLoadingContext::popGraphicsContext(), SvgLoadingContext::pushGraphicsContext(), KoFlake::UserSpaceOnUse, and SvgGraphicsContext::workaroundClearInheritedFillProperties().
|
protected |
Parses a clip path element.
Definition at line 842 of file SvgParser.cpp.
References KoFlake::coordinatesFromString(), SvgLoadingContext::currentGC(), m_clipPaths, m_context, SvgGraphicsContext::matrix, parseGroup(), SvgLoadingContext::popGraphicsContext(), SvgLoadingContext::pushGraphicsContext(), SvgClipPathHelper::setClipPathUnits(), SvgClipPathHelper::setShapes(), KoFlake::UserSpaceOnUse, and SvgGraphicsContext::workaroundClearInheritedFillProperties().
Parses a container element, returning a list of child shapes.
Definition at line 1806 of file SvgParser.cpp.
References parseSingleElement(), and shapes().
| void SvgParser::parseDefsElement | ( | const QDomElement & | e | ) |
Definition at line 1847 of file SvgParser.cpp.
References KIS_SAFE_ASSERT_RECOVER_RETURN, and parseSingleElement().
|
protected |
Parses a filter element.
|
protected |
Parses a gradient element.
Definition at line 353 of file SvgParser.cpp.
References SvgLoadingContext::currentGC(), debugFlake, findGradient(), SvgUtil::fromPercentage(), SvgGradientHelper::gradient(), SvgGradientHelper::gradientUnits(), m_context, m_gradients, KoFlake::ObjectBoundingBox, p, SvgStyleParser::parseColorStops(), parseUnitX(), parseUnitXY(), parseUnitY(), SvgLoadingContext::popGraphicsContext(), SvgLoadingContext::pushGraphicsContext(), SvgGradientHelper::setGradient(), SvgGradientHelper::setGradientUnits(), SvgGradientHelper::setSpreadMode(), SvgGradientHelper::setTransform(), SvgLoadingContext::styleParser, uploadStyleToContext(), and KoFlake::UserSpaceOnUse.
|
protected |
Parses a group-like element element, saving all its topmost properties.
Definition at line 1565 of file SvgParser.cpp.
References addToGroup(), KoShape::applyAbsoluteTransformation(), applyCurrentStyle(), applyId(), SvgLoadingContext::currentGC(), extraShapeOffset(), KoSvgTextShape_SHAPEID, KoSvgTextShape_TEXTCONTOURGROUP, m_context, SvgGraphicsContext::matrix, SvgLoadingContext::nextZIndex(), parseContainer(), parseGroup(), parseMetadataApplyToShape(), parseSingleElement(), SvgLoadingContext::popGraphicsContext(), SvgLoadingContext::pushGraphicsContext(), KoShape::setTransformation(), KoShape::setZIndex(), KoShape::shapeId(), KoShape::transformation(), and uploadStyleToContext().
|
protected |
Definition at line 738 of file SvgParser.cpp.
References KoMarker::coordinateSystemFromString(), SvgGraphicsContext::currentBoundingBox, SvgLoadingContext::currentGC(), m_context, m_markers, SvgGraphicsContext::matrix, parseAngular(), parseGroup(), parseUnitX(), parseUnitY(), SvgLoadingContext::popGraphicsContext(), and SvgLoadingContext::pushGraphicsContext().
|
protected |
Parses mesh gradient element.
Definition at line 464 of file SvgParser.cpp.
References SvgMeshGradient::BICUBIC, SvgMeshGradient::BILINEAR, SvgMeshPatch::Bottom, SvgMeshStop::color, debugFlake, findGradient(), m_gradients, p, parseMeshPatch(), parseUnitX(), parseUnitY(), SvgMeshStop::point, SvgMeshPatch::Right, SvgGradientHelper::setGradientUnits(), SvgGradientHelper::setMeshGradient(), SvgGradientHelper::setTransform(), and KoFlake::UserSpaceOnUse.
|
protected |
Parses a single meshpatch and returns the pointer.
Definition at line 555 of file SvgParser.cpp.
References SvgLoadingContext::currentGC(), forEachElement, m_context, SvgStyleParser::parseColorStop(), and SvgLoadingContext::styleParser.
This parses the SVG native title and desc elements and adds them into additional attributes.
Definition at line 822 of file SvgParser.cpp.
References getTheOnlyTextChild(), and KoShape::setAdditionalAttribute().
|
protected |
Parses a pattern element.
Unlike the gradient parsing function, this method is called every time we reference the pattern, not when we define it. Therefore we can already use the coordinate system of the destination.
In Krita shapes X,Y coordinates are baked into the shape global transform, but the pattern should be painted in "user" coordinates. Therefore, we should handle this offset separately.
TODO: Please also note that this offset is different from extraShapeOffset(), because A.inverted() * B != A * B.inverted(). I'm not sure which variant is correct (DK)
Definition at line 590 of file SvgParser.cpp.
References KoShape::absoluteTransformation(), KoShape::applyAbsoluteTransformation(), applyViewBoxTransform(), bakeShapeOffset(), KoFlake::coordinatesFromString(), SvgGraphicsContext::currentBoundingBox, SvgLoadingContext::currentGC(), extraShapeOffset(), findPattern(), SvgUtil::fromPercentage(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_context, SvgGraphicsContext::matrix, KoFlake::ObjectBoundingBox, KoShape::outline(), p, parseContainer(), parseUnitX(), parseUnitY(), SvgLoadingContext::popGraphicsContext(), SvgLoadingContext::pushGraphicsContext(), toQShared(), KoFlake::UserSpaceOnUse, and SvgGraphicsContext::workaroundClearInheritedFillProperties().
|
protected |
XXX.
WARNING: 'defs' are basically 'display:none' style, therefore they should not play any role in shapes outline calculation. But setVisible(false) shapes do! Should be fixed in the future!
Definition at line 1853 of file SvgParser.cpp.
References SvgLoadingContext::addDefinition(), SvgLoadingContext::addStyleSheet(), KoShape::boundingRect(), SvgParser::DeferredUseStore::checkPendingUse(), createObject(), createObjectDirect(), debugFlake, m_context, m_defsShapes, KoShape::outline(), KoShape::outlineRect(), parseClipMask(), parseClipPath(), parseContainer(), parseGroup(), parseMarker(), SvgLoadingContext::parseProfile(), parseSvg(), parseSymbol(), parseTextElement(), parseUse(), SvgLoadingContext::popGraphicsContext(), ppVar, SvgLoadingContext::pushGraphicsContext(), KisPortingUtils::setUtf8OnStream(), KoShape::setVisible(), KoShape::shapeId(), and shapes().
Parses a svg fragment, returning the list of top level child shapes.
In internal SVG coordinate systems pixels are linked to absolute values with a fixed ratio.
See CSS specification: https://www.w3.org/TR/css-values-3/#absolute-lengths
Definition at line 1410 of file SvgParser.cpp.
References applyStyle(), applyViewBoxTransform(), SvgGraphicsContext::currentBoundingBox, SvgLoadingContext::isRootContext(), m_context, m_documentDescription, m_documentTitle, SvgGraphicsContext::matrix, parseContainer(), parseUnit(), parseUnitX(), parseUnitY(), SvgUtil::parseViewBox(), SvgGraphicsContext::pixelsPerInch, SvgLoadingContext::popGraphicsContext(), SvgLoadingContext::pushGraphicsContext(), and shapes().
|
protected |
Definition at line 779 of file SvgParser.cpp.
References SvgGraphicsContext::currentBoundingBox, SvgLoadingContext::currentGC(), debugFlake, m_context, m_symbols, SvgGraphicsContext::matrix, parseGroup(), SvgLoadingContext::popGraphicsContext(), and SvgLoadingContext::pushGraphicsContext().
|
protected |
parse children of a <text > element into the root shape.
TODO: we should skip dublin core metadata too...
Definition at line 1671 of file SvgParser.cpp.
References applyCurrentBasicStyle(), KoSvgTextLoader::enterNodeSubtree(), getTextPath(), getTheOnlyTextChild(), KoSvgTextLoader::leaveNodeSubtree(), KoSvgTextLoader::loadSvg(), KoSvgTextLoader::loadSvgText(), m_context, KoSvgTextLoader::nextNode(), parseTextChildren(), SvgLoadingContext::popGraphicsContext(), SvgLoadingContext::pushGraphicsContext(), KoSvgTextLoader::setStyleInfo(), KoSvgTextLoader::setTextPathOnCurrentNode(), and uploadStyleToContext().
| KoShape * SvgParser::parseTextElement | ( | const QDomElement & | e, |
| KoSvgTextShape * | mergeIntoShape = 0 ) |
Definition at line 1704 of file SvgParser.cpp.
References KoShape::absoluteTransformation(), KoShape::applyAbsoluteTransformation(), applyCurrentBasicStyle(), applyCurrentStyle(), applyId(), KoShapeFactoryBase::createDefaultShape(), createListOfShapesFromCSS(), SvgLoadingContext::currentGC(), debugFlake, extraShapeOffset(), getTheOnlyTextChild(), KoSvgTextProperties::hasProperty(), KoShapeRegistry::instance(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, KoSvgTextProperties::KraTextVersionId, KoSvgTextLoader::loadSvg(), KoSvgTextLoader::loadSvgText(), m_context, m_documentResourceManager, m_isInsideTextSubtree, m_resolveTextPropertiesForTopLevel, m_warnings, SvgGraphicsContext::matrix, SvgLoadingContext::nextZIndex(), parseMetadataApplyToShape(), parseTextChildren(), SvgLoadingContext::popGraphicsContext(), KoSvgTextProperties::property(), SvgLoadingContext::pushGraphicsContext(), KoSvgTextProperties::setProperty(), KoSvgTextShape::setShapesInside(), KoSvgTextShape::setShapesSubtract(), KoShape::setZIndex(), SvgGraphicsContext::shapeInsideValue, SvgGraphicsContext::shapeSubtractValue, SvgGraphicsContext::textProperties, uploadStyleToContext(), and KoGenericRegistry< T >::value().
|
protected |
parses a length attribute
Definition at line 327 of file SvgParser.cpp.
References SvgLoadingContext::currentGC(), m_context, SvgUtil::parseUnit(), and SvgLoadingContext::resolvedProperties().
|
protected |
parses a length attribute in x-direction
Definition at line 332 of file SvgParser.cpp.
References SvgLoadingContext::currentGC(), m_context, SvgUtil::parseUnitX(), and SvgLoadingContext::resolvedProperties().
|
protected |
parses a length attribute in xy-direction
Definition at line 342 of file SvgParser.cpp.
References SvgLoadingContext::currentGC(), m_context, SvgUtil::parseUnitXY(), and SvgLoadingContext::resolvedProperties().
|
protected |
parses a length attribute in y-direction
Definition at line 337 of file SvgParser.cpp.
References SvgLoadingContext::currentGC(), m_context, SvgUtil::parseUnitY(), and SvgLoadingContext::resolvedProperties().
|
protected |
Parses a use element, returning a list of child shapes.
Definition at line 1363 of file SvgParser.cpp.
References SvgParser::DeferredUseStore::add(), debugFlake, SvgLoadingContext::hasDefinition(), m_context, and resolveUse().
|
protected |
Definition at line 1382 of file SvgParser.cpp.
References SvgLoadingContext::definition(), m_context, SvgGraphicsContext::matrix, parseGroup(), parseUnitX(), parseUnitY(), SvgLoadingContext::popGraphicsContext(), and SvgLoadingContext::pushGraphicsContext().
| void SvgParser::setDefaultKraTextVersion | ( | int | version | ) |
Definition at line 251 of file SvgParser.cpp.
References SvgLoadingContext::currentGC(), KIS_SAFE_ASSERT_RECOVER_RETURN, KoSvgTextProperties::KraTextVersionId, m_context, KoSvgTextProperties::setProperty(), and SvgGraphicsContext::textProperties.
| void SvgParser::setFileFetcher | ( | SvgParser::FileFetcherFunc | func | ) |
Definition at line 1550 of file SvgParser.cpp.
References m_context, and SvgLoadingContext::setFileFetcher().
| void SvgParser::setFillStrokeInheritByDefault | ( | const bool | enable | ) |
Definition at line 257 of file SvgParser.cpp.
References m_inheritStrokeFillByDefault.
| void SvgParser::setResolution | ( | const QRectF | boundsInPixels, |
| qreal | pixelsPerInch ) |
Definition at line 238 of file SvgParser.cpp.
References SvgGraphicsContext::currentBoundingBox, SvgLoadingContext::currentGC(), SvgGraphicsContext::isResolutionFrame, KIS_ASSERT, m_context, SvgGraphicsContext::matrix, SvgGraphicsContext::pixelsPerInch, and SvgLoadingContext::pushGraphicsContext().
| void SvgParser::setResolveTextPropertiesForTopLevel | ( | const bool | enable | ) |
Definition at line 262 of file SvgParser.cpp.
References m_resolveTextPropertiesForTopLevel.
| void SvgParser::setXmlBaseDir | ( | const QString & | baseDir | ) |
Sets the initial xml base directory (the directory form where the file is read)
Definition at line 218 of file SvgParser.cpp.
References m_context, setFileFetcher(), SvgLoadingContext::setInitialXmlBaseDir(), and SvgLoadingContext::xmlBaseDir().
|
protected |
Check whether the shapes are in the defs of the SVG document.
Definition at line 1629 of file SvgParser.cpp.
References KoShape::hasCommonParent(), and m_defsShapes.
Returns the list of all shapes of the svg document.
Definition at line 267 of file SvgParser.cpp.
References m_shapes.
| QVector< KoSvgSymbol * > SvgParser::takeSymbols | ( | ) |
Takes the collection of symbols contained in the svg document. The parser will no longer know about the symbols.
Definition at line 272 of file SvgParser.cpp.
References m_symbols.
|
protected |
Definition at line 914 of file SvgParser.cpp.
References SvgStyleParser::collectStyles(), m_context, m_inheritStrokeFillByDefault, SvgStyleParser::parseFont(), SvgStyleParser::parseStyle(), and SvgLoadingContext::styleParser.
| QStringList SvgParser::warnings | ( | ) | const |
Definition at line 1524 of file SvgParser.cpp.
References m_warnings, and warnings().
|
private |
Definition at line 228 of file SvgParser.h.
|
private |
Definition at line 227 of file SvgParser.h.
|
private |
Definition at line 225 of file SvgParser.h.
Definition at line 233 of file SvgParser.h.
|
private |
Definition at line 236 of file SvgParser.h.
|
private |
Definition at line 230 of file SvgParser.h.
|
private |
Definition at line 235 of file SvgParser.h.
|
private |
Definition at line 226 of file SvgParser.h.
|
private |
Definition at line 239 of file SvgParser.h.
|
private |
Definition at line 234 of file SvgParser.h.
|
private |
Definition at line 229 of file SvgParser.h.
|
private |
Definition at line 240 of file SvgParser.h.
|
private |
Definition at line 238 of file SvgParser.h.
Definition at line 231 of file SvgParser.h.
|
private |
Definition at line 232 of file SvgParser.h.
Definition at line 237 of file SvgParser.h.