Skip to content

Commit

Permalink
Box: support SVG transform effects #173
Browse files Browse the repository at this point in the history
Only 'follow path' is supported.
  • Loading branch information
rodlie committed Aug 27, 2024
1 parent 2f21897 commit 43b2a27
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/core/Boxes/boundingbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 43b2a27

Please sign in to comment.