38#ifndef DRAIN_TREE_UTILS_SVG
39#define DRAIN_TREE_UTILS_SVG
43#include <drain/Enum.h>
88DRAIN_ENUM_DICT(TreeUtilsSVG::Roles);
89DRAIN_ENUM_OSTREAM(TreeUtilsSVG::Roles)
109 const std::string prefixNew;
114 removePath(filepath),
115 prefixNew(prefixNew) {
128 int visitPrefix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
142 const std::string LOCAL;
145 const std::string SHARED;
155 int visitPrefix(TreeSVG & tree,
const TreeSVG::path_t & path)
override {
160 int visitPostfix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
167 typedef std::map<std::string, unsigned short> variableStat_t;
180 const std::string FLOATING;
192 int visitPrefix(TreeSVG & tree,
const TreeSVG::path_t & path)
override {
197 int visitPostfix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
211 const std::string OVERLAY;
221 int visitPrefix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
230 int visitPostfix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
245 const std::string CLIPPED;
260 TreeSVG &
getClippingRect(TreeSVG & root,
size_t width,
size_t height);
263 int visitPrefix(TreeSVG & tree,
const TreeSVG::path_t & path)
override {
268 int visitPostfix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
285 const std::string MASK_ID;
288 const std::string MASK_POS;
318 TreeSVG &
getMask(TreeSVG & root,
const std::string & maskId);
328 drain::image::TreeSVG &
updateMask(TreeSVG & mask,
int width,
int height,
const NodeSVG & contourNode);
338 TreeSVG &
createMask(TreeSVG & root, TreeSVG & group,
int width=0,
int height=0,
const NodeSVG & node =
NodeSVG(svg::UNDEFINED),
339 MaskerSVG::MaskPosition pos=MaskerSVG::MaskPosition::BOTTOM);
354 void addCoverRect(
const TreeSVG & mask, TreeSVG & group, MaskPosition pos=TOP);
366 int visitPrefix(TreeSVG & tree,
const TreeSVG::path_t & path)
override {
370 int visitPostfix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
404 int visitPrefix(TreeSVG & tree,
const TreeSVG::path_t & path)
override {
405 if (tree.data.typeIs(svg::SVG, svg::GROUP)){
413 int visitPostfix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
446DRAIN_ENUM_DICT(image::MaskerSVG::MaskPosition);
447DRAIN_ENUM_OSTREAM(image::MaskerSVG::MaskPosition)
A wrapper marking string an CSS effect.
Definition ClassXML.h:57
Extracts and stores directory path, base filename and extension.
Definition FilePath.h:54
Default implementation of a tree visitor (concept) compatible TreeUtils::traverser()
Definition TreeUtils.h:253
VariableT is a final class applied through typedefs Variable, Reference and FlexibleVariable.
Definition VariableT.h:87
Definition TreeUtilsSVG.h:240
static TreeSVG & getClippingRect(TreeSVG &root, size_t width, size_t height)
Ensures a clipping path o f type RECT of given size.
Definition TreeUtilsSVG.cpp:379
Raises FLOATING elements on the top.
Definition TreeUtilsSVG.h:176
Tools for creating masks for graphic objects based on their contours.
Definition TreeUtilsSVG.h:280
static drain::image::TreeSVG & updateMask(TreeSVG &mask, int width, int height, const NodeSVG &contourNode)
Method for an object to copy its contour.
Definition TreeUtilsSVG.cpp:477
static TreeSVG & getMask(TreeSVG &root, const std::string &maskId)
From global document definitions (DEFS), retrieve the mask designed for this group.
Definition TreeUtilsSVG.cpp:444
static void addCoverRect(const TreeSVG &mask, TreeSVG &group, MaskPosition pos=TOP)
Finally, associate the object with a mask by assigning MASK elements ID to the mask attribute of obje...
Definition TreeUtilsSVG.cpp:513
static const drain::FlexibleVariable & ensureMaskId(TreeSVG &group)
Mark an overlay group "masked", meaning that at least one of its objects (also) creates a mask for th...
Definition TreeUtilsSVG.cpp:432
static TreeSVG & createMask(TreeSVG &root, TreeSVG &group, int width=0, int height=0, const NodeSVG &node=NodeSVG(svg::UNDEFINED), MaskerSVG::MaskPosition pos=MaskerSVG::MaskPosition::BOTTOM)
Calls createMaskId(), getMask() and updateMask().
Definition TreeUtilsSVG.cpp:497
int visitPrefix(TreeSVG &tree, const TreeSVG::path_t &path) override
Ensures a clipping path o f type RECT of given size.
Definition TreeUtilsSVG.h:366
Within a group, moves elements of class OVERLAY to the subgroup.
Definition TreeUtilsSVG.h:207
Definition TreeUtilsSVG.h:100
SVG classes marking requests of relative horizontal and vertical alignment.
Definition TreeUtilsSVG.h:61