blob: 19f55625e5e9424a4b7b1ce881dee3ff17c3b9c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
SVG.Mask = function Mask() {
this.constructor.call(this, SVG.create('mask'));
// set unique id
this.id = 'svgjs_' + (SVG.did++);
this.attr('id', this.id);
};
// inherit from SVG.Element
SVG.Mask.prototype = new SVG.Element();
// include the container object
SVG.extend(SVG.Mask, SVG.Container);
// add clipping functionality to element
SVG.extend(SVG.Element, {
// distribute mask to svg element
maskWith: function(e) {
return this.attr('mask', 'url(#' + (e instanceof SVG.Mask ? e : this.parent.mask().add(e)).id + ')');
}
});
|