From 43b2a271dbb73e811b6140a0e085b17919d3344d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Tue, 27 Aug 2024 21:33:39 +0200 Subject: [PATCH] Box: support SVG transform effects #173 Only 'follow path' is supported. --- src/core/Boxes/boundingbox.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/core/Boxes/boundingbox.cpp b/src/core/Boxes/boundingbox.cpp index 7bd728f19..033995e62 100644 --- a/src/core/Boxes/boundingbox.cpp +++ b/src/core/Boxes/boundingbox.cpp @@ -1414,15 +1414,29 @@ eTask* BoundingBox::saveSVGWithTransform(SvgExporter& exp, taskPtr->addDependent({[ptr, taskPtr, expPtr, parentPtr, visRange, maskId]() { auto& ele = taskPtr->element(); if (ptr) { + ele.setAttribute("id", AppSupport::filterId(ptr->prp_getName())); SvgExportHelpers::assignVisibility(*expPtr, ele, visRange); + + const auto transformEffects = ptr->mTransformEffectCollection.get(); + const bool hasTransformEffects = transformEffects->hasEffectsSVG(); + const auto transform = ptr->mTransformAnimator.get(); const auto transformed = transform->saveSVG(*expPtr, visRange, ele); const auto effects = ptr->mRasterEffectsAnimators.get(); - const auto withEffects = effects->saveEffectsSVG(*expPtr, visRange, transformed); + const auto withEffects = hasTransformEffects ? + transformEffects->saveEffectsSVG(*expPtr, + visRange, + ele, + effects->saveEffectsSVG(*expPtr, + visRange, + transformed)) : + effects->saveEffectsSVG(*expPtr, + visRange, + transformed); if (maskId == ptr->prp_getName()) { // move mask to defs auto& eleMask = taskPtr->initialize("mask"); - eleMask.setAttribute("id", QString(ptr->prp_getName()).simplified().replace(" ", "")); + eleMask.setAttribute("id", AppSupport::filterId(ptr->prp_getName())); eleMask.appendChild(withEffects); expPtr->addToDefs(eleMask); } else {