File: masking.rst

package info (click to toggle)
svgwrite 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,304 kB
  • sloc: python: 12,524; makefile: 116; sh: 5
file content (147 lines) | stat: -rw-r--r-- 5,022 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
ClipPath
========

.. autoclass:: svgwrite.masking.ClipPath

Adding clipping elements to :class:`ClipPath`::

  dwg = svgwrite.Drawing()
  clip_path = dwg.defs.add(dwg.clipPath())
  clip_path.add(dwg.circle((100, 100), 50))

.. seealso:: http://www.w3.org/TR/SVG11/masking.html#ClippingPaths

SVG Attributes
--------------

* **class** -- `string`

  assigns one or more css-class-names to an element

* **style** -- `string`

  allows per-element css-style rules to be specified directly on a given element

* **externalResourcesRequired** -- `bool`

  *False*: if document rendering can proceed
  even if external resources are unavailable else: *True*

* **transform** -- use :class:`svgwrite.mixins.Transform` methods

* **clipPathUnits** -- ``'userSpaceOnUse | objectBoundingBox'``

  Defines the coordinate system for the contents of the **clipPath**.

  If clipPathUnits = ``'userSpaceOnUse'`` , the contents of the **clipPath**
  represent values in the current user coordinate system in place at the
  time when the **clipPath** element is referenced (i.e., the user
  coordinate system for the element referencing the **clipPath** element
  via the **clip-path** property).

  If clipPathUnits = ``'objectBoundingBox'`` , then the user coordinate system
  for the contents of the **clipPath** element is established using the
  bounding box of the element to which the clipping path is applied.

  Default is ``'userSpaceOnUse'``

Standard SVG Attributes
-----------------------

* :doc:`Core Attributes </attributes/core>`
* :doc:`Conditional Processing Attributes </attributes/conditional_processing>`
* :doc:`Presentation Attributes </attributes/presentation>`

Mask
====

.. autoclass:: svgwrite.masking.Mask

.. seealso:: http://www.w3.org/TR/SVG11/masking.html#Masking

SVG Attributes
--------------

* **class** -- `string`

  assigns one or more css-class-names to an element

* **style** -- `string`

  allows per-element css-style rules to be specified directly on a given element

* **externalResourcesRequired** -- `bool`

  `False`: if document rendering can proceed even if external resources are
  unavailable else: `True`

* **maskUnits** -- ``'userSpaceOnUse | objectBoundingBox'``

  Defines the coordinate system for attributes **x**, **y**, **width** and
  **height**.

  If maskUnits = ``'userSpaceOnUse'`` , **x**, **y**, **width** and **height**
  represent values in the current user coordinate system in place at the time
  when the **mask** element is referenced (i.e., the user coordinate system
  for the element referencing the **mask** element via the **mask** property).

  If maskUnits = ``'objectBoundingBox'`` , **x**, **y**, **width** and **height**
  represent fractions or percentages of the bounding box of the element to
  which the mask is applied.

  Default is ``'objectBoundingBox'``.

* **maskContentUnits** -- ``'userSpaceOnUse | objectBoundingBox'``

  Defines the coordinate system for the contents of the **mask**.

  If maskContentUnits = ``'userSpaceOnUse'`` , the user coordinate system for
  the contents of the **mask** element is the current user coordinate system
  in place at the time when the **mask** element is referenced (i.e., the user
  coordinate system for the element referencing the **mask** element via the
  **mask** property).

  If maskContentUnits = ``'objectBoundingBox'`` , the user coordinate system for
  the contents of the **mask** is established using the bounding box of the
  element to which the mask is applied.

  Default is ``'userSpaceOnUse'``.

* **x** -- `<coordinate>` -- **start** parameter

  The x-axis coordinate of one corner of the rectangle for the largest
  possible offscreen buffer. Note that the clipping path used to render any
  graphics within the mask will consist of the intersection of the current
  clipping path associated with the given object and the rectangle defined by
  **x**, **y**, **width** and **height**.

  Default is ``'-10%'``.

* **y** -- `<coordinate>` -- **start** parameter

  The y-axis coordinate of one corner of the rectangle for the largest
  possible offscreen buffer.

  Default is ``'-10%'``.

* **width** -- `<length>` -- **size** parameter

  The width of the largest possible offscreen buffer. Note that the clipping
  path used to render any graphics within the mask will consist of the
  intersection of the current clipping path associated with the given object
  and the rectangle defined by **x**, **y**, **width** and **height**.

  Default is ``'120%'``.

* **height** -- `<length>` -- **size** parameter

  The height of the largest possible offscreen buffer.

  Default is ``'120%'``.

Standard SVG Attributes
-----------------------

* :doc:`Core Attributes </attributes/core>`
* :doc:`Conditional Processing Attributes </attributes/conditional_processing>`
* :doc:`Presentation Attributes </attributes/presentation>`