Tools for creating masks for graphic objects based on their contours.
More...
#include <TreeUtilsSVG.h>
|
| enum | MaskPosition { NONE =0
, TOP =1
, BOTTOM =2
} |
| |
|
|
| MaskerSVG (const MaskerSVG &masker) |
| |
| int | visitPrefix (TreeSVG &tree, const TreeSVG::path_t &path) override |
| | Ensures a clipping path o f type RECT of given size.
|
| |
|
int | visitPostfix (TreeSVG &tree, const TreeSVG::path_t &path) override |
| |
|
virtual int | visitPrefix (TreeSVG &tree, const typename T::path_t &path) |
| | Tasks to be executed before traversing child nodes.
|
| |
|
virtual int | visitPostfix (TreeSVG &tree, const typename T::path_t &path) |
| | Tasks to be executed after traversing child nodes.
|
| |
|
| 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 that group.
|
| |
|
static TreeSVG & | getMask (TreeSVG &root, const std::string &maskId) |
| | From global document definitions (DEFS), retrieve the mask designed for this group.
|
| |
| static drain::image::TreeSVG & | updateMask (TreeSVG &mask, int width, int height, const NodeSVG &contourNode) |
| | Method for an object to copy its contour.
|
| |
| 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().
|
| |
| 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 object. Disabled; see addCoverRect() below.
|
| |
|
|
static const std::string | MASK_ID = "data-mask" |
| |
|
static const std::string | MASK_POS = "data-mask-pos" |
| |
|
static const ClassXML | COVER |
| |
Tools for creating masks for graphic objects based on their contours.
◆ addCoverRect()
| void addCoverRect |
( |
const TreeSVG & |
mask, |
|
|
TreeSVG & |
group, |
|
|
MaskPosition |
pos = TOP |
|
) |
| |
|
static |
Finally, associate the object with a mask by assigning MASK elements ID to the mask attribute of object. Disabled; see addCoverRect() below.
Finally, associate the object with a mask by assigning MASK elements ID to the mask attribute of object. The mask parameter with be assigned value "url(" + maskId + ")".
- Parameters
-
| mask | - SVG object of type MASK. |
| group | - SVG group containing graphics, appended by a RECT of class COVER. |
◆ createMask()
| TreeSVG & createMask |
( |
TreeSVG & |
root, |
|
|
TreeSVG & |
group, |
|
|
int |
width = 0, |
|
|
int |
height = 0, |
|
|
const NodeSVG & |
node = NodeSVG(svg::UNDEFINED), |
|
|
MaskerSVG::MaskPosition |
pos = MaskerSVG::MaskPosition::BOTTOM |
|
) |
| |
|
static |
Calls createMaskId(), getMask() and updateMask().
Saves the following attributes to group
- data-mask-id
- data-mask-pos
◆ ensureMaskId()
Mark an overlay group "masked", meaning that at least one of its objects (also) creates a mask for that group.
Later, a RECT will be appended, serving as a masking element.
◆ updateMask()
| drain::image::TreeSVG & updateMask |
( |
TreeSVG & |
mask, |
|
|
int |
width, |
|
|
int |
height, |
|
|
const NodeSVG & |
contourNode |
|
) |
| |
|
static |
Method for an object to copy its contour.
- Parameters
-
| mask | - SVG object of type MASK. |
| width | - width of the originating object |
| height | - height of the originating object |
| contourNode | - (closed) SVG element, typically of type PATH, to be copied to the mask. |
◆ visitPrefix()
| int visitPrefix |
( |
TreeSVG & |
tree, |
|
|
const TreeSVG::path_t & |
path |
|
) |
| |
|
inlineoverride |
Ensures a clipping path o f type RECT of given size.
static void traverse(H &visitor, T &tree, const typename T::path_t &path=typename T::path_t())
Traverse tree, visiting each node as a prefix operation.
Definition TreeUtils.h:112
Tools for creating masks for graphic objects based on their contours.
Definition TreeUtilsSVG.h:280
The documentation for this class was generated from the following files: