Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
MaskerSVG Class Reference

Tools for creating masks for graphic objects based on their contours. More...

#include <TreeUtilsSVG.h>

Inheritance diagram for MaskerSVG:
Inheritance graph
[legend]
Collaboration diagram for MaskerSVG:
Collaboration graph
[legend]

Public Member Functions

 MaskerSVG (const MaskerSVG &clipper)
 
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
 
- Public Member Functions inherited from TreeVisitor< TreeSVG >
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 Public Member Functions

static const drain::FlexibleVariablecreateMaskId (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))
 Calls createMaskId(), getMask() and updateMask().
 
static void linkMask (const TreeSVG &mask, TreeSVG &obj)
 Finally, associate the object with a mask by assigning MASK elements ID to the mask attribute of object.
 

Static Public Attributes

static const std::string MASK_ID = "data-mask"
 
static const ClassXML COVER
 

Detailed Description

Tools for creating masks for graphic objects based on their contours.

Member Function Documentation

◆ createMaskId()

const drain::FlexibleVariable & createMaskId ( TreeSVG &  group)
static

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.

◆ linkMask()

void linkMask ( const TreeSVG &  mask,
TreeSVG &  obj 
)
static

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.
obj- SVG element, typically of type RECT, to be masked.

◆ 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:118
Tools for creating masks for graphic objects based on their contours.
Definition TreeUtilsSVG.h:206
Definition TreeSVG.h:104

The documentation for this class was generated from the following files: