pax_global_header00006660000000000000000000000064140002611600014500gustar00rootroot0000000000000052 comment=c8cbf6f615910b3818ccf939fce0e407c9c789cb svgwrite-1.4.1/000077500000000000000000000000001400026116000133555ustar00rootroot00000000000000svgwrite-1.4.1/.github/000077500000000000000000000000001400026116000147155ustar00rootroot00000000000000svgwrite-1.4.1/.github/workflows/000077500000000000000000000000001400026116000167525ustar00rootroot00000000000000svgwrite-1.4.1/.github/workflows/testrunner.yml000066400000000000000000000013451400026116000217110ustar00rootroot00000000000000name: Testrunner on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: [3.6, 3.7, 3.8, 3.9, pypy-3.6] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install requirements run: | python -m pip install -U pip python -m pip install wheel pytest - name: Install svgwrite run: | python -m pip install . - name: Run pytest run: | python -m pytest svgwrite-1.4.1/.gitignore000066400000000000000000000001651400026116000153470ustar00rootroot00000000000000build/* dist/* .idea/* .cache/* .tox/* __pycache__ svgwrite.egg-info/* doc/_build/* issues/2017-01-28 nads_debugging svgwrite-1.4.1/LICENSE.TXT000066400000000000000000000042751400026116000150500ustar00rootroot00000000000000Copyright (c) 2012, Manfred Moitzi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Deutsche Übersetzung: Copyright (c) 2012, Manfred Moitzi Hiermit wird unentgeltlich, jeder Person, die eine Kopie der Software und der zugehörigen Dokumentationen (die "Software") erhält, die Erlaubnis erteilt, uneingeschränkt zu benutzen, inklusive und ohne Ausnahme, dem Recht, sie zu verwenden, kopieren, ändern, fusionieren, verlegen, verbreiten, unterlizenzieren und/oder zu verkaufen, und Personen, die diese Software erhalten, diese Rechte zu geben, unter den folgenden Bedingungen: Der obige Urheberrechtsvermerk und dieser Erlaubnisvermerk sind in allen Kopien oder Teilkopien der Software beizulegen. DIE SOFTWARE WIRD OHNE JEDE AUSDRÜCKLICHE ODER IMPLIZIERTE GARANTIE BEREITGESTELLT, EINSCHLIESSLICH DER GARANTIE ZUR BENUTZUNG FÜR DEN VORGESEHENEN ODER EINEM BESTIMMTEN ZWECK SOWIE JEGLICHER RECHTSVERLETZUNG, JEDOCH NICHT DARAUF BESCHRÄNKT. IN KEINEM FALL SIND DIE AUTOREN ODER COPYRIGHTINHABER FÜR JEGLICHEN SCHADEN ODER SONSTIGE ANSPRÜCHE HAFTBAR ZU MACHEN, OB INFOLGE DER ERFÜLLUNG EINES VERTRAGES, EINES DELIKTES ODER ANDERS IM ZUSAMMENHANG MIT DER SOFTWARE ODER SONSTIGER VERWENDUNG DER SOFTWARE ENTSTANDEN. svgwrite-1.4.1/MANIFEST.in000066400000000000000000000001661400026116000151160ustar00rootroot00000000000000include NEWS.rst README.rst LICENSE.TXT recursive-include examples *.py *.bat *.sh *.txt recursive-include tests *.py svgwrite-1.4.1/NEWS.rst000066400000000000000000000141601400026116000146650ustar00rootroot00000000000000 NEWS ==== Version 1.4.1 - 2021-01-15 -------------------------- * This package is in maintenance mode, no new features will be added, there will be no change of behavior, just bugfixes will be merged. * Merged some contributions and bugfixes. Version 1.4 - 2020-03-28 ------------------------ * Requires Python 3.6 * Removed Python2 support * Optimized/faster ``svgparser.py`` module by Florian Festi * Removed batch files to run tests on Windows, use ``pytest`` or ``tox`` instead Version 1.3.1 - 2019-06-28 -------------------------- * BUGFIX: changed license of module shapes.py to MIT license Version 1.3.0 - 2019-06-23 -------------------------- * Dropping Python 2 support in v1.4 * NEW: easy stylesheet embedding: `Drawing.embed_stylesheet(content)`, see example `using_fonts.py `_ * NEW: embedded local fonts: `Drawing.embed_font(fontname, filename)`, see example using_fonts.py * NEW: embedded web fonts: `Drawing.embed_google_web_font(fontname, uri)`, see example using_fonts.py * NEW: shapes extension by `Christof Hanke `_ * NEW: for write(), save() and saveas(), indentation for pretty print is configurable by `Mitar `_ * BUGFIX: converted regex strings in tests to raw strings by `tirkarthi `_ Version 1.2.1 - 2018-11-16 -------------------------- * BUGFIX: Python 2 pretty print encoding issue Version 1.2.0 - 2018-10-27 -------------------------- * NEW: Inkscape extension - support for Inkscape layers * BUGFIX: compatibility with Python 3.7 by fixing re.split() usage Version 1.1.12 - 2017-12-27 --------------------------- * BUGFIX: values attribute for element animate, accepts any semicolon separated values Version 1.1.11 - 2017-05-31 --------------------------- * CHANGED: e.set_markers((sm, mm, em)), accepts None/False values to set markers individually, like just set end marker: s.set_markers((None, False, em)) * BUGFIX: text-decoration attribute accepts multiple values like 'underline overline' Version 1.1.10 - 2017-01-28 --------------------------- * NEW: added `pretty` argument to `Drawing.write`, `Drawing.save` and `Drawing.saveas` to produce easy to read XML output, svgwrite reparses the output string with minidom, this reduces the performance because this process requires memory and runtime, default value for `pretty` is False. * Moved repository to GitHub.com: http://github.com/mozman/svgwrite.git Version 1.1.9 - 2016-10-26 -------------------------- * NEW: added solidColor paint server (only valid in the Tiny 1.2 profile) Version 1.1.8 - 2016-05-31 -------------------------- * BUGFIX: None checks: 'if value:' -> 'if value is not None:' Version 1.1.7 - 2016-05-22 -------------------------- * BUGFIX: color accepts percentage values as floats like "rgb(10.2%, 3.78%, 20%)" Version 1.1.6 - 2014-05-30 -------------------------- * BUGFIX: sign for offset-value wasn't optional Version 1.1.5 - 2014-03-26 -------------------------- * BUGFIX: xml serialization for CPython 3.4.0 Version 1.1.4 - 2014-03-16 -------------------------- * simplified path parser * pyparsing as external dependency (by jenselme) Version 1.1.3 - 2013-10-01 -------------------------- * updated pyparsing for Python 3 to version 2.0.1 (prior version caused memory leaks) * BUGFIX: utf8 to unicode encoding error for Python 2.7 * Tests for Python 3 require CPython3.3 or newer, using the 'u' prefix. Version 1.1.2 - 2013-01-08 -------------------------- * prevent setup.py from compiling all modules - error with 'pyparsing_py2.py' and Python3 * BUGFIX: all tests run with CPython3.3 Version 1.1.1 - 2012-08-15 -------------------------- * License changed to MIT License * tested with CPython2.7, CPython3.2, CPython3.3 and pypy-1.9 on Win7 Pro 32-bit * BUGFIX: dwg.animateTranform() -> dwg.animateTransform() * BUGFIX: in examples, replaced width and height params by size parameter * added examples * edit docs Version 1.0.1 - 2012-06-08 -------------------------- * added inline stylesheets * added examples created by Lawrence Tattrie Version 1.0.0 - 2012-05-27 -------------------------- * stable * tested with CPython 2.7, CPython 3.2, pypy-1.8 * added script tag - thx to jmahmood * docs also available at: http://readthedocs.org/docs/svgwrite Version 0.2.4 - 2011-12-30 -------------------------- * beta version * Python 2.7: all strings will be converted by the unicode() function, for strings containing none-ascii-characters use prefix ``u""`` or better use ``from __future__ import unicode_literals``, because this is Python 3 compatible. * tested with CPython 2.7, CPython 3.2, and PyPy 1.7 * BUGFIX: color parsing accepts white spaces in ``rgb()`` like ``rgb(0, 0, 0)`` Version 0.2.3 - 2010-11-13 -------------------------- * beta version * Python 3.1 support * splitted examples.py into several files and moved them to the subdir 'examples' Version 0.2.2 - 2010-11-05 -------------------------- * alpha version * removed 'attribs' parameter from all constructors * new elements: Set, Animate, AnimateMotion, AnimateColor, AnimateTransform, all filter elements * added set_desc(title, desc), set_metadata(xmldata) to BaseElement class * moved content of interfaces.py to mixins.py, (ITransform -> Transform and so on) Version 0.2.1 - 2010-10-31 -------------------------- * alpha version * new elements: Marker, ClipPath, Mask * paint service: LinearGradient, RadialGradient, Pattern Version 0.2.0 - 2010-10-24 -------------------------- * alpha version * validator rewritten as validator2.py * debug and profile options separated for each drawing object * important change: create objects with factory functions of the *Drawing* class: drawing.(...) * added mixins for setting stroke and fill properties * new elements: Hyperlink, Image, TextArea, Version 0.1.0 - 2010-09-26 -------------------------- * alpha version * new elements: * basic shapes: Line, Rect, Circle, Ellipse, Polyline, Polygon, Path * text elements: Text, TSpan, TRef, TextPath * container elements: Group, Symbol, SVG, Use, Defs * for examples see: examples.py svgwrite-1.4.1/README.rst000066400000000000000000000017671400026116000150570ustar00rootroot00000000000000svgwrite ======== This package is in maintenance mode, no new features will be added, there will be no change of behavior, just bugfixes will be merged. Abstract -------- A Python library to create SVG drawings. a simple example:: import svgwrite dwg = svgwrite.Drawing('test.svg', profile='tiny') dwg.add(dwg.line((0, 0), (10, 0), stroke=svgwrite.rgb(10, 10, 16, '%'))) dwg.add(dwg.text('Test', insert=(0, 0.2), fill='red')) dwg.save() for more examples see: examples.py As the name `svgwrite` implies, `svgwrite` creates new SVG drawings, it does not read existing drawings and also does not import existing drawings, but you can always include other SVG drawings by the entity. Installation ------------ with pip:: pip install svgwrite or from source:: python setup.py install Documentation ------------- http://readthedocs.org/docs/svgwrite/ svgwrite can be found on GitHub.com at: http://github.com/mozman/svgwrite.git Contact ------- svgwrite@mozman.at svgwrite-1.4.1/doc/000077500000000000000000000000001400026116000141225ustar00rootroot00000000000000svgwrite-1.4.1/doc/Makefile000066400000000000000000000107661400026116000155740ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/svgwrite.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/svgwrite.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/svgwrite" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/svgwrite" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." make -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." svgwrite-1.4.1/doc/_templates/000077500000000000000000000000001400026116000162575ustar00rootroot00000000000000svgwrite-1.4.1/doc/_templates/layout.html000066400000000000000000000010731400026116000204630ustar00rootroot00000000000000{% extends "!layout.html" %} {% block footer %} {{ super() }} {% endblock %} svgwrite-1.4.1/doc/attributes/000077500000000000000000000000001400026116000163105ustar00rootroot00000000000000svgwrite-1.4.1/doc/attributes/animation_addition.rst000066400000000000000000000040101400026116000226670ustar00rootroot00000000000000Animation Addition Attributes ============================= additive -------- additive = ``'replace | sum'`` Controls whether or not the animation is additive. ============= ================================================================= value description ============= ================================================================= ``'sum'`` Specifies that the animation will add to the underlying value of the attribute and other lower priority animations. ``'replace'`` Specifies that the animation will override the underlying value of the attribute and other lower priority animations. This is the default, however the behavior is also affected by the animation value attributes **by** and **to**, as described in SMIL Animation: How from, to and by attributes affect additive behavior. ============= ================================================================= .. seealso:: http://www.w3.org/TR/SVG11/animate.html#AdditiveAttribute accumulate ---------- accumulate = ``'none | sum'`` Controls whether or not the animation is cumulative. =========== ================================================================= value description =========== ================================================================= ``'sum'`` Specifies that each repeat iteration after the first builds upon the last value of the previous iteration. ``'none'`` Specifies that repeat iterations are not cumulative. This is the default. =========== ================================================================= This attribute is ignored if the target attribute value does not support addition, or if the animation element does not repeat. Cumulative animation is not defined for "to animation". This attribute will be ignored if the animation function is specified with only the **to** attribute. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#AccumulateAttributesvgwrite-1.4.1/doc/attributes/animation_events.rst000066400000000000000000000024341400026116000224100ustar00rootroot00000000000000Animation Events Attributes =========================== .. _onbegin: onbegin ------- .. seealso:: http://www.w3.org/TR/SVG11/script.html#OnBeginEventAttribute onbegin = `` Specifies some script to execute when "bubbling" or "at target" phase listeners for the corresponding event are fired on the element the attribute is specified on. See the Complete list of support events to determine which event each of these event attributes corresponds to. Complete list of support events: http://www.w3.org/TR/SVG11/interact.html#SVGEvents .. _onend: onend ----- onend = `` Complete list of support events: http://www.w3.org/TR/SVG11/interact.html#SVGEvents .. seealso:: http://www.w3.org/TR/SVG11/script.html#OnEndEventAttribute .. _onrepeat: onrepeat -------- onrepeat = `` Complete list of support events: http://www.w3.org/TR/SVG11/interact.html#SVGEvents .. seealso:: http://www.w3.org/TR/SVG11/script.html#OnRepeatEventAttribute .. _onload: onload ------ onload = `` Specifies some script to execute when "bubbling" or "at target" phase listeners for the SVGLoad event are fired on the element the attribute is specified on. .. seealso:: http://www.w3.org/TR/SVG11/script.html#OnLoadEventAttributesvgwrite-1.4.1/doc/attributes/animation_target.rst000066400000000000000000000037061400026116000223750ustar00rootroot00000000000000Animation Target Attributes =========================== .. _attributeType: attributeType ------------- Specifies the namespace in which the target attribute and its associated values are defined. The attribute value is one of the following (values are case-sensitive): =========== ================================================================= value description =========== ================================================================= ``CSS`` This specifies that the value of **attributeName** is the name of a CSS property defined as animatable in this specification. ``XML`` This specifies that the value of **attributeName** is the name of an XML attribute defined in the default XML namespace for the target element. If the value for **attributeName** has an XMLNS prefix, the implementation must use the associated namespace as defined in the scope of the target element. The attribute must be defined as animatable in this specification. ``auto`` The implementation should match the **attributeName** to an attribute for the target element. The implementation must first search through the list of CSS properties for a matching property name, and if none is found, search the default XML namespace for the element. =========== ================================================================= The default value is ``'auto'``. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#AttributeTypeAttribute .. _attributeName: attributeName ------------- attributeName = `` Specifies the name of the target attribute. An XMLNS prefix may be used to indicate the XML namespace for the attribute. The prefix will be interpreted in the scope of the current (i.e., the referencing) animation element. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#AttributeNameAttribute svgwrite-1.4.1/doc/attributes/animation_timing.rst000066400000000000000000000176131400026116000224000ustar00rootroot00000000000000Animation Timing Attributes =========================== .. _begin: begin ----- begin = `` Defines when the element should begin (i.e. become active). The attribute value is a semicolon separated list of values. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#BeginAttribute .. _dur: dur --- dur = `` | ``'media | indefinite'`` Specifies the simple duration. The attribute value can be one of the following: =============== ============================================================== value description =============== ============================================================== `` Specifies the length of the simple duration in presentation time. Value must be greater than 0. ``media`` Specifies the simple duration as the intrinsic media duration. This is only valid for elements that define media.(For SVG's animation elements, if ``'media'`` is specified, the attribute will be ignored.) ``indefinite`` Specifies the simple duration as indefinite. =============== ============================================================== If the animation does not have a **dur** attribute, the simple duration is indefinite. Note that interpolation will not work if the simple duration is indefinite (although this may still be useful for **set** elements). .. seealso:: http://www.w3.org/TR/SVG11/animate.html#DurAttribute .. _end: end --- end = `` Defines an end value for the animation that can constrain the active duration. The attribute value is a semicolon separated list of values. A value of ``'indefinite'`` specifies that the end of the animation will be determined by an endElement method call (the animation DOM methods are described in DOM interfaces). .. seealso:: http://www.w3.org/TR/SVG11/animate.html#EndAttribute .. _min: min --- min = `` | ``'media'`` Specifies the minimum value of the active duration. =============== ============================================================= value description =============== ============================================================= `` Specifies the length of the minimum value of the active duration, measured in local time. Value must be greater than 0. ``'media'`` Specifies the minimum value of the active duration as the intrinsic media duration. This is only valid for elements that define media. (For SVG's animation elements, if ``'media'`` is specified, the attribute will be ignored.) =============== ============================================================= The default value for **min** is ``'0'``. This does not constrain the active duration at all. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#MinAttribute .. _max: max --- max = `` | ``'media'`` Specifies the maximum value of the active duration. =============== ============================================================= value description =============== ============================================================= `` Specifies the length of the maximum value of the active duration, measured in local time. Value must be greater than 0. ``'media'`` Specifies the maximum value of the active duration as the intrinsic media duration. This is only valid for elements that define media. (For SVG's animation elements, if ``'media'`` is specified, the attribute will be ignored.) =============== ============================================================= There is no default value for **max**. This does not constrain the active duration at all. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#MaxAttribute .. _restart: restart ------- restart = ``'always | whenNotActive | never'`` =================== ========================================================== value description =================== ========================================================== ``'always'`` The animation can be restarted at any time. This is the default value. ``'whenNotActive'`` The animation can only be restarted when it is not active (i.e. after the active end). Attempts to restart the animation during its active duration are ignored. ``'never'`` The element cannot be restarted for the remainder of the current simple duration of the parent time container. (In the case of SVG, since the parent time container is the SVG document fragment, then the animation cannot be restarted for the remainder of the document duration.) =================== ========================================================== .. seealso:: http://www.w3.org/TR/SVG11/animate.html#RestartAttribute .. _repeatCount: repeatCount ----------- repeatCount = `` | ``'indefinite'`` Specifies the number of iterations of the animation function. It can have the following attribute values: ================ ============================================================ value description ================ ============================================================ `` This is a (base 10) "floating point" numeric value that specifies the number of iterations. It can include partial iterations expressed as fraction values. A fractional value describes a portion of the simple duration. Values must be greater than 0. ``'indefinite'`` The animation is defined to repeat indefinitely (i.e. until the document ends). ================ ============================================================ .. seealso:: http://www.w3.org/TR/SVG11/animate.html#RepeatCountAttribute .. _repeatDur: repeatDur --------- repeatDur = `` | ``'indefinite'`` Specifies the total duration for repeat. It can have the following attribute values: ================ ============================================================ value description ================ ============================================================ `` Specifies the duration in presentation time to repeat the animation function f(t). ``'indefinite'`` The animation is defined to repeat indefinitely (i.e. until the document ends). ================ ============================================================ .. seealso:: http://www.w3.org/TR/SVG11/animate.html#RepeatDurAttribute .. _animateFill: fill ---- fill = ``'freeze | remove'`` This attribute can have the following values: ============ ================================================================ value description ============ ================================================================ ``'freeze'`` The animation effect F(t) is defined to freeze the effect value at the last value of the active duration. The animation effect is "frozen" for the remainder of the document duration (or until the animation is restarted - see SMIL Animation: Restarting animation). ``'remove'`` The animation effect is removed (no longer applied) when the active duration of the animation is over. After the active end of the animation, the animation no longer affects the target (unless the animation is restarted - see SMIL Animation: Restarting animation). This is the default value. ============ ================================================================ .. seealso:: http://www.w3.org/TR/SVG11/animate.html#FillAttributesvgwrite-1.4.1/doc/attributes/animation_value.rst000066400000000000000000000130601400026116000222150ustar00rootroot00000000000000Animation Value Attributes ========================== .. _calcMode: calcMode -------- calcMode = ``'discrete | linear | paced | spline'`` Specifies the interpolation mode for the animation. This can take any of the following values. The default mode is ``'linear'``, however if the attribute does not support linear interpolation (e.g. for strings), the **calcMode** attribute is ignored and discrete interpolation is used. ============== ============================================================== value description ============== ============================================================== ``'discrete'`` This specifies that the animation function will jump from one value to the next without any interpolation. ``'linear'`` Simple linear interpolation between values is used to calculate the animation function. Except for **animateMotion**, this is the default **calcMode**. ``'paced'`` Defines interpolation to produce an even pace of change across the animation. This is only supported for values that define a linear numeric range, and for which some notion of "distance" between points can be calculated (e.g. position, width, height, etc.). If ``'paced'`` is specified, any **keyTimes** or **keySplines** will be ignored. For **animateMotion**, this is the default **calcMode**. ``'spline'`` Interpolates from one value in the **values** list to the next according to a time function defined by a cubic Bézier spline. The points of the spline are defined in the **keyTimes** attribute, and the control points for each interval are defined in the **keySplines** attribute. ============== ============================================================== .. seealso:: http://www.w3.org/TR/SVG11/animate.html#CalcModeAttribute .. _values: values ------ values = `` A semicolon-separated list of one or more values. Vector-valued attributes are supported using the vector syntax of the **attributeType** domain. Per the SMIL specification, leading and trailing white space, and white space before and after semicolon separators, is allowed and will be ignored. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#ValuesAttribute .. _keyTimes: keyTimes -------- keyTimes = `` A semicolon-separated list of time values used to control the pacing of the animation. Each time in the list corresponds to a value in the **values** attribute list, and defines when the value is used in the animation function. Each time value in the **keyTimes** list is specified as a floating point value between 0 and 1 (inclusive), representing a proportional offset into the simple duration of the animation element. If a list of **keyTimes** is specified, there must be exactly as many values in the **keyTimes** list as in the **values** list. Each successive time value must be greater than or equal to the preceding time value. The **keyTimes** list semantics depends upon the interpolation mode: * For linear and spline animation, the first time value in the list must be 0, and the last time value in the list must be 1. The key time associated with each value defines when the value is set; values are interpolated between the key times. * For discrete animation, the first time value in the list must be 0. The time associated with each value defines when the value is set; the animation function uses that value until the next time defined in **keyTimes**. If the interpolation mode is ``'paced'``, the **keyTimes** attribute is ignored. If there are any errors in the **keyTimes** specification (bad values, too many or too few values), the document fragment is in error. If the simple duration is indefinite, any **keyTimes** specification will be ignored. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#KeyTimesAttribute .. _keySplines: keySplines ---------- keySplines = `` A set of Bézier control points associated with the **keyTimes** list, defining a cubic Bézier function that controls interval pacing. The attribute value is a semicolon-separated list of control point descriptions. Each control point description is a set of four values: x1 y1 x2 y2, describing the Bézier control points for one time segment. Note: SMIL allows these values to be separated either by commas with optional whitespace, or by whitespace alone. The ‘keyTimes’ values that define the associated segment are the Bézier "anchor points", and the ‘keySplines’ values are the control points. Thus, there must be one fewer sets of control points than there are **keyTimes**. The values must all be in the range 0 to 1. This attribute is ignored unless the **calcMode** is set to ``'spline'``. If there are any errors in the **keySplines** specification (bad values, too many or too few values), the document fragment is in error. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#KeySplinesAttribute .. _from: from ---- from = `` Specifies the starting value of the animation. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#FromAttribute .. _to: to ---- to = `` Specifies the ending value of the animation. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#ToAttribute .. _by: by ---- by = `` Specifies a relative offset value for the animation. .. seealso:: http://www.w3.org/TR/SVG11/animate.html#ByAttributesvgwrite-1.4.1/doc/attributes/conditional_processing.rst000066400000000000000000000012511400026116000236000ustar00rootroot00000000000000Conditional Processing Attributes ================================= W3C Reference: http://www.w3.org/TR/SVG11/intro.html#TermConditionalProcessingAttribute A conditional processing attribute is one that controls whether or not the element on which it appears is processed. Most elements, but not all, may have conditional processing attributes specified on them. W3C Direct Links ---------------- * `requiredExtensions `_ * `requiredFeatures `_ * `systemLanguage `_ svgwrite-1.4.1/doc/attributes/core.rst000066400000000000000000000010031400026116000177640ustar00rootroot00000000000000Core Attributes =============== W3C Reference: http://www.w3.org/TR/SVG11/intro.html#TermCoreAttribute The core attributes are those attributes that can be specified on any SVG element. W3C Direct Links ---------------- * `id `_ * `xml:base `_ * `xml:lang `_ * `xml:space `_ svgwrite-1.4.1/doc/attributes/document_event.rst000066400000000000000000000014031400026116000220570ustar00rootroot00000000000000Document Event Attributes ========================= W3C Reference: http://www.w3.org/TR/SVG11/intro.html#TermDocumentEventAttribute A document event attribute is an event attribute that specifies script to run for a particular document-wide event. W3C Direct Links ---------------- * `onabort `_ * `onerror `_ * `onresize `_ * `onscroll `_ * `onunload `_ * `onzoom `_ svgwrite-1.4.1/doc/attributes/graphical_event.rst000066400000000000000000000021421400026116000221740ustar00rootroot00000000000000Graphical Event Attributes ========================== W3C Reference: http://www.w3.org/TR/SVG11/intro.html#TermGraphicalEventAttribute A graphical event attribute is an event attribute that specifies script to run for a particular user interaction event. W3C Direct Links ---------------- * `onactivate `_ * `onclick `_ * `onfocusin `_ * `onfocusout `_ * `onload `_ * `onmousedown `_ * `onmousemove `_ * `onmouseover `_ * `onmouseout `_ * `onmouseup `_ svgwrite-1.4.1/doc/attributes/presentation.rst000066400000000000000000000114711400026116000215610ustar00rootroot00000000000000Presentation Attributes ======================= W3C Reference: http://www.w3.org/TR/SVG11/intro.html#TermPresentationAttribute An XML attribute on an SVG element which specifies a value for a given property for that element. W3C Direct Links ---------------- * `alignment-baseline `_ * `baseline-shift `_ * `clip `_ * `clip-path `_ * `clip-rule `_ * `color `_ * `color-interpolation `_ * `color-interpolation-filters `_ * `color-profile `_ * `color-rendering `_ * `cursor `_ * `direction `_ * `display `_ * `dominant-baseline `_ * `enable-background `_ * `fill `_ * `fill-opacity `_ * `fill-rule `_ * `filter `_ * `flood-color `_ * `flood-opacity `_ * `font-family `_ * `font-size `_ * `font-size-adjust `_ * `font-strech `_ * `font-style `_ * `font-variant `_ * `font-weight `_ * `glyph-orientation-horizontal `_ * `glyph-orientation-vertical `_ * `image-rendering `_ * `kerning `_ * `letter-spacing `_ * `lighting-color `_ * `marker-end `_ * `marker-mid `_ * `marker-start `_ * `mask `_ * `opacity `_ * `overflow `_ * `pointer-events `_ * `shape-rendering `_ * `stop-color `_ * `stop-opacity `_ * `stroke `_ * `stroke-dasharray `_ * `stroke-dashoffset `_ * `stroke-linecap `_ * `stroke-linejoin `_ * `stroke-miterlimit `_ * `stroke-opacity `_ * `stroke-width `_ * `text-anchor `_ * `text-decoration `_ * `text-rendering `_ * `unicode-bidi `_ * `visibility `_ * `word-spacing `_ * `writing-mode `_ svgwrite-1.4.1/doc/attributes/xlink.rst000066400000000000000000000021251400026116000201670ustar00rootroot00000000000000XLink Attributes ================ W3C Reference: http://www.w3.org/TR/SVG11/intro.html#TermXLinkAttributes The XLink attributes are the seven attributes defined in the XML Linking Language specification `XLINK `_ , which are used on various SVG elements that can reference resources. The most import XLink attribute is `xlink:href`, whose definition can be found on each element that allows it. W3C Direct Links ---------------- * `xlink:href `_ * `xlink:type `_ * `xlink:role `_ * `xlink:arcrole `_ * `xlink:title `_ * `xlink:show `_ * `xlink:acutate `_svgwrite-1.4.1/doc/classes/000077500000000000000000000000001400026116000155575ustar00rootroot00000000000000svgwrite-1.4.1/doc/classes/animate.rst000066400000000000000000000263671400026116000177450ustar00rootroot00000000000000animate module ============== Because the Web is a dynamic medium, SVG supports the ability to change vector graphics over time. .. seealso:: http://www.w3.org/TR/SVG11/animate.html Set === .. autoclass:: svgwrite.animate.Set .. seealso:: http://www.w3.org/TR/SVG11/animate.html#SetElement Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.XLink` Methods ------- .. automethod:: svgwrite.animate.Set.__init__ .. method:: Animate.set_href(element) :param element: set target svg element to `element` .. automethod:: svgwrite.animate.Animate.set_target .. automethod:: svgwrite.animate.Animate.set_event .. automethod:: svgwrite.animate.Animate.set_timing .. automethod:: svgwrite.animate.Animate.freeze SVG Animation Attributes ------------------------ * onbegin, onend, onrepeat, onload (:doc:`Animation Event Attributes `) * attributeType, attributeName (:doc:`Animation Target Attributes `) * begin, dur, end, min, max, restart, repeatCount, repeatDur, fill (:doc:`Animation Timing Attributes `) SVG Attributes -------------- * **externalResourcesRequired** -- `bool` *False*: if document rendering can proceed even if external resources are unavailable else: *True* * **to** -- `` Specifies the value for the attribute during the duration of the **set** element. The argument value must match the attribute type. Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`XLink Attributes ` AnimateMotion ============= .. autoclass:: svgwrite.animate.AnimateMotion .. seealso:: http://www.w3.org/TR/SVG11/animate.html#AnimateMotionElement Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.XLink` * :class:`svgwrite.animate.Set` Methods ------- .. automethod:: svgwrite.animate.AnimateMotion.__init__ .. automethod:: svgwrite.animate.AnimateMotion.set_value SVG Animation Attributes ------------------------ * onbegin, onend, onrepeat, onload (:doc:`Animation Event Attributes `) * begin, dur, end, min, max, restart, repeatCount, repeatDur, fill (:doc:`Animation Timing Attributes `) * calcMode, values, keyTimes, keySplines, from, to, by (:doc:`Animation Value Attributes `) * additive, accumulate (:doc:`Animation Addition Attributes `) SVG Attributes -------------- * **externalResourcesRequired** -- `bool` *False*: if document rendering can proceed even if external resources are unavailable else: *True* * **calcMode** -- ``'discrete | linear | paced | spline'`` Specifies the interpolation mode for the animation. * **path** -- `` -- **path** parameter The motion path, expressed in the same format and interpreted the same way as the :ref:`d ` attribute on the **Path** element. The effect of a motion path animation is to add a supplemental transformation matrix onto the CTM for the referenced object which causes a translation along the x- and y-axes of the current user coordinate system by the computed X and Y values computed over time. * **keyPoints** -- `` **keyPoints** takes a semicolon-separated list of floating point values between 0 and 1 and indicates how far along the motion path the object shall move at the moment in time specified by corresponding **keyTimes** value. Distance calculations use the user agent's distance along the path algorithm. Each progress value in the list corresponds to a value in the **keyTimes** attribute list. If a list of **keyPoints** is specified, there must be exactly as many values in the **keyPoints** list as in the **keyTimes** list. If there are any errors in the **keyPoints** specification (bad values, too many or too few values), then the document is in error. * **rotate** -- `` | ``'auto'`` | ``'auto-reverse'`` The **rotate** attribute post-multiplies a supplemental transformation matrix onto the CTM of the target element to apply a rotation transformation about the origin of the current user coordinate system. The rotation transformation is applied after the supplemental translation transformation that is computed due to the **path** attribute. * ``'auto'`` Indicates that the object is rotated over time by the angle of the direction (i.e., directional tangent vector) of the motion path. * ``'auto-reverse'`` Indicates that the object is rotated over time by the angle of the direction (i.e., directional tangent vector) of the motion path plus 180 degrees. * `` Indicates that the target element has a constant rotation transformation applied to it, where the rotation angle is the specified number of degrees. Default value is ``'0'``. * **origin** -- ``'default'`` The **origin** attribute is defined in the `SMIL Animation specification `_ Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`XLink Attributes ` Animate ======= .. autoclass:: svgwrite.animate.Animate .. seealso:: http://www.w3.org/TR/SVG11/animate.html#AnimateElement Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.XLink` * :class:`svgwrite.animate.Set` Methods ------- .. automethod:: svgwrite.animate.Animate.__init__ .. automethod:: svgwrite.animate.Animate.set_value SVG Animation Attributes ------------------------ * onbegin, onend, onrepeat, onload (:doc:`Animation Event Attributes `) * attributeType, attributeName (:doc:`Animation Target Attributes `) * begin, dur, end, min, max, restart, repeatCount, repeatDur, fill (:doc:`Animation Timing Attributes `) * calcMode, values, keyTimes, keySplines, from, to, by (:doc:`Animation Value Attributes `) * additive, accumulate (:doc:`Animation Addition Attributes `) SVG Attributes -------------- * **externalResourcesRequired** -- `bool` *False*: if document rendering can proceed even if external resources are unavailable else: *True* Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`XLink Attributes ` AnimateColor ============ .. autoclass:: svgwrite.animate.AnimateColor .. seealso:: http://www.w3.org/TR/SVG11/animate.html#AnimateColorElement The **from**, **by** and **to** attributes take color values, where each color value is expressed using the following syntax (the same syntax as used in SVG's properties that can take color values): ? The **values** attribute for the **animateColor** element consists of a semicolon-separated list of color values, with each color value expressed in the above syntax. Out of range color values can be provided, but user agent processing will be implementation dependent. User agents should clamp color values to allow color range values as late as possible, but note that system differences might preclude consistent behavior across different systems. The **color-interpolation** property applies to color interpolations that result from **animateColor** animations. Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.XLink` * :class:`svgwrite.animate.Animate` SVG Animation Attributes ------------------------ * onbegin, onend, onrepeat, onload (:doc:`Animation Event Attributes `) * attributeType, attributeName (:doc:`Animation Target Attributes `) * begin, dur, end, min, max, restart, repeatCount, repeatDur, fill (:doc:`Animation Timing Attributes `) * calcMode, values, keyTimes, keySplines, from, to, by (:doc:`Animation Value Attributes `) * additive, accumulate (:doc:`Animation Addition Attributes `) Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`XLink Attributes ` AnimateTransform ================ .. autoclass:: svgwrite.animate.AnimateTransform .. seealso:: http://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.XLink` * :class:`svgwrite.animate.Animate` Methods ------- .. automethod:: svgwrite.animate.AnimateTransform.__init__ SVG Animation Attributes ------------------------ * onbegin, onend, onrepeat, onload (:doc:`Animation Event Attributes `) * attributeType, attributeName (:doc:`Animation Target Attributes `) * begin, dur, end, min, max, restart, repeatCount, repeatDur, fill (:doc:`Animation Timing Attributes `) * calcMode, values, keyTimes, keySplines, from, to, by (:doc:`Animation Value Attributes `) * additive, accumulate (:doc:`Animation Addition Attributes `) SVG Attributes -------------- * **externalResourcesRequired** -- `bool` *False*: if document rendering can proceed even if external resources are unavailable else: *True* * **type** -- ``'translate | scale | rotate | skewX | skewY'`` Indicates the type of transformation which is to have its values change over time. If the attribute is not specified, then the effect is as if a value of **translate** were specified. The **from**, **by** and **to** attributes take a value expressed using the same syntax that is available for the given transformation type: * For a type = ``'translate'``, each individual value is expressed as ` [,]`. * For a type = ``'scale'``, each individual value is expressed as ` [,].` * For a type = ``'rotate'``, each individual value is expressed as ` [ ].` * For a type = ``'skewX'`` and type = ``'skewY'``, each individual value is expressed as `.` Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`XLink Attributes ` SVG Animation Attributes ======================== .. toctree:: :maxdepth: 2 /attributes/animation_events /attributes/animation_target /attributes/animation_timing /attributes/animation_value /attributes/animation_addition svgwrite-1.4.1/doc/classes/base.rst000066400000000000000000000027651400026116000172350ustar00rootroot00000000000000BaseElement =========== .. autoclass:: svgwrite.base.BaseElement .. automethod:: svgwrite.base.BaseElement.__init__ Attributes ---------- .. attribute:: BaseElement.attribs *dict* of SVG attributes .. attribute:: BaseElement.elements *list* of SVG subelements Methods ------- .. automethod:: svgwrite.base.BaseElement.add .. automethod:: svgwrite.base.BaseElement.tostring .. automethod:: svgwrite.base.BaseElement.get_xml .. automethod:: svgwrite.base.BaseElement.get_id .. automethod:: svgwrite.base.BaseElement.get_iri .. automethod:: svgwrite.base.BaseElement.get_funciri .. automethod:: svgwrite.base.BaseElement.update .. automethod:: svgwrite.base.BaseElement.__getitem__ .. automethod:: svgwrite.base.BaseElement.__setitem__ .. automethod:: svgwrite.base.BaseElement.set_desc .. automethod:: svgwrite.base.BaseElement.set_metadata set/get SVG attributes:: element['attribute'] = value value = element['attribute'] attribs = { 'class' = 'css-class', 'stroke' = 'black', } element.update(attribs) Common SVG Attributes --------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Document Event Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` * :doc:`XLink Attributes ` svgwrite-1.4.1/doc/classes/defs.rst000066400000000000000000000020561400026116000172350ustar00rootroot00000000000000Defs ==== .. autoclass:: svgwrite.container.Defs .. seealso:: http://www.w3.org/TR/SVG11/struct.html#DefsElement Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.container.Group` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` 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` interface Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes `svgwrite-1.4.1/doc/classes/drawing.rst000066400000000000000000000123061400026116000177460ustar00rootroot00000000000000Drawing ======= .. automodule:: svgwrite.drawing .. autoclass:: svgwrite.drawing.Drawing .. automethod:: svgwrite.drawing.Drawing.__init__ Attributes ---------- .. attribute:: Drawing.filename `string` should be valid for :func:`open`. .. attribute:: Drawing.defs SVG defs section - as :class:`~svgwrite.container.Defs` object. Methods ------- .. automethod:: svgwrite.drawing.Drawing.add .. automethod:: svgwrite.drawing.Drawing.write .. automethod:: svgwrite.drawing.Drawing.save .. automethod:: svgwrite.drawing.Drawing.saveas .. automethod:: svgwrite.drawing.Drawing.add_stylesheet .. automethod:: svgwrite.drawing.Drawing.get_xml .. method:: Drawing.tostring() Get the XML representation as unicode `string`. If you embed the SVG object into a XHTML page, you have to link to the CSS files (if you use CSS classes) in the header section of the surrounding XHTML page. :return: unicode XML string of this object and all its subelements Factory Methods --------------- .. method:: Drawing.line(start=(0, 0), end=(0, 0), \*\*extra) Create a :class:`svgwrite.shapes.Line` object. .. method:: Drawing.rect(insert=(0, 0), size=(1, 1), rx=None, ry=None, \*\*extra) Create a :class:`svgwrite.shapes.Rect` object. .. method:: Drawing.circle(center=(0, 0), r=1, \*\*extra) Create a :class:`svgwrite.shapes.Circle` object. .. method:: Drawing.ellipse(center=(0, 0), r=(1, 1), \*\*extra) Create a :class:`svgwrite.shapes.Ellipse` object. .. method:: Drawing.polyline(points=[], \*\*extra) Create a :class:`svgwrite.shapes.Polyline` object. .. method:: Drawing.polygon(points=[], \*\*extra) Create a :class:`svgwrite.shapes.Polygon` object. .. method:: Drawing.text(text, insert=None, x=[], y=[], dx=[], dy=[], rotate=[], \*\*extra) Create a :class:`svgwrite.text.Text` object. .. method:: Drawing.tspan(text, insert=None, x=[], y=[], dx=[], dy=[], rotate=[], \*\*extra) Create a :class:`svgwrite.text.TSpan` object. .. method:: Drawing.tref(element, \*\*extra) Create a :class:`svgwrite.text.TRef` object. .. method:: Drawing.textPath(path, text, startOffset=None, method='align', spacing='exact', \*\*extra) Create a :class:`svgwrite.text.TextPath` object. .. method:: Drawing.textArea(text=None, insert=None, size=None, \*\*extra) Create a :class:`svgwrite.text.TextArea` object. .. method:: Drawing.path(d=None, \*\*extra) Create a :class:`svgwrite.path.Path` object. .. method:: Drawing.image(href, insert=None, size=None, \*\*extra) Create a :class:`svgwrite.image.Image` object. .. method:: Drawing.g(\*\*extra) Create a :class:`svgwrite.container.Group` object. .. method:: Drawing.symbol(\*\*extra) Create a :class:`svgwrite.container.Symbol` object. .. method:: Drawing.svg(insert=None, size=None, \*\*extra) Create a :class:`svgwrite.container.SVG` object. .. method:: Drawing.use(href, insert=None, size=None, \*\*extra) Create a :class:`svgwrite.container.Use` object. .. method:: Drawing.a(href, target='_blank', \*\*extra) Create a :class:`svgwrite.container.Hyperlink` object. .. method:: Drawing.marker(insert=None, size=None, orient=None, \*\*extra) Create a :class:`svgwrite.container.Marker` object. .. method:: Drawing.script(href=None, content='', \*\*extra) Create a :class:`svgwrite.container.Script` object. .. method:: Drawing.style(content='', \*\*extra) Create a :class:`svgwrite.container.Style` object. .. method:: Drawing.linearGradient(start=None, end=None, inherit=None, \*\*extra) Create a :class:`svgwrite.gradients.LinearGradient` object. .. method:: Drawing.radialGradient(center=None, r=None, focal=None, inherit=None, \*\*extra) Create a :class:`svgwrite.gradients.RadialGradient` object. .. method:: Drawing.mask(start=None, size=None, \*\*extra) Create a :class:`svgwrite.masking.Mask` object. .. method:: Drawing.clipPath(\*\*extra) Create a :class:`svgwrite.masking.ClipPath` object. .. method:: Drawing.set(element=None, \*\*extra) Create a :class:`svgwrite.animate.Set` object. .. method:: Drawing.animate(element=None, \*\*extra) Create a :class:`svgwrite.animate.Animate` object. .. method:: Drawing.animateColor(element=None, \*\*extra) Create a :class:`svgwrite.animate.AnimateColor` object. .. method:: Drawing.animateMotion(element=None, \*\*extra) Create a :class:`svgwrite.animate.AnimateMotion` object. .. method:: Drawing.animateTransform(transform, element=None, \*\*extra) Create a :class:`svgwrite.animate.AnimateTransform` object. .. method:: Drawing.filter(start=None, size=None, resolution=None, inherit=None, \*\*extra) Create a :class:`svgwrite.filters.Filter` object. (Filter Primitives are created by **factory-methods** of the class **Filter**) Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.container.Symbol` * :class:`svgwrite.container.SVG` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.ViewBox` * :class:`svgwrite.mixins.Presentation` * :class:`svgwrite.mixins.Clipping` * :class:`svgwrite.elementfactory.ElementFactory` svgwrite-1.4.1/doc/classes/fe_blend.rst000066400000000000000000000016071400026116000200530ustar00rootroot00000000000000.. _feBlend: feBlend Filter Element ====================== .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feBlendElement This filter composites two objects together using commonly used imaging software blending modes. It performs a pixel-wise combination of two input images. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **mode** -- ``'normal | multiply | screen | darken | lighten'`` One of the image blending modes. If attribute **mode** is not specified, then the effect is as if a value of ``'normal'`` were specified. see also: http://www.w3.org/TR/SVG11/filters.html#feBlendModeAttribute * **in** -- (see :ref:`in ` attribute) * **in2** -- (see :ref:`in ` attribute) The second input image to the blending operation. This attribute can take on the same values as the **in** attribute. svgwrite-1.4.1/doc/classes/fe_color_matrix.rst000066400000000000000000000016671400026116000214770ustar00rootroot00000000000000.. _feColorMatrix: feColorMatrix Filter Element ============================ .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **type** -- ``'matrix | saturate | hueRotate | luminanceToAlpha'`` Indicates the type of matrix operation. The keyword **matrix** indicates that a full 5x4 matrix of values will be provided. The other keywords represent convenience shortcuts to allow commonly used color operations to be performed without specifying a complete matrix. If attribute **type** is not specified, then the effect is as if a value of matrix were specified. * **values** = `list of s` The contents of **values** depends on the value of attribute **type** see: http://www.w3.org/TR/SVG11/filters.html#feColorMatrixValuesAttribute svgwrite-1.4.1/doc/classes/fe_component_transfer.rst000066400000000000000000000047331400026116000227000ustar00rootroot00000000000000.. _feComponentTransfer: feComponentTransfer Filter Element ================================== .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement This filter primitive performs component-wise remapping of data:: R' = feFuncR( R ) G' = feFuncG( G ) B' = feFuncB( B ) A' = feFuncA( A ) for every pixel. It allows operations like brightness adjustment, contrast adjustment, color balance or thresholding. The calculations are performed on non-premultiplied color values. If the input graphics consists of premultiplied color values, those values are automatically converted into non-premultiplied color values for this operation. (Note that the undoing and redoing of the premultiplication can be avoided if feFuncA is the identity transform and all alpha values on the source graphic are set to 1.) For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) Methods ------- .. method:: feFuncR(type_, \*\*extra) create and add a transfer function for the **red** component of the input graphic .. method:: feFuncG(type_, \*\*extra) create and add a transfer function for the **green** component of the input graphic .. method:: feFuncB(type_, \*\*extra) create and add a transfer function for the **blue** component of the input graphic .. method:: feFuncA(type_, \*\*extra) create and add a transfer function for the **alpha** component of the input graphic Parameters for feFuncX() Methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * **type** -- ``'identity | table | discrete | linear | gamma'`` see: http://www.w3.org/TR/SVG11/filters.html#feComponentTransferTypeAttribute * **tableValues** -- `(list of s)` When **type** = ``'table'``, the list of `s` v0,v1,...vn, separated by white space and/or a comma, which define the lookup table. An empty list results in an identity transfer function. * **slope** -- `` When **type** = ``'linear'``, the slope of the linear function. * **intercept** -- `` When **type** = ``'linear'``, the intercept of the linear function. * **amplitude** -- `` When **type** = ``'gamma'``, the amplitude of the gamma function. * **exponent** -- `` When **type** = ``'gamma'``, the exponent of the gamma function. * **offset** -- `` When **type** = ``'gamma'``, the offset of the gamma function. svgwrite-1.4.1/doc/classes/fe_composite.rst000066400000000000000000000034571400026116000207760ustar00rootroot00000000000000.. _feComposite: feComposite Filter Element ========================== .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feCompositeElement This filter performs the combination of the two input images pixel-wise in image space using one of the Porter-Duff compositing operations: over, in, atop, out, xor. Additionally, a component-wise arithmetic operation (with the result clamped between [0..1]) can be applied. The arithmetic operation is useful for combining the output from the **feDiffuseLighting** and **feSpecularLighting** filters with texture data. It is also useful for implementing dissolve. If the arithmetic operation is chosen, each result pixel is computed using the following formula:: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 For this filter primitive, the extent of the resulting image might grow as described in the section that describes the filter primitive subregion. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **operator** -- ``'over | in | out | atop | xor | arithmetic`` The compositing operation that is to be performed. All of the **operator** types except arithmetic match the correspond operation as described in [PORTERDUFF]. The arithmetic operator is described above. If attribute **operator** is not specified, then the effect is as if a value of ``'over'`` were specified. * **k1**, **k2**, **k3**, **k4** -- `` Only applicable if **operator** = ``'arithmetic'``. If the attribute is not specified, the effect is as if a value of 0 were specified. * **in2** -- (see :ref:`in ` attribute) The second input image to the compositing operation. This attribute can take on the same values as the **in** attribute. svgwrite-1.4.1/doc/classes/fe_convolve_matrix.rst000066400000000000000000000122241400026116000222030ustar00rootroot00000000000000.. _feConvolveMatrix: feConvolveMatrix Filter Element =============================== .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feConvolveMatrixElement **feConvolveMatrix** applies a matrix convolution filter effect. A convolution combines pixels in the input image with neighboring pixels to produce a resulting image. A wide variety of imaging operations can be achieved through convolutions, including blurring, edge detection, sharpening, embossing and beveling. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **order** -- `` Indicates the number of cells in each dimension for **kernelMatrix**. The values provided must be ``s greater than zero. The first number, ``, indicates the number of columns in the matrix. The second number, ``, indicates the number of rows in the matrix. If `` is not provided, it defaults to . If the attribute is not specified, the effect is as if a value of 3 were specified. * **kernelMatrix** -- `` The list of ``s that make up the kernel matrix for the convolution. Values are separated by space characters and/or a comma. The number of entries in the list must equal `` times ``. * **divisor** -- `` After applying the **kernelMatrix** to the input image to yield a number, that number is divided by **divisor** to yield the final destination color value. The default value is the sum of all values in **kernelMatrix**, with the exception that if the sum is zero, then the divisor is set to 1. * **bias** = `` After applying the **kernelMatrix** to the input image to yield a number and applying the **divisor**, the **bias** attribute is added to each component. * **targetX** -- `` Determines the positioning in X of the convolution matrix relative to a given target pixel in the input image. The leftmost column of the matrix is column number zero. The value must be such that: 0 <= targetX < orderX. By default, the convolution matrix is centered in X over each pixel of the input image (i.e., targetX = floor ( orderX / 2 )). * **targetY** -- `` Determines the positioning in Y of the convolution matrix relative to a given target pixel in the input image. The topmost row of the matrix is row number zero. The value must be such that: 0 <= targetY < orderY. By default, the convolution matrix is centered in Y over each pixel of the input image (i.e., targetY = floor ( orderY / 2 )). * **edgeMode** -- ``'duplicate | wrap | none'`` Determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image. * ``'duplicate'`` indicates that the input image is extended along each of its borders as necessary by duplicating the color values at the given edge of the input image. * ``'wrap'`` indicates that the input image is extended by taking the color values from the opposite edge of the image. * ``'none'`` indicates that the input image is extended with pixel values of zero for R, G, B and A. If attribute **edgeMode** is not specified, then the effect is as if a value of ``'duplicate'`` were specified. * **kernelUnitLength** -- `` The first number is the `` value. The second number is the `` value. If the `` value is not specified, it defaults to the same value as ``. Indicates the intended distance in current filter units (i.e., units as determined by the value of attribute **primitiveUnits**) between successive columns and rows, respectively, in the **kernelMatrix**. By specifying value(s) for **kernelUnitLength**, the kernel becomes defined in a scalable, abstract coordinate system. If **kernelUnitLength** is not specified, the default value is one pixel in the offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. For some level of consistency across display media and user agents, it is necessary that a value be provided for at least one of **filterRes** and **kernelUnitLength**. In some implementations, the most consistent results and the fastest performance will be achieved if the pixel grid of the temporary offscreen images aligns with the pixel grid of the kernel. A negative or zero value is an error. * **preserveAlpha** -- ``'false | true'`` A value of false indicates that the convolution will apply to all channels, including the alpha channel. A value of true indicates that the convolution will only apply to the color channels. In this case, the filter will temporarily unpremultiply the color component values, apply the kernel, and then re-premultiply at the end. If **preserveAlpha** is not specified, then the effect is as if a value of ``'false'`` were specified. svgwrite-1.4.1/doc/classes/fe_diffuse_lighting.rst000066400000000000000000000065771400026116000223140ustar00rootroot00000000000000.. _feDiffuseLighting: feDiffuseLighting Filter Element ================================ .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feDiffuseLightingElement This filter primitive lights an image using the alpha channel as a bump map. The resulting image is an RGBA opaque image based on the light color with alpha = 1.0 everywhere. The lighting calculation follows the standard diffuse component of the Phong lighting model. The resulting image depends on the light color, light position and surface geometry of the input bump map. The light map produced by this filter primitive can be combined with a texture image using the multiply term of the arithmetic **feComposite** compositing method. Multiple light sources can be simulated by adding several of these light maps together before applying it to the texture image. For common properties see: :ref:`filter_primitive` Methods ------- .. method:: feDiffuseLighting.feDistantLight(azimuth=0, elevation=0, **extra) create and add a light source: :ref:`feDistantLight` .. method:: feDiffuseLighting.fePointLight(source=(0, 0, 0), **extra) :param source: source 3D point (**x**, **y**, **z**) create and add a light source: :ref:`fePointLight` .. method:: feDiffuseLighting.feSpotLight(source=(0, 0, 0), target=(0, 0, 0), **extra) :param source: source 3D point (**x**, **y**, **z**) :param target: target 3D point (**pointsAtX**, **pointsAtY**, **pointsAtZ**) create and add a light source: :ref:`feSpotLight` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **surfaceScale** -- `` height of surface when Ain = 1. If the attribute is not specified, then the effect is as if a value of 1 were specified. * **diffuseConstant** -- `` kd in Phong lighting model. In SVG, this can be any non-negative number. If the attribute is not specified, then the effect is as if a value of 1 were specified. * **kernelUnitLength** -- `` The first number is the `` value. The second number is the `` value. If the `` value is not specified, it defaults to the same value as ``. Indicates the intended distance in current filter units (i.e., units as determined by the value of attribute **primitiveUnits**) between successive columns and rows, respectively, in the **kernelMatrix**. By specifying value(s) for **kernelUnitLength**, the kernel becomes defined in a scalable, abstract coordinate system. If **kernelUnitLength** is not specified, the default value is one pixel in the offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. For some level of consistency across display media and user agents, it is necessary that a value be provided for at least one of **filterRes** and **kernelUnitLength**. In some implementations, the most consistent results and the fastest performance will be achieved if the pixel grid of the temporary offscreen images aligns with the pixel grid of the kernel. A negative or zero value is an error. * **lighting-color** -- ``'currentColor'`` | `` [``] | ``'inherit'`` The **lighting-color** property defines the color of the light source for filter primitives **feDiffuseLighting** and **feSpecularLighting**. svgwrite-1.4.1/doc/classes/fe_displacement_map.rst000066400000000000000000000047701400026116000223000ustar00rootroot00000000000000.. _feDisplacementMap: feDisplacementMap Filter Element ================================ .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feDisplacementMapElement This filter primitive uses the pixels values from the image from **in2** to spatially displace the image from **in**. This filter can have arbitrary non-localized effect on the input which might require substantial buffering in the processing pipeline. However with this formulation, any intermediate buffering needs can be determined by scale which represents the maximum range of displacement in either x or y. When applying this filter, the source pixel location will often lie between several source pixels. In this case it is recommended that high quality viewers apply an interpolent on the surrounding pixels, for example bilinear or bicubic, rather than simply selecting the nearest source pixel. Depending on the speed of the available interpolents, this choice may be affected by the **image-rendering** property setting. The **color-interpolation-filters** property only applies to the **in2** source image and does not apply to the **in** source image. The ‘in’ source image must remain in its current color space. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **in2** -- (see :ref:`in ` attribute) The second input image, which is used to displace the pixels in the image from attribute **in**. This attribute can take on the same values as the **in** attribute. * **scale** -- `` Displacement scale factor. The amount is expressed in the coordinate system established by attribute **primitiveUnits** on the **filter** element. When the value of this attribute is ``'0'``, this operation has no effect on the source image. If the attribute is not specified, then the effect is as if a value of ``'0'`` were specified. * **xChannelSelector** -- ``'R | G | B | A'`` Indicates which channel from **in2** to use to displace the pixels in **in** along the x-axis. If attribute **xChannelSelector** is not specified, then the effect is as if a value of ``'A'`` were specified. * **yChannelSelector** -- ``'R | G | B | A'`` Indicates which channel from **in2** to use to displace the pixels in **in** along the y-axis. If attribute **yChannelSelector** is not specified, then the effect is as if a value of ``'A'`` were specified. svgwrite-1.4.1/doc/classes/fe_flood.rst000066400000000000000000000013361400026116000200710ustar00rootroot00000000000000.. _feFlood: feFlood Filter Element ====================== .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feFloodElement This filter primitive creates a rectangle filled with the color and opacity values from properties **flood-color** and **flood-opacity**. The rectangle is as large as the filter primitive subregion established by the **x**, **y**, **width** and **height** attributes on the **feFlood** element. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **flood-color** -- ``'currentColor'`` | `` [``] | ``' inherit'`` initial value is ``'black'`` * **flood-opacity** -- `` | ``'inherit'`` initial value is ``'1'``svgwrite-1.4.1/doc/classes/fe_gaussian_blur.rst000066400000000000000000000027051400026116000216250ustar00rootroot00000000000000.. _feGaussianBlur: feGaussianBlur Filter Element ============================= .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement This filter primitive performs a Gaussian blur on the input image. Frequently this operation will take place on alpha-only images, such as that produced by the built-in input, ``'SourceAlpha'``. The implementation may notice this and optimize the single channel case. If the input has infinite extent and is constant, this operation has no effect. If the input has infinite extent and is a tile, the filter is evaluated with periodic boundary conditions. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **stdDeviation** -- `` The standard deviation for the blur operation. If two `s` are provided, the first number represents a standard deviation value along the x-axis of the coordinate system established by attribute **primitiveUnits** on the **filter** element. The second value represents a standard deviation in Y. If one number is provided, then that value is used for both X and Y. A negative value is an error. A value of zero disables the effect of the given filter primitive (i.e., the result is the filter input image). If the attribute is not specified, then the effect is as if a value of ``'0'`` were specified.svgwrite-1.4.1/doc/classes/fe_image.rst000066400000000000000000000034251400026116000200510ustar00rootroot00000000000000.. _feImage: feImage Filter Element ====================== .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feImageElement This filter primitive refers to a graphic external to this filter element, which is loaded or rendered into an RGBA raster and becomes the result of the filter primitive. This filter primitive can refer to an external image or can be a reference to another piece of SVG. It produces an image similar to the built-in image source ``'SourceGraphic'`` except that the graphic comes from an external source. If the **xlink:href** references a stand-alone image resource such as a JPEG, PNG or SVG file, then the image resource is rendered according to the behavior of the **image** element; otherwise, the referenced resource is rendered according to the behavior of the **use** element. In either case, the current user coordinate system depends on the value of attribute **primitiveUnits** on the **filter** element. The processing of the **preserveAspectRatio** attribute on the **feImage** element is identical to that of the **image** element. When the referenced image must be resampled to match the device coordinate system, it is recommended that high quality viewers make use of appropriate interpolation techniques, for example bilinear or bicubic. Depending on the speed of the available interpolents, this choice may be affected by the **image-rendering** property setting. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **xlink:href** -- `` A IRI reference to the image source. * **preserveAspectRatio** -- ``'[defer] []'`` If attribute **preserveAspectRatio** is not specified, then the effect is as if a value of ``'xMidYMid'`` meet were specified.svgwrite-1.4.1/doc/classes/fe_lights.rst000066400000000000000000000106111400026116000202540ustar00rootroot00000000000000.. _feDistantLight: feDistantLight Filter Element ============================= The light source **feDistantLight** is a child element of the filter primitives :ref:`feDiffuseLighting ` or :ref:`feSpecularLighting `, create and add this object with the method :meth:`feDistantLight` of the filter primitives **feDiffuseLighting** or **feSpecularLighting**. .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feDistantLightElement SVG Attributes -------------- * **azimuth** -- `` Direction angle for the light source on the XY plane (clockwise), in degrees. Default is ``'0'`` * **elevation** -- `` Direction angle for the light source on the YZ plane, in degrees. Default is ``'0'`` .. _fePointLight: fePointLight Filter Element =========================== The light source **fePointLight** is a child element of the filter primitives :ref:`feDiffuseLighting ` or :ref:`feSpecularLighting `, create and add this object with the method :meth:`fePointLight` of the filter primitives **feDiffuseLighting** or **feSpecularLighting**. The light source **feDistantLight** is a child element of the filter primitives **feDiffuseLighting** or **feSpecularLighting**. .. seealso:: http://www.w3.org/TR/SVG11/filters.html#fePointLightElement SVG Attributes -------------- * **x** -- `` -- **source** parameter X location for the light source in the coordinate system established by attribute **primitiveUnits** on the **filter** element. Default is ``'0'`` * **y** -- `` -- **source** parameter Y location for the light source in the coordinate system established by attribute **primitiveUnits** on the **filter** element. Default is ``'0'`` * **z** -- ``-- **source** parameter Z location for the light source in the coordinate system established by attribute **primitiveUnits** on the ‘filter’ element, assuming that, in the initial coordinate system, the positive Z-axis comes out towards the person viewing the content and assuming that one unit along the Z-axis equals one unit in X and Y. Default is ``'0'`` .. _feSpotLight: feSpotLight Filter Element ========================== The light source **feSpotLight** is a child element of the filter primitives :ref:`feDiffuseLighting ` or :ref:`feSpecularLighting `, create and add this object with the method :meth:`feSpotLight` of the filter primitives **feDiffuseLighting** or **feSpecularLighting**. .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feSpotLightElement SVG Attributes -------------- * **x**, **y**, **z** -- see :ref:`fePointLight` * **pointsAtX** -- `` -- **target** parameter X location in the coordinate system established by attribute **primitiveUnits** on the **filter** element of the point at which the light source is pointing. Default is ``'0'`` * **pointsAtY** -- `` -- **target** parameter Y location in the coordinate system established by attribute **primitiveUnits** on the **filter** element of the point at which the light source is pointing. Default is ``'0'`` * **pointsAtZ** -- `` -- **target** parameter Z location in the coordinate system established by attribute **primitiveUnits** on the **filter** element of the point at which the light source is pointing, assuming that, in the initial coordinate system, the positive Z-axis comes out towards the person viewing the content and assuming that one unit along the Z-axis equals one unit in X and Y. Default is ``'0'`` * **specularExponent** -- `` Exponent value controlling the focus for the light source. Default is ``'1'`` * **limitingConeAngle** -- `` A limiting cone which restricts the region where the light is projected. No light is projected outside the cone. **limitingConeAngle** represents the angle in degrees between the spot light axis (i.e. the axis between the light source and the point to which it is pointing at) and the spot light cone. User agents should apply a smoothing technique such as anti-aliasing at the boundary of the cone. If no value is specified, then no limiting cone will be applied. svgwrite-1.4.1/doc/classes/fe_merge.rst000066400000000000000000000041531400026116000200650ustar00rootroot00000000000000.. _feMerge: feMerge Filter Element ====================== .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feMergeElement This filter primitive composites input image layers on top of each other using the over operator with `Input1` (corresponding to the first **feMergeNode** child element) on the bottom and the last specified input, `InputN` (corresponding to the last **feMergeNode** child element), on top. Many effects produce a number of intermediate layers in order to create the final output image. This filter allows us to collapse those into a single image. Although this could be done by using n-1 Composite-filters, it is more convenient to have this common operation available in this form, and offers the implementation some additional flexibility. Each **feMerge** element can have any number of **feMergeNode** subelements, each of which has an **in** attribute. The canonical implementation of feMerge is to render the entire effect into one RGBA layer, and then render the resulting layer on the output device. In certain cases (in particular if the output device itself is a continuous tone device), and since merging is associative, it might be a sufficient approximation to evaluate the effect one layer at a time and render each layer individually onto the output device bottom to top. If the topmost image input is ``'SourceGraphic'`` and this **feMerge** is the last filter primitive in the filter, the implementation is encouraged to render the layers up to that point, and then render the SourceGraphic directly from its vector description on top. For common properties see: :ref:`filter_primitive` .. method:: Filter.feMerge(layernames, **extra) :noindex: :param list layernames: layernames as `strings` Create a **feMerge** filter, containing several **feMergeNode** subelements, with the input sources specified by **layernames**. Methods ------- .. method:: feMerge.feMergeNode(layernames) :param list layernames: layernames as `strings` Add several **feMergeNode** subelements, with the input sources specified by **layernames**. svgwrite-1.4.1/doc/classes/fe_morphology.rst000066400000000000000000000044241400026116000211660ustar00rootroot00000000000000.. _feMorphology: feMorphology Filter Element ============================= .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feMorphologyElement This filter primitive performs "fattening" or "thinning" of artwork. It is particularly useful for fattening or thinning an alpha channel. The dilation (or erosion) kernel is a rectangle with a width of 2*x-radius and a height of 2*y-radius. In dilation, the output pixel is the individual component-wise maximum of the corresponding R,G,B,A values in the input image's kernel rectangle. In erosion, the output pixel is the individual component-wise minimum of the corresponding R,G,B,A values in the input image's kernel rectangle. Frequently this operation will take place on alpha-only images, such as that produced by the built-in input, ``'SourceAlpha'``. In that case, the implementation might want to optimize the single channel case. If the input has infinite extent and is constant, this operation has no effect. If the input has infinite extent and is a tile, the filter is evaluated with periodic boundary conditions. Because **feMorphology** operates on premultipied color values, it will always result in color values less than or equal to the alpha channel. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **operator** -- ``'erode | dilate'`` A keyword indicating whether to erode (i.e., thin) or dilate (fatten) the source graphic. If attribute **operator** is not specified, then the effect is as if a value of ``'erode'`` were specified. * **radius** -- `` The radius (or radii) for the operation. If two `s` are provided, the first number represents a x-radius and the second value represents a y-radius. If one number is provided, then that value is used for both X and Y. The values are in the coordinate system established by attribute **primitiveUnits** on the **filter** element. A negative value is an error. A value of zero disables the effect of the given filter primitive (i.e., the result is a transparent black image). If the attribute is not specified, then the effect is as if a value of ``'0'`` were specified. svgwrite-1.4.1/doc/classes/fe_offset.rst000066400000000000000000000031521400026116000202520ustar00rootroot00000000000000.. _feOffset: feOffset Filter Element ======================= .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feOffsetElement This filter primitive offsets the input image relative to its current position in the image space by the specified vector. This is important for effects like drop shadows. When applying this filter, the destination location may be offset by a fraction of a pixel in device space. In this case a high quality viewer should make use of appropriate interpolation techniques, for example bilinear or bicubic. This is especially recommended for dynamic viewers where this interpolation provides visually smoother movement of images. For static viewers this is less of a concern. Close attention should be made to the **image-rendering** property setting to determine the authors intent. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **dx** -- `` The amount to offset the input graphic along the x-axis. The offset amount is expressed in the coordinate system established by attribute **primitiveUnits** on the **filter** element. If the attribute is not specified, then the effect is as if a value of ``'0'`` were specified. * **dy** -- `` The amount to offset the input graphic along the y-axis. The offset amount is expressed in the coordinate system established by attribute **primitiveUnits** on the **filter** element. If the attribute is not specified, then the effect is as if a value of ``'0'`` were specified.svgwrite-1.4.1/doc/classes/fe_specular_lighting.rst000066400000000000000000000106401400026116000224670ustar00rootroot00000000000000.. _feSpecularLighting: feSpecularLighting Filter Element ================================= .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feSpecularLightingElement This filter primitive lights a source graphic using the alpha channel as a bump map. The resulting image is an RGBA image based on the light color. The lighting calculation follows the standard specular component of the Phong lighting model. The resulting image depends on the light color, light position and surface geometry of the input bump map. The result of the lighting calculation is added. The filter primitive assumes that the viewer is at infinity in the z direction (i.e., the unit vector in the eye direction is (0,0,1) everywhere). This filter primitive produces an image which contains the specular reflection part of the lighting calculation. Such a map is intended to be combined with a texture using the add term of the arithmetic **feComposite** method. Multiple light sources can be simulated by adding several of these light maps before applying it to the texture image. Unlike the **feDiffuseLighting**, the **feSpecularLighting** filter produces a non-opaque image. This is due to the fact that the specular result is meant to be added to the textured image. The alpha channel of the result is the max of the color components, so that where the specular light is zero, no additional coverage is added to the image and a fully white highlight will add opacity. The **feDiffuseLighting** and **feSpecularLighting** filters will often be applied together. An implementation may detect this and calculate both maps in one pass, instead of two. For common properties see: :ref:`filter_primitive` Methods ------- .. method:: feSpecularLighting.feDistantLight(azimuth=0, elevation=0, **extra) create and add a light source: :ref:`feDistantLight` .. method:: feSpecularLighting.fePointLight(source=(0, 0, 0), **extra) :param source: source 3D point (**x**, **y**, **z**) create and add a light source: :ref:`fePointLight` .. method:: feSpecularLighting.feSpotLight(source=(0, 0, 0), target=(0, 0, 0), **extra) :param source: source 3D point (**x**, **y**, **z**) :param target: target 3D point (**pointsAtX**, **pointsAtY**, **pointsAtZ**) create and add a light source: :ref:`feSpotLight` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **surfaceScale** -- `` height of surface when Ain = 1. If the attribute is not specified, then the effect is as if a value of ``'1'`` were specified. * **specularConstant** -- `` ks in Phong lighting model. In SVG, this can be any non-negative number. If the attribute is not specified, then the effect is as if a value of ``'1'`` were specified. * **specularExponent** -- `` Exponent for specular term, larger is more "shiny". Range 1.0 to 128.0. If the attribute is not specified, then the effect is as if a value of ``'1'`` were specified. * **kernelUnitLength** -- `` The first number is the `` value. The second number is the `` value. If the `` value is not specified, it defaults to the same value as ``. Indicates the intended distance in current filter units (i.e., units as determined by the value of attribute **primitiveUnits**) between successive columns and rows, respectively, in the **kernelMatrix**. By specifying value(s) for **kernelUnitLength**, the kernel becomes defined in a scalable, abstract coordinate system. If **kernelUnitLength** is not specified, the default value is one pixel in the offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. For some level of consistency across display media and user agents, it is necessary that a value be provided for at least one of **filterRes** and **kernelUnitLength**. In some implementations, the most consistent results and the fastest performance will be achieved if the pixel grid of the temporary offscreen images aligns with the pixel grid of the kernel. A negative or zero value is an error. * **lighting-color** -- ``'currentColor'`` | `` [``] | ``'inherit'`` The **lighting-color** property defines the color of the light source for filter primitives **feDiffuseLighting** and **feSpecularLighting**. svgwrite-1.4.1/doc/classes/fe_tile.rst000066400000000000000000000031651400026116000177250ustar00rootroot00000000000000.. _feTile: feTile Filter Element ======================= .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feTileElement This filter primitive fills a target rectangle with a repeated, tiled pattern of an input image. The target rectangle is as large as the filter primitive subregion established by the **x**, **y**, **width** and **height** attributes on the **feTile** element. Typically, the input image has been defined with its own filter primitive subregion in order to define a reference tile. **feTile** replicates the reference tile in both X and Y to completely fill the target rectangle. The top/left corner of each given tile is at location (x+i*width,y+j*height), where (x,y) represents the top/left of the input image's filter primitive subregion, width and height represent the width and height of the input image's filter primitive subregion, and i and j can be any integer value. In most cases, the input image will have a smaller filter primitive subregion than the **feTile** in order to achieve a repeated pattern effect. Implementers must take appropriate measures in constructing the tiled image to avoid artifacts between tiles, particularly in situations where the user to device transform includes shear and/or rotation. Unless care is taken, interpolation can lead to edge pixels in the tile having opacity values lower or higher than expected due to the interaction of painting adjacent tiles which each have partial overlap with particular pixels. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) svgwrite-1.4.1/doc/classes/fe_turbulence.rst000066400000000000000000000065621400026116000211440ustar00rootroot00000000000000.. _feTurbulence: feTurbulence Filter Element =========================== .. seealso:: http://www.w3.org/TR/SVG11/filters.html#feTurbulenceElement This filter primitive creates an image using the Perlin turbulence function. It allows the synthesis of artificial textures like clouds or marble. For a detailed description the of the Perlin turbulence function, see "Texturing and Modeling", Ebert et al, AP Professional, 1994. The resulting image will fill the entire filter primitive subregion for this filter primitive. For common properties see: :ref:`filter_primitive` SVG Attributes -------------- * **in** -- (see :ref:`in ` attribute) * **baseFrequency** -- `` The base frequency (frequencies) parameter(s) for the noise function. If two `s` are provided, the first number represents a base frequency in the X direction and the second value represents a base frequency in the Y direction. If one number is provided, then that value is used for both X and Y. A negative value for base frequency is an error. If the attribute is not specified, then the effect is as if a value of ``'0'`` were specified. * **numOctaves** -- `` The numOctaves parameter for the noise function. If the attribute is not specified, then the effect is as if a value of ``'1'`` were specified. * **seed** -- `` The starting number for the pseudo random number generator. If the attribute is not specified, then the effect is as if a value of ``'0'`` were specified. When the seed number is handed over to the algorithm above it must first be truncated, i.e. rounded to the closest integer value towards zero. * **stitchTiles** -- ``'stitch | noStitch'`` * ``'noStitch'`` -- no attempt it made to achieve smooth transitions at the border of tiles which contain a turbulence function. Sometimes the result will show clear discontinuities at the tile borders. * ``'stitch'`` -- then the user agent will automatically adjust baseFrequency-x and baseFrequency-y values such that the **feTurbulence** node's width and height (i.e., the width and height of the current subregion) contains an integral number of the Perlin tile width and height for the first octave. The baseFrequency will be adjusted up or down depending on which way has the smallest relative (not absolute) change as follows: Given the frequency, calculate lowFreq=floor(width*frequency)/width and hiFreq=ceil(width*frequency)/width. If frequency/lowFreq < hiFreq/frequency then use lowFreq, else use hiFreq. While generating turbulence values, generate lattice vectors as normal for Perlin Noise, except for those lattice points that lie on the right or bottom edges of the active area (the size of the resulting tile). In those cases, copy the lattice vector from the opposite edge of the active area. If attribute **stitchTiles** is not specified, then the effect is as if a value of ``'noStitch'`` were specified. * **type** -- ``'fractalNoise | turbulence'`` Indicates whether the filter primitive should perform a noise or turbulence function. If attribute **type** is not specified, then the effect is as if a value of ``'turbulence'`` were specified. svgwrite-1.4.1/doc/classes/filter_primitive.rst000066400000000000000000000141251400026116000216710ustar00rootroot00000000000000.. _filter_primitive: Filter Primitives Overview ========================== .. seealso:: http://www.w3.org/TR/SVG11/filters.html#FilterPrimitivesOverview Unless otherwise stated, all image filters operate on premultiplied RGBA samples. Filters which work more naturally on non-premultiplied data (feColorMatrix and feComponentTransfer) will temporarily undo and redo premultiplication as specified. All raster effect filtering operations take 1 to N input RGBA images, additional attributes as parameters, and produce a single output RGBA image. The RGBA result from each filter primitive will be clamped into the allowable ranges for colors and opacity values. Thus, for example, the result from a given filter primitive will have any negative color values or opacity values adjusted up to color/opacity of zero. The color space in which a particular filter primitive performs its operations is determined by the value of property **color-interpolation-filters** on the given filter primitive. A different property, **color-interpolation** determines the color space for other color operations. Because these two properties have different initial values (**color-interpolation-filters** has an initial value of linearRGB whereas **color-interpolation** has an initial value of sRGB), in some cases to achieve certain results (e.g., when coordinating gradient interpolation with a filtering operation) it will be necessary to explicitly set **color-interpolation** to linearRGB or **color-interpolation-filters** to sRGB on particular elements. Note that the examples below do not explicitly set either **color-interpolation** or **color-interpolation-filters**, so the initial values for these properties apply to the examples. Common SVG Attributes for Filter Primitives =========================================== With the exception of the **in** attribute, all of the following attributes are available on all filter primitive elements: * **x** -- `` The minimum x coordinate for the subregion which restricts calculation and rendering of the given filter primitive. See filter primitive subregion. * **y** -- `` The minimum y coordinate for the subregion which restricts calculation and rendering of the given filter primitive. See filter primitive subregion. * **width** -- `` The width of the subregion which restricts calculation and rendering of the given filter primitive. See filter primitive subregion. * **height** -- `` The height of the subregion which restricts calculation and rendering of the given filter primitive. See filter primitive subregion. * **result** -- `` Assigned name for this filter primitive. If supplied, then graphics that result from processing this filter primitive can be referenced by an **in** attribute on a subsequent filter primitive within the same **filter** element. If no value is provided, the output will only be available for re-use as the implicit input into the next filter primitive if that filter primitive provides no value for its **in** attribute. .. _in_attr: * **in** -- ``'SourceGraphic | SourceAlpha | BackgroundImage | BackgroundAlpha | FillPaint | StrokePaint'`` | `` Identifies input for the given filter primitive. The value can be either one of six keywords or can be a string which matches a previous **result** attribute value within the same **filter** element. If no value is provided and this is the first filter primitive, then this filter primitive will use ``'SourceGraphic'`` as its input. If no value is provided and this is a subsequent filter primitive, then this filter primitive will use the result from the previous filter primitive as its input. * **SourceGraphic** This keyword represents the graphics elements that were the original input into the **filter** element. For raster effects filter primitives, the graphics elements will be rasterized into an initially clear RGBA raster in image space. Pixels left untouched by the original graphic will be left clear. The image is specified to be rendered in linear RGBA pixels. The alpha channel of this image captures any anti-aliasing specified by SVG. (Since the raster is linear, the alpha channel of this image will represent the exact percent coverage of each pixel.) * **SourceAlpha** This keyword represents the graphics elements that were the original input into the **filter** element. SourceAlpha has all of the same rules as SourceGraphic except that only the alpha channel is used. The input image is an RGBA image consisting of implicitly black color values for the RGB channels, but whose alpha channel is the same as SourceGraphic. If this option is used, then some implementations might need to rasterize the graphics elements in order to extract the alpha channel. * **BackgroundImage** This keyword represents an image snapshot of the canvas under the filter region at the time that the **filter** element was invoked. See Accessing the background image. * **BackgroundAlpha** Same as BackgroundImage except only the alpha channel is used. See SourceAlpha and Accessing the background image. * **FillPaint** This keyword represents the value of the **fill** property on the target element for the filter effect. The FillPaint image has conceptually infinite extent. Frequently this image is opaque everywhere, but it might not be if the `"paint"` itself has alpha, as in the case of a gradient or pattern which itself includes transparent or semi-transparent parts. * **StrokePaint** This keyword represents the value of the **stroke** property on the target element for the filter effect. The StrokePaint image has conceptually infinite extent. Frequently this image is opaque everywhere, but it might not be if the `"paint"` itself has alpha, as in the case of a gradient or pattern which itself includes transparent or semi-transparent parts. svgwrite-1.4.1/doc/classes/filters.rst000066400000000000000000000163461400026116000177730ustar00rootroot00000000000000Introduction ============ This chapter describes SVG's declarative filter effects feature set, which when combined with the 2D power of SVG can describe much of the common artwork on the Web in such a way that client-side generation and alteration can be performed easily. In addition, the ability to apply filter effects to SVG graphics elements and container elements helps to maintain the semantic structure of the document, instead of resorting to images which aside from generally being a fixed resolution tend to obscure the original semantics of the elements they replace. This is especially true for effects applied to text. Filter effects are defined by **filter** elements. To apply a filter effect to a **graphics element** or a **container element**, you set the value of the **filter** property on the given element such that it references the filter effect. .. seealso:: http://www.w3.org/TR/SVG11/filters.html#Introduction Filter Element ============== .. autoclass:: svgwrite.filters.Filter .. seealso:: http://www.w3.org/TR/SVG11/filters.html#FilterElement Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.XLink` * :class:`svgwrite.mixins.Presentation` Methods ------- .. automethod:: svgwrite.filters.Filter.__init__ .. method:: Filter.feBlend(in_, start=None, size=None, \*\*extra) create and add a :ref:`feBlend` .. method:: Filter.feColorMatrix(in_, start=None, size=None, \*\*extra) create and add a :ref:`feColorMatrix` .. method:: Filter.feComponentTransfer(in_, start=None, size=None, \*\*extra) create and add a :ref:`feComponentTransfer` .. method:: Filter.feComposite(in_, start=None, size=None, \*\*extra) create and add a :ref:`feComposite` .. method:: Filter.feConvolveMatrix(in_, start=None, size=None, \*\*extra) create and add a :ref:`feConvolveMatrix` .. method:: Filter.feDiffuseLighting(in_, start=None, size=None, \*\*extra) create and add a :ref:`feDiffuseLighting` .. method:: Filter.feDisplacementMap(in_, start=None, size=None, \*\*extra) create and add a :ref:`feDisplacementMap` .. method:: Filter.feFlood(start=None, size=None, \*\*extra) create and add a :ref:`feFlood` .. method:: Filter.feGaussianBlur(in_, start=None, size=None, \*\*extra) create and add a :ref:`feGaussianBlur` .. method:: Filter.feImage(href, start=None, size=None, \*\*extra) create and add a :ref:`feImage` .. method:: Filter.feMerge(start=None, size=None, \*\*extra) create and add a :ref:`feMerge` .. method:: Filter.feMorphology(in_, start=None, size=None, \*\*extra) create and add a :ref:`feMorphology` .. method:: Filter.feOffset(in_, start=None, size=None, \*\*extra) create and add a :ref:`feOffset` .. method:: Filter.feSpecularLighting(in_, start=None, size=None, \*\*extra) create and add a :ref:`feSpecularLighting` .. method:: Filter.feTile(in_, start=None, size=None, \*\*extra) create and add a :ref:`feTile` .. method:: Filter.feTurbulence(start=None, size=None, \*\*extra) create and add a :ref:`feTurbulence` SVG Attributes -------------- * **filterUnits** -- ``'userSpaceOnUse | objectBoundingBox'`` See `Filter effects region. `_ * **primitiveUnits** -- ``'userSpaceOnUse | objectBoundingBox'`` Specifies the coordinate system for the various length values within the filter primitives and for the attributes that define the filter primitive subregion. If **primitiveUnits** = ``'userSpaceOnUse'``, any length values within the filter definitions represent values in the current user coordinate system in place at the time when the **filter** element is referenced (i.e., the user coordinate system for the element referencing the **filter** element via a **filter** property). If **primitiveUnits** = ``'objectBoundingBox'``, then any length values within the filter definitions represent fractions or percentages of the bounding box on the referencing element (see Object bounding box units). Note that if only one number was specified in a `` value this number is expanded out before the **primitiveUnits** computation takes place. If attribute **primitiveUnits** is not specified, then the effect is as if a value of ``'userSpaceOnUse'`` were specified. * **x** -- `` -- **start** parameter See `Filter effects region. `_ * **y** -- `` -- **start** parameter See `Filter effects region. `_ * **width** -- `` -- **size** parameter See `Filter effects region. `_ * **height** -- `` -- **size** parameter See `Filter effects region. `_ * **filterRes** -- `` -- **resolution** parameter See `Filter effects region. `_ * **xlink:href** -- `` -- **inherit** parameter A IRI reference to another **filter** element within the current SVG document fragment. Any attributes which are defined on the referenced **filter** element which are not defined on this element are inherited by this element. Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Presentation Attributes ` * :doc:`XLink Attributes ` Example ------- Source: https://secure.wikimedia.org/wikibooks/de/wiki/SVG/_Effekte#Urfilter_fePointLight.2C_Punktlichtquelle .. literalinclude:: ../../examples/fePointLight.py :lines: 8- and the XML result (with manual reformatting): .. code-block:: xml svgwrite-1.4.1/doc/classes/gradients.rst000066400000000000000000000151101400026116000202670ustar00rootroot00000000000000LinearGradient ============== .. automodule:: svgwrite.gradients .. seealso:: * http://www.w3.org/TR/SVG11/pservers.html#Gradients * http://www.w3.org/TR/SVG11/pservers.html#LinearGradients .. autoclass:: svgwrite.gradients.LinearGradient Methods ------- .. automethod:: svgwrite.gradients.LinearGradient.__init__ .. automethod:: svgwrite.gradients.LinearGradient.add_stop_color .. automethod:: svgwrite.gradients.LinearGradient.get_paint_server 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* * **gradientUnits** -- ``'userSpaceOnUse | objectBoundingBox'`` Defines the coordinate system for attributes **x1**, **y1**, **x2** and **y2**. .. seealso:: http://www.w3.org/TR/SVG11/pservers.html#LinearGradientElementGradientUnitsAttribute * **gradientTransform** -- `` Use the :class:`-svgwrite.mixins.Transform` interface to set transformations. Contains the definition of an optional additional transformation from the gradient coordinate system onto the target coordinate system (i.e., userSpaceOnUse or objectBoundingBox). This allows for things such as skewing the gradient. This additional transformation matrix is post-multiplied to (i.e., inserted to the right of) any previously defined transformations, including the implicit transformation necessary to convert from object bounding box units to user space. * **x1** -- `` -- **start** parameter **x1**, **y1**, **x2** and **y2** define a gradient vector for the linear gradient. This gradient vector provides starting and ending points onto which the gradient stops are mapped. The values of **x1**, **y1**, **x2** and **y2** can be either numbers or percentages. default is ``'0%'`` * **y1** -- `` -- **start** parameter See **x1**. Default is ``'0%'`` * **x2** -- `` -- **end** parameter See **x1**. Default is ``'100%'`` * **y2** -- `` -- **end** parameter See **x1**. Default is ``'0%'`` * **spreadMethod** -- ``'pad | reflect | repeat'`` Indicates what happens if the gradient starts or ends inside the bounds of the target rectangle. Possible values are: ``'pad'``, which says to use the terminal colors of the gradient to fill the remainder of the target region, ``'reflect'``, which says to reflect the gradient pattern start-to-end, end-to-start, start-to-end, etc. continuously until the target rectangle is filled, and ``'repeat'``, which says to repeat the gradient pattern start-to-end, start-to-end, start-to-end, etc. continuously until the target region is filled. default is ``'pad'`` * **xlink:href** -- `` -- **inherit** parameter A URI reference to a different :class:`LinearGradient` or :class:`RadialGradient` element within the current SVG document fragment. Any :class:`LinearGradient` attributes which are defined on the referenced element which are not defined on this element are inherited by this element. If this element has no defined gradient stops, and the referenced element does (possibly due to its own **xlink:href** attribute), then this element inherits the gradient stop from the referenced element. Inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attribute or gradient stops due to its own **xlink:href** attribute, then the current element can inherit those attributes or gradient stops. RadialGradient ============== .. seealso:: http://www.w3.org/TR/SVG11/pservers.html#RadialGradients .. autoclass:: svgwrite.gradients.RadialGradient Methods ------- .. automethod:: svgwrite.gradients.RadialGradient.__init__ .. automethod:: svgwrite.gradients.RadialGradient.add_stop_color .. automethod:: svgwrite.gradients.RadialGradient.get_paint_server 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* * **gradientUnits** -- ``'userSpaceOnUse | objectBoundingBox'`` Defines the coordinate system for attributes **cx**, **cy**, **r**, **fx** and **fy**. .. seealso:: http://www.w3.org/TR/SVG11/pservers.html#RadialGradientElementGradientUnitsAttribute * **cx** -- `` -- **center** parameter **cx**, **cy** and **r** define the largest (i.e., outermost) circle for the radial gradient. The gradient will be drawn such that the 100% gradient stop is mapped to the perimeter of this largest (i.e., outermost) circle. default is ``'50%'`` * **cy** -- `` -- **center** parameter See **cx**. Default is ``'50%'``. * **r** -- `` -- **r** parameter See **cx**. A value of zero will cause the area to be painted as a single color using the color and opacity of the last gradient stop. Default is ``'50%'``. * **fx** -- `` -- **focal** parameter **fx** and **fy** define the focal point for the radial gradient. The gradient will be drawn such that the 0% gradient stop is mapped to (fx, fy). If attribute **fx** is not specified, **fx** will coincide with the presentational value of **cx** for the element whether the value for **cx** was inherited or not. If the element references an element that specifies a value for **fx**, then the value of 'fx' is inherited from the referenced element. * **fy** -- `` -- **focal** parameter See **fx**. If attribute **fy** is not specified, **fy** will coincide with the presentational vlaue of **cy** for the element whether the value for **cy** was inherited or not. If the element references an element that specifies a value for **fy**, then the value of **fy** is inherited from the referenced element. * **gradientTransform** -- `` Use the :class:`-svgwrite.mixins.Transform` interface to set transformations. See :class:`LinearGradient` * **spreadMethod** -- ``'pad | reflect | repeat'`` See :class:`LinearGradient` * **xlink:href** -- `` -- **inherit** parameter See :class:`LinearGradient`svgwrite-1.4.1/doc/classes/group.rst000066400000000000000000000020111400026116000174370ustar00rootroot00000000000000Group ===== .. autoclass:: svgwrite.container.Group .. seealso:: http://www.w3.org/TR/SVG11/struct.html#GElement Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` 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` interface Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes `svgwrite-1.4.1/doc/classes/hyperlink.rst000066400000000000000000000056431400026116000203260ustar00rootroot00000000000000Hyperlink ========= The **Hyperlink** class represents the SVG **a** element. .. autoclass:: svgwrite.container.Hyperlink .. seealso:: http://www.w3.org/TR/SVG11/linking.html#AElement .. automethod:: svgwrite.container.Hyperlink.__init__ Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` 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` interface * **xlink:href** -- `string` -- **href** parameter * **xlink:show** -- ``'new|replace'`` use the **target** attribute * **xlink:acuate** -- ``'onRequest'`` This attribute provides documentation to XLink-aware processors that an application should traverse from the starting resource to the ending resource only on a post-loading event triggered for the purpose of traversal. * **target** -- `string` -- **target** parameter This attribute specifies the name or portion of the target window, frame, pane, tab, or other relevant presentation context (e.g., an HTML or XHTML frame, iframe, or object element) into which a document is to be opened when the link is activated. - ``_replace``: The current SVG image is replaced by the linked content in the same rectangular area in the same frame as the current SVG image. - ``_self``: The current SVG image is replaced by the linked content in the same frame as the current SVG image. This is the lacuna value, if the target attribute is not specified. - ``_parent``: The immediate frameset parent of the SVG image is replaced by the linked content. - ``_top``: The content of the full window or tab, including any frames, is replaced by the linked content - ``_blank``: A new un-named window or tab is requested for the display of the linked content. If this fails, the result is the same as ``_top`` - ````: Specifies the name of the frame, pane, or other relevant presentation context for display of the linked content. If this already exists, it is re-used, replacing the existing content. If it does not exist, it is created (the same as ``_blank``, except that it now has a name). Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` * :doc:`XLink Attributes ` svgwrite-1.4.1/doc/classes/image.rst000066400000000000000000000042011400026116000173700ustar00rootroot00000000000000Image ===== .. autoclass:: svgwrite.image.Image Methods ------- .. automethod:: svgwrite.image.Image.__init__ .. automethod:: svgwrite.image.Image.stretch .. automethod:: svgwrite.image.Image.fit Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Clipping` 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` interface * **x** -- `` -- **insert** parameter The x-axis coordinate of one corner of the rectangular region into which the referenced document is placed. Default is ``'0'``. * **y** -- `` -- **insert** parameter The y-axis coordinate of one corner of the rectangular region into which the referenced document is placed. Default is ``'0'``. * **width** -- `` -- **size** parameter The width of the rectangular region into which the referenced document is placed. A negative value is an error. A value of zero disables rendering of the element. * **height** -- `` -- **size** parameter The height of the rectangular region into which the referenced document is placed. A negative value is an error. A value of zero disables rendering of the element. * **xlink:href** -- `string` -- **href** parameter A IRI reference to the image resource. * **preserveAspectRatio** -- ``'[defer] []'`` Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` * :doc:`XLink Attributes ` svgwrite-1.4.1/doc/classes/marker.rst000066400000000000000000000100011400026116000175620ustar00rootroot00000000000000Marker ====== .. autoclass:: svgwrite.container.Marker .. seealso:: http://www.w3.org/TR/SVG11/painting.html#MarkerElement example:: dwg = svgwrite.Drawing() # create a new marker object marker = dwg.marker(insert=(5,5), size=(10,10)) # red point as marker marker.add(dwg.circle((5, 5), r=5, fill='red')) # add marker to defs section of the drawing dwg.defs.add(marker) # create a new line object line = dwg.add(dwg.polyline( [(10, 10), (50, 20), (70, 50), (100, 30)], stroke='black', fill='none')) # set marker (start, mid and end markers are the same) line.set_markers(marker) # or set markers direct as SVG Attributes 'marker-start', 'marker-mid', # 'marker-end' or 'marker' if all markers are the same. line['marker'] = marker.get_funciri() # NEW in v1.1.11 # set individually markers, to just set the end marker set other markers to None or False: line.set_markers((None, False, marker)) .. automethod:: svgwrite.container.Marker.__init__ Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.ViewBox` * :class:`svgwrite.mixins.Presentation` 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* * **viewBox** -- use :class:`svgwrite.mixins.ViewBox` interface * **preserveAspectRatio** -- use :class:`svgwrite.mixins.ViewBox` interface * **markerUnits** -- ``'strokeWidth|userSpaceOnUse'`` Defines the coordinate system for attributes **markerWidth**, **markerHeight** and the contents of the **marker**. If markerUnits -- ``'strokeWidth'``, **markerWidth**, **markerHeight** and the contents of the **marker** represent values in a coordinate system which has a single unit equal the size in user units of the current stroke width in place for the graphic object referencing the marker. If markerUnits -- ``'userSpaceOnUse'``, **markerWidth**, **markerHeight** and the contents of the **marker** represent values in the current user coordinate system in place for the graphic object referencing the marker (i.e., the user coordinate system for the element referencing the **marker** element via a **marker**, **marker-start**, **marker-mid** or **marker-end** property). * **refX** -- `` -- **insert** parameter The x-axis coordinate of the reference point which is to be aligned exactly at the marker position. The coordinate is defined in the coordinate system after application of the **viewBox** and **preserveAspectRatio** attributes. (default = "0") * **refY** -- `` -- **insert** parameter The y-axis coordinate of the reference point which is to be aligned exactly at the marker position. The coordinate is defined in the coordinate system after application of the **viewBox** and **preserveAspectRatio** attributes. (default = "0") * **markerWidth** -- `` -- **size** parameter Represents the width of the viewport into which the marker is to be fitted when it is rendered. (default = "3") * **markerHeight** -- `` -- **size** parameter Represents the height of the viewport into which the marker is to be fitted when it is rendered. A value of zero disables rendering of the element. (default = "3") * **orient** -- ``'auto'`` | `` -- **orient** parameter Indicates how the marker is rotated. (SVG default = "0", but for :meth:`__init__` ``'auto'`` is the default value) .. seealso:: http://www.w3.org/TR/SVG11/painting.html#OrientAttribute Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Presentation Attributes ` svgwrite-1.4.1/doc/classes/masking.rst000066400000000000000000000116361400026116000177510ustar00rootroot00000000000000ClipPath ======== .. 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 ` * :doc:`Conditional Processing Attributes ` * :doc:`Presentation Attributes ` 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** -- `` -- **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** -- `` -- **start** parameter The y-axis coordinate of one corner of the rectangle for the largest possible offscreen buffer. Default is ``'-10%'``. * **width** -- `` -- **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** -- `` -- **size** parameter The height of the largest possible offscreen buffer. Default is ``'120%'``. Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Presentation Attributes ` svgwrite-1.4.1/doc/classes/mixins.rst000066400000000000000000000055301400026116000176230ustar00rootroot00000000000000ViewBox Mixin ============= .. autoclass:: svgwrite.mixins.ViewBox .. automethod:: svgwrite.mixins.ViewBox.viewbox .. automethod:: svgwrite.mixins.ViewBox.stretch .. automethod:: svgwrite.mixins.ViewBox.fit Transform Mixin =============== .. autoclass:: svgwrite.mixins.Transform .. automethod:: svgwrite.mixins.Transform.translate .. automethod:: svgwrite.mixins.Transform.rotate .. automethod:: svgwrite.mixins.Transform.skewX .. automethod:: svgwrite.mixins.Transform.skewY .. automethod:: svgwrite.mixins.Transform.scale XLink Mixin =========== .. autoclass:: svgwrite.mixins.XLink .. automethod:: svgwrite.mixins.XLink.set_href .. automethod:: svgwrite.mixins.XLink.set_xlink Set **xlink:actuate** and **xlink:type** by the index operator:: element['xlink:type'] = 'simple' element['xlink:actuate'] = 'onLoad' Presentation Mixin ================== .. autoclass:: svgwrite.mixins.Presentation .. automethod:: svgwrite.mixins.Presentation.fill .. seealso:: * http://www.w3.org/TR/SVG11/painting.html#FillProperty * http://www.w3.org/TR/SVG11/painting.html#FillRuleProperty * http://www.w3.org/TR/SVG11/painting.html#FillOpacityProperty .. automethod:: svgwrite.mixins.Presentation.stroke .. seealso:: * http://www.w3.org/TR/SVG11/painting.html#StrokeProperty * http://www.w3.org/TR/SVG11/painting.html#StrokeWidthProperty * http://www.w3.org/TR/SVG11/painting.html#StrokeOpacityProperty * http://www.w3.org/TR/SVG11/painting.html#StrokeLinecapProperty * http://www.w3.org/TR/SVG11/painting.html#StrokeMiterlimitProperty .. automethod:: svgwrite.mixins.Presentation.dasharray .. seealso:: * http://www.w3.org/TR/SVG11/painting.html#StrokeDasharrayProperty * http://www.w3.org/TR/SVG11/painting.html#StrokeDashoffsetProperty MediaGroup Mixin ================ SVG Tiny 1.2 valid for SVG Elements: animation, audio, desc, image, metadata, title, video .. autoclass:: svgwrite.mixins.MediaGroup .. automethod:: svgwrite.mixins.MediaGroup.viewport_fill .. seealso:: * http://www.w3.org/TR/SVGMobile12/painting.html#viewport-fill-property * http://www.w3.org/TR/SVGMobile12/painting.html#viewport-fill-opacity-property Markers Mixin ============= .. autoclass:: svgwrite.mixins.Markers .. automethod:: svgwrite.mixins.Markers.set_markers .. seealso:: * http://www.w3.org/TR/SVG11/painting.html#MarkerProperty * http://www.w3.org/TR/SVG11/painting.html#MarkerStartProperty * http://www.w3.org/TR/SVG11/painting.html#MarkerMidProperty * http://www.w3.org/TR/SVG11/painting.html#MarkerEndProperty Clipping Mixin ============== .. autoclass:: svgwrite.mixins.Clipping .. automethod:: svgwrite.mixins.Clipping.clip_rect .. seealso:: http://www.w3.org/TR/SVG11/masking.html#OverflowAndClipProperties svgwrite-1.4.1/doc/classes/path.rst000066400000000000000000000115551400026116000172540ustar00rootroot00000000000000Path ==== .. autoclass:: svgwrite.path.Path .. seealso:: http://www.w3.org/TR/SVG11/paths.html#PathElement .. automethod:: svgwrite.path.Path.__init__ Attributes ---------- .. attribute:: commands `list` -- the command and coordinate stack Methods ------- .. automethod:: svgwrite.path.Path.push .. automethod:: svgwrite.path.Path.push_arc Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` * :class:`svgwrite.mixins.Markers` .. _pathCommands: Path Commands ------------- .. seealso:: http://www.w3.org/TR/SVG11/paths.html#PathData Uppercase commands indicates absolute coordinates, lowercase commands indicates relative coordinates * **horizontal-line 'h', 'H' x+** Draws a horizontal line from the current point (cpx, cpy) to (x, cpy). * **vertical-line 'v', 'V' y+** Draws a vertical line from the current point (cpx, cpy) to (cpx, y). * **line 'l', 'L' (x y)+** Draw a line from the current point to the given (x,y) coordinate. * **moveto 'm', 'M' (x y)+** Start a new sub-path at the given (x,y) coordinate. If a moveto is followed by multiple pairs of coordinates, the subsequent pairs are treated as implicit lineto commands. Hence, implicit lineto commands will be relative if the moveto is relative, and absolute if the moveto is absolute. If a relative moveto (m) appears as the first element of the path, then it is treated as a pair of absolute coordinates. In this case, subsequent pairs of coordinates are treated as relative even though the initial moveto is interpreted as an absolute moveto. * **cubic-bezier-curve 'c', 'C' (x1 y1 x2 y2 x y)+** Draws a cubic Bézier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve. * **smooth-cubic-bezier-curve 's', 'S' (x2 y2 x y)+** Draws a cubic Bézier curve from the current point to (x,y). The first control point is assumed to be the reflection of the second control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not an C, c, S or s, assume the first control point is coincident with the current point.) (x2,y2) is the second control point (i.e., the control point at the end of the curve). * **quadratic-bezier-curve 'q', 'Q' (x1 y1 x y)+** Draws a quadratic Bézier curve from the current point to (x,y) using (x1,y1) as the control point. * **smooth-quadratic-bezier-curve 't', 'T' (x y)+** Draws a quadratic Bézier curve from the current point to (x,y). The control point is assumed to be the reflection of the control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not a Q, q, T or t, assume the control point is coincident with the current point.) * **elliptical-arc 'a', 'A' (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+** Draws an elliptical arc from the current point to (x, y). The size and orientation of the ellipse are defined by two radii (rx, ry) and an x-axis-rotation, which indicates how the ellipse as a whole is rotated relative to the current coordinate system. The center (cx, cy) of the ellipse is calculated automatically to satisfy the constraints imposed by the other parameters. large-arc-flag and sweep-flag contribute to the automatic calculations and help determine how the arc is drawn. * **'z', 'Z'** close current subpath 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 * **pathLength** -- `` the *pathLength* attribute can be used to provide the author's computation of the total length of the path so that the user agent can scale distance-along-a-path computations by the ratio of 'pathLength' to the user agent's own computed value for total path length. A "moveto" operation within a 'path' element is defined to have zero length. * **d** -- `string` The definition of the outline of a shape, use push-method to add commands and coordinates Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` svgwrite-1.4.1/doc/classes/pattern.rst000066400000000000000000000133171400026116000177730ustar00rootroot00000000000000Pattern ======= .. autoclass:: svgwrite.pattern.Pattern .. seealso:: http://www.w3.org/TR/SVG11/pservers.html#PatternElement Methods ------- .. automethod:: svgwrite.pattern.Pattern.__init__ .. method:: Pattern.add Add **element** to the pattern content. The contents of the **pattern** are relative to a new coordinate system. If there is a **viewBox** attribute, then the new coordinate system is fitted into the region defined by the **x**, **y**, **width**, **height** and **patternUnits** attributes on the **pattern** element using the standard rules for **viewBox** and **preserveAspectRatio**. If there is no **viewBox** attribute, then the new coordinate system has its origin at (x, y), where x is established by the **x** attribute on the **pattern** element, and y is established by the **y** attribute on the ‘pattern’ element. Thus, in the following example:: or as :mod:`svgwrite` calls:: # dwg is the main svg drawing pattern = dwg.pattern(insert=(10, 10), size=(20, 20)) pattern.add(dwg.rect(insert=(5, 5), size=(10, 10)) the rectangle has its top/left located 5 units to the right and 5 units down from the origin of the pattern tile. SVG Attributes -------------- * **patternUnits** -- ``'userSpaceOnUse | objectBoundingBox'`` Defines the coordinate system for attributes **x**, **y**, **width** and **height**. If patternUnits= ``'userSpaceOnUse'`` , **x** , **y**, **width** and **height** represent values in the coordinate system that results from taking the current user coordinate system in place at the time when the **pattern** element is referenced (i.e., the user coordinate system for the element referencing the **pattern** element via a **fill** or **stroke** property) and then applying the transform specified by attribute **patternTransform**. If patternUnits= ``'objectBoundingBox'`` , the user coordinate system for attributes **x**, **y**, **width** and **height** is established using the bounding box of the element to which the pattern is applied (see Object bounding box units) and then applying the transform specified by attribute **patternTransform**. Default is ``'objectBoundingBox'``. * **patternContentUnits** -- ``'userSpaceOnUse | objectBoundingBox'`` Defines the coordinate system for the contents of the **pattern**. Note that this attribute has no effect if attribute **viewBox** is specified. If patternContentUnits= ``'userSpaceOnUse'`` , the user coordinate system for the contents of the **pattern** element is the coordinate system that results from taking the current user coordinate system in place at the time when the **pattern** element is referenced (i.e., the user coordinate system for the element referencing the **pattern** element via a **fill** or **stroke** property) and then applying the transform specified by attribute **patternTransform**. If patternContentUnits= ``'objectBoundingBox'`` , the user coordinate system for the contents of the **pattern** element is established using the bounding box of the element to which the pattern is applied (see Object bounding box units) and then applying the transform specified by attribute **patternTransform**. Default is ``'userSpaceOnUse'``. * **patternTransform** -- `` Use the :class:`~svgwrite.mixins.Transform` interface to set transformations. Contains the definition of an optional additional transformation from the pattern coordinate system onto the target coordinate system (i.e., ``'userSpaceOnUse'`` or ``'objectBoundingBox'``). This allows for things such as skewing the pattern tiles. This additional transformation matrix is post-multiplied to (i.e., inserted to the right of) any previously defined transformations, including the implicit transformation necessary to convert from object bounding box units to user space. * **x** -- `` -- **insert** parameter **x**, **y**, **width** and **height** indicate how the pattern tiles are placed and spaced. These attributes represent coordinates and values in the coordinate space specified by the combination of attributes **patternUnits** and **patternTransform**. Default is ``'0'``. * **y** -- `` -- **center** parameter See **x**. Default is ``'0'``. * **width** -- `` -- **size** parameter See **x**. A negative value is an error. A value of zero disables rendering of the element (i.e., no paint is applied). Default is ``'0'``. * **height** -- `` -- **size** parameter See **x**. A negative value is an error. A value of zero disables rendering of the element (i.e., no paint is applied). Default is ``'0'``. * **xlink:href** -- `string` -- **inherit** parameter A URI reference to a different **pattern** element within the current SVG document fragment. Any attributes which are defined on the referenced element which are not defined on this element are inherited by this element. If this element has no children, and the referenced element does (possibly due to its own **xlink:href** attribute), then this element inherits the children from the referenced element. Inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attributes or children due to its own **xlink:href** attribute, then the current element can inherit those attributes or children. * **preserveAspectRatio** -- ``'[defer] []'`` Use the :class:`~svgwrite.mixins.ViewBox` interface to set **viewbox** and **preserveAspectRatio**. svgwrite-1.4.1/doc/classes/script.rst000066400000000000000000000035761400026116000176300ustar00rootroot00000000000000Script ====== The *script* element indicate links to a client-side language. .. autoclass:: svgwrite.container.Script .. seealso:: http://www.w3.org/TR/SVG/script.html .. automethod:: svgwrite.container.Script.__init__ .. automethod:: svgwrite.container.Script.append Best place for the *script* element is the *defs* attribute of the :class:`~svgwrite.drawing.Drawing` class:: drawing.defs.add(drawing.script('script-content')) Parent Classes -------------- * :class:`svgwrite.base.BaseElement` SVG Attributes -------------- * **type** -- `string` Identifies the scripting language for the given *script* element. The value content-type specifies a media type, per MIME. If a *type* is not provided, the value of **contentScriptType** on the **svg** element shall be used, which in turn defaults to ``'application/ecmascript'``. If a *script* element falls outside of the outermost svg element and the *type* is not provided, the *type* must default to ``'application/ecmascript'`` * **externalResourcesRequired** -- `bool` *False*: if document rendering can proceed even if external resources are unavailable else: *True* * **xlink:href** -- `string` -- **href** parameter * **xlink:show** -- ``'new|replace'`` * **xlink:acuate** -- ``'onRequest'`` This attribute provides documentation to XLink-aware processors that an application should traverse from the starting resource to the ending resource only on a post-loading event triggered for the purpose of traversal. Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` * :doc:`XLink Attributes ` svgwrite-1.4.1/doc/classes/shapes.rst000066400000000000000000000126671400026116000176100ustar00rootroot00000000000000Line ==== .. autoclass:: svgwrite.shapes.Line .. seealso:: http://www.w3.org/TR/SVG11/shapes.html#LineElement .. automethod:: svgwrite.shapes.Line.__init__ SVG Attributes -------------- * **x1** -- `` -- **start** parameter * **y1** -- `` -- **start** parameter * **x2** -- `` -- **end** parameter * **y2** -- `` -- **end** parameter Common SVG Attributes --------------------- These are the common SVG Attributes for Line, Rect, Circle, Ellipse, Poliyline and Polygon. * **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` interface Common Standard SVG Attributes ------------------------------ These are the common Standard SVG Attributes for Line, Rect, Circle, Ellipse, Poliyline and Polygon. * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` * :class:`svgwrite.mixins.Markers` Rect ==== .. autoclass:: svgwrite.shapes.Rect .. seealso:: http://www.w3.org/TR/SVG11/shapes.html#RectElement .. automethod:: svgwrite.shapes.Rect.__init__ SVG Attributes -------------- * **x** -- `` -- **insert** parameter The x-axis coordinate of the side of the rectangle which has the smaller x-axis coordinate value * **y** -- `` -- **insert** parameter The y-axis coordinate of the side of the rectangle which has the smaller y-axis coordinate value * **width** -- `` -- **size** parameter * **height** -- `` -- **size** parameter * **rx** -- `` -- **rx** parameter For rounded rectangles, the y-axis radius of the ellipse used to round off the corners of the rectangle. * **ry** -- `` -- **ry** parameter For rounded rectangles, the y-axis radius of the ellipse used to round off the corners of the rectangle. Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` Circle ====== .. autoclass:: svgwrite.shapes.Circle .. seealso:: http://www.w3.org/TR/SVG11/shapes.html#CircleElement .. automethod:: svgwrite.shapes.Circle.__init__ SVG Attributes -------------- * **cx** -- `` -- **center** parameter The x-axis coordinate of the center of the circle. * **cy** -- `` -- **center** parameter The y-axis coordinate of the center of the circle. * **r** -- `` -- **r** parameter The radius of the circle. Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` Ellipse ======= .. autoclass:: svgwrite.shapes.Ellipse .. seealso:: http://www.w3.org/TR/SVG11/shapes.html#EllipseElement .. automethod:: svgwrite.shapes.Ellipse.__init__ SVG Attributes -------------- * **cx** -- `` -- **center** parameter The x-axis coordinate of the center of the ellipse. * **cy** -- `` -- **center** parameter The y-axis coordinate of the center of the ellipse. * **rx** -- `` -- **r** parameter The x-axis radius of the ellipse. * **ry** -- `` -- **r** parameter The y-axis radius of the ellipse. Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` Polyline ======== .. autoclass:: svgwrite.shapes.Polyline .. seealso:: http://www.w3.org/TR/SVG11/shapes.html#PolylineElement .. automethod:: svgwrite.shapes.Polyline.__init__ Attributes ---------- .. attribute:: Polyline.points `list` of points, a point is a `2-tuple` (x, y): x, y = `` SVG Attributes -------------- * **points** -- `list` of points -- **points** parameter The points that make up the polyline. All coordinate values are in the **user coordinate system** (no units allowed). How to append points:: Polyline.points.append( point ) Polyline.points.extend( [point1, point2, point3, ...] ) Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` * :class:`svgwrite.mixins.Markers` Polygon ======= .. autoclass:: svgwrite.shapes.Polygon .. seealso:: http://www.w3.org/TR/SVG11/shapes.html#PolygonElement Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` * :class:`svgwrite.mixins.Markers` Basic Shapes Examples ===================== .. literalinclude:: ../../examples/basic_shapes.py :lines: 16- basic_shapes.svg ---------------- .. image:: ../../examples/basic_shapes.svg :width: 800 :height: 800 :alt: Your browser can't render SVG images.svgwrite-1.4.1/doc/classes/solidcolor.rst000066400000000000000000000020101400026116000204530ustar00rootroot00000000000000SolidColor ========== The `solidColor` element is a paint server that provides a single color with opacity. It can be referenced like the other paint servers (i.e. gradients). .. autoclass:: svgwrite.solidcolor.SolidColor .. seealso:: https://www.w3.org/TR/SVGTiny12/painting.html#SolidColorElement Methods ------- .. automethod:: svgwrite.solidcolor.SolidColor.__init__ SVG Attributes -------------- * **solid-color** -- ``'currentColor | | inherit'`` (__init__() parameter `color`) The `solid-color` attribute specifies the color that shall be used for this `solidColor` element. The keyword ``"currentColor"`` can be specified in the same manner as within a `` specification for the `fill` and `stroke` properties. * **solid-opacity** -- ``' | inherit'`` (__init__() parameter `opacity`) The `solid-opacity` parameter defines the opacity of the `solidColor`. Any values outside the range `0.0` (fully transparent) to `1.0` (fully opaque) must be clamped to this range.svgwrite-1.4.1/doc/classes/style.rst000066400000000000000000000024461400026116000174570ustar00rootroot00000000000000Style ===== Internal Stylesheets .. autoclass:: svgwrite.container.Style .. seealso:: http://www.w3.org/TR/SVG/styling.html#StyleElement .. automethod:: svgwrite.container.Style.__init__ .. automethod:: svgwrite.container.Style.append Best place for the *style* element is the *defs* attribute of the :class:`~svgwrite.drawing.Drawing` class:: drawing.defs.add(drawing.style('stylesheet-content')) Parent Classes -------------- * :class:`svgwrite.base.BaseElement` SVG Attributes -------------- * **type** -- `string` default is ``'text/css'`` * **title** -- `string` (For compatibility with HTML 4.) This attribute specifies an advisory title for the ‘style’ element. * **media** -- `string` This attribute specifies the intended destination medium for style information. It may be a single media descriptor or a comma-separated list. The default value for this attribute is ``'all'``. Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` * :doc:`XLink Attributes ` svgwrite-1.4.1/doc/classes/svg.rst000066400000000000000000000063401400026116000171130ustar00rootroot00000000000000SVG === .. autoclass:: svgwrite.container.SVG .. seealso:: http://www.w3.org/TR/SVG11/struct.html#SVGElement .. automethod:: svgwrite.container.SVG.__init__ .. automethod:: svgwrite.container.SVG.embed_stylesheet .. automethod:: svgwrite.container.SVG.embed_font .. automethod:: svgwrite.container.SVG.embed_google_web_font Attributes ---------- .. attribute:: SVG.defs `Defs` container for referenced elements adding SVG elements to *defs*:: svgobject.defs.add(element) Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.container.Symbol` * :class:`svgwrite.container.SVG` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.ViewBox` * :class:`svgwrite.mixins.Presentation` 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` interface * **x** -- `` -- **insert** parameter (Has no meaning or effect on :class:`~svgwrite.drawing.Drawing` .) The x-axis coordinate of one corner of the rectangular region into which an embedded **svg** element is placed. Default is ``'0'``. * **y** -- `` -- **insert** parameter (Has no meaning or effect on :class:`~svgwrite.drawing.Drawing` .) The y-axis coordinate of one corner of the rectangular region into which an embedded **svg** element is placed. Default is ``'0'``. * **width** -- `` -- **size** parameter For outermost **svg** elements (:class:`~svgwrite.drawing.Drawing`), the intrinsic width of the SVG document fragment. For embedded **svg** elements, the width of the rectangular region into which the **svg** element is placed. A negative value is an error. A value of zero disables rendering of the element. Default is ``'100%'``. * **height** -- `` -- **size** parameter For outermost **svg** elements (:class:`~svgwrite.drawing.Drawing`), the intrinsic height of the SVG document fragment. For embedded **svg** elements, the height of the rectangular region into which the **svg** element is placed. A negative value is an error. A value of zero disables rendering of the element. Default is ``'100%'``. * **viewBox** -- :class:`svgwrite.mixins.ViewBox` interface * **preserveAspectRatio** -- :class:`svgwrite.mixins.ViewBox` interface * **zoomAndPan** -- ``'disable | magnify'`` Default is ``'magnify'``. .. note:: do not set or change following SVG attributes: version, baseProfile, contentScriptType, contentStyleType Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Document Event Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` svgwrite-1.4.1/doc/classes/symbol.rst000066400000000000000000000020631400026116000176170ustar00rootroot00000000000000Symbol ====== .. autoclass:: svgwrite.container.Symbol .. seealso:: http://www.w3.org/TR/SVG11/struct.html#SymbolElement Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.ViewBox` * :class:`svgwrite.mixins.Presentation` * :class:`svgwrite.mixins.Clipping` 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* * **viewBox** -- use :class:`svgwrite.mixins.ViewBox` interface * **preserveAspectRatio** -- use :class:`svgwrite.mixins.ViewBox` interface Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` svgwrite-1.4.1/doc/classes/text.rst000066400000000000000000000361031400026116000173000ustar00rootroot00000000000000Text ==== .. automodule:: svgwrite.text .. autoclass:: svgwrite.text.Text .. seealso:: http://www.w3.org/TR/SVG11/text.html#TextElement Refer to **TSpan** SVG Attributes Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.text.TSpan` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` TSpan ===== .. autoclass:: svgwrite.text.TSpan .. seealso:: http://www.w3.org/TR/SVG11/text.html#TSpanElement .. automethod:: svgwrite.text.TSpan.__init__ Attributes ---------- .. attribute:: TSpan.text stores the text value. Methods ------- .. automethod:: svgwrite.text.TSpan.__init__ Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Presentation` SVG Attributes -------------- * **x** -- `` If a single `` is provided, then the value represents the new absolute X coordinate for the current text position for rendering the glyphs that correspond to the first character within this element or any of its descendants. If `list` of n `` is provided, then the values represent new absolute X coordinates for the current text position for rendering the glyphs corresponding to each of the first n characters within this element or any of its descendants. If more `` are provided than characters, then the extra `` will have no effect on glyph positioning. If more characters exist than `` , then for each of these extra characters: (a) if an ancestor **Text** or **TSpan** element specifies an absolute X coordinate for the given character via an **x** attribute, then that absolute X coordinate is used as the starting X coordinate for that character (nearest ancestor has precedence), else (b) the starting X coordinate for rendering the glyphs corresponding to the given character is the X coordinate of the resulting current text position from the most recently rendered glyph for the current **Text** element. If the attribute is not specified: (a) if an ancestor **Text** or **TSpan** element specifies an absolute X coordinate for a given character via an **x** attribute, then that absolute X coordinate is used (nearest ancestor has precedence), else (b) the starting X coordinate for rendering the glyphs corresponding to a given character is the X coordinate of the resulting current text position from the most recently rendered glyph for the current **Text** element. * **y** -- `` The corresponding list of absolute Y coordinates for the glyphs corresponding to the characters within this element. The processing rules for the **y** attribute parallel the processing rules for the **x** attribute. * **dx** -- `` If a single is provided, this value represents the new relative X coordinate for the current text position for rendering the glyphs corresponding to the first character within this element or any of its descendants. The current text position is shifted along the x-axis of the current user coordinate system by `` before the first character's glyphs are rendered. If a `list` of n `` is provided, then the values represent incremental shifts along the x-axis for the current text position before rendering the glyphs corresponding to the first n characters within this element or any of its descendants. Thus, before the glyphs are rendered corresponding to each character, the current text position resulting from drawing the glyphs for the previous character within the current **Text** element is shifted along the X axis of the current user coordinate system by `` . If more `` are provided than characters, then any extra `` will have no effect on glyph positioning. If more characters exist than s, then for each of these extra characters: (a) if an ancestor **Text** or **TSpan** element specifies a relative X coordinate for the given character via a **dx** attribute, then the current text position is shifted along the x-axis of the current user coordinate system by that amount (nearest ancestor has precedence), else (b) no extra shift along the x-axis occurs. If the attribute is not specified: (a) if an ancestor **Text** or **TSpan** element specifies a relative X coordinate for a given character via a **dx** attribute, then the current text position is shifted along the x-axis of the current user coordinate system by that amount (nearest ancestor has precedence), else (b) no extra shift along the x-axis occurs. * **dy** -- `` The corresponding list of relative Y coordinates for the characters within the **tspan** element. The processing rules for the **dy** attribute parallel the processing rules for the **dx** attribute. * **rotate** -- `` The supplemental rotation about the current text position that will be applied to all of the glyphs corresponding to each character within this element. If a `list` of `` is provided, then the first `` represents the supplemental rotation for the glyphs corresponding to the first character within this element or any of its descendants, the second represents the supplemental rotation for the glyphs that correspond to the second character, and so on. If more `` are provided than there are characters, then the extra `` will be ignored. If more characters are provided than ``, then for each of these extra characters the rotation value specified by the last number must be used. If the attribute is not specified and if an ancestor **Text** or **TSpan** element specifies a supplemental rotation for a given character via a **rotate** attribute, then the given supplemental rotation is applied to the given character (nearest ancestor has precedence). If there are more characters than `` specified in the ancestor's **rotate** attribute, then for each of these extra characters the rotation value specified by the last number must be used. This supplemental rotation has no impact on the rules by which current text position is modified as glyphs get rendered and is supplemental to any rotation due to text on a path and to **glyph-orientation-horizontal** or **glyph-orientation-vertical**. * **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* * **textLength** -- `` The purpose of this attribute is to allow the author to achieve exact alignment, in visual rendering order after any bidirectional reordering, for the first and last rendered glyphs that correspond to this element; thus, for the last rendered character (in visual rendering order after any bidirectional reordering), any supplemental inter-character spacing beyond normal glyph advances are ignored (in most cases) when the user agent determines the appropriate amount to expand/compress the text string to fit within a length of **textLength**. * **lengthAdjust** -- ``'spacing | spacingAndGlyphs'`` Indicates the type of adjustments which the user agent shall make to make the rendered length of the text match the value specified on the **textLength** attribute. * ``'spacing'`` indicates that only the advance values are adjusted. The glyphs themselves are not stretched or compressed. * ``'spacingAndGlyphs'`` indicates that the advance values are adjusted and the glyphs themselves stretched or compressed in one axis (i.e., a direction parallel to the inline-progression-direction). If the attribute is not specified, the effect is as a value of *spacing* were specified. Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` TRef ==== .. autoclass:: svgwrite.text.TRef .. seealso:: http://www.w3.org/TR/SVG11/text.html#TRefElement .. automethod:: svgwrite.text.TRef.__init__ .. automethod:: svgwrite.text.TRef.set_href Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.XLink` * :class:`svgwrite.mixins.Presentation` 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* * **xlink:href** -- `` A IRI reference to an element whose character data content shall be used as character data for this **tref** element. Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` TextPath ======== .. autoclass:: svgwrite.text.TextPath .. seealso:: http://www.w3.org/TR/SVG11/text.html#TextPathElement Methods ------- .. automethod:: svgwrite.text.TextPath.__init__ Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.XLink` * :class:`svgwrite.mixins.Presentation` 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* * **xlink:href** -- `string` A IRI reference to an element whose character data content shall be used as character data for this **TRef** element. * **startOffset** -- `` An offset from the start of the **path** for the initial current text position, calculated using the user agent's distance along the path algorithm. Value as percentage or distance along the path measured in the current user coordinate system. * **method** -- ``'align | stretch'`` Indicates the method by which text should be rendered along the path. * **spacing** -- ``'auto | exact'`` Indicates how the user agent should determine the spacing between glyphs that are to be rendered along a path. Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` TextArea ======== .. autoclass:: svgwrite.text.TextArea .. seealso:: http://www.w3.org/TR/SVGMobile12/text.html#TextAreaElement Methods ------- .. automethod:: svgwrite.text.TextArea.write Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.Presentation` SVG Attributes -------------- * **x** -- ** The x-axis coordinate of one corner of the rectangular region into which the text content will be placed. The lacuna value is ``'0'``. * **y** -- ** The y-axis coordinate of one corner of the rectangular region into which the text content will be placed. The lacuna value is ``'0'``. * **width** -- ``'auto'`` | ** The width of the rectangular region into which the text content will be placed. A value of ``'auto'`` indicates that the width of the rectangular region is infinite. The lacuna value is ``'auto'``. * **height** -- ``'auto'`` | ** The height of the rectangular region into which the text content will be placed. A value of ``'auto'`` indicates that the height of the rectangular region is infinite. The lacuna value is ``'auto'``. * **editable** -- ``'auto`| simple'`` This attribute indicates whether the text can be edited. See the definition of the 'editable' attribute. * **focusable** -- ``'true | false | auto'`` =========== ============================================================= Value Description =========== ============================================================= ``'true'`` The element is keyboard-aware and must be treated as any other UI component that can get focus. ``'false'`` The element is not focusable. ``'auto'`` The lacuna value. Equivalent to ``'false'`` =========== ============================================================= Exception: see http://www.w3.org/TR/SVGMobile12/interact.html#focusable-attr * **line-increment** -- ``'auto | inherit'`` | `` The **line-increment** property provides limited control over the size of each line in the block-progression-direction. This property applies to the **textArea** element, and to child elements of the **textArea** element. The **line-increment** property must not have any effect when used on an element which is not, or does not have as an ancestor, a **textArea** element. * **text-align** -- ``'start | end | center | inherit'`` Alignment in the inline progression direction in flowing text is provided by the text-align property. * **display-align** -- ``'auto | before | center | after | inherit'`` The **display-align** property specifies the alignment, in the block-progression-direction, of the text content of the **textArea** element. ============= =========================================================== Value Description ============= =========================================================== ``'auto'`` For SVG, auto is equivalent to before. ``'before'`` The before-edge of the first line is aligned with the before-edge of the first region. ``'center'`` The lines are centered in the block-progression-direction. ``'after'`` The after-edge of the last line is aligned with the after-edge of the last region. ============= =========================================================== Layout rules: see http://www.w3.org/TR/SVGMobile12/text.html#TextAreaElement svgwrite-1.4.1/doc/classes/use.rst000066400000000000000000000041261400026116000171100ustar00rootroot00000000000000Use === .. autoclass:: svgwrite.container.Use .. seealso:: http://www.w3.org/TR/SVG11/struct.html#UseElement .. automethod:: svgwrite.container.Use.__init__ Parent Classes -------------- * :class:`svgwrite.base.BaseElement` * :class:`svgwrite.mixins.Transform` * :class:`svgwrite.mixins.XLink` * :class:`svgwrite.mixins.Presentation` 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* * **x** -- `` -- **insert** parameter The x-axis coordinate of one corner of the rectangular region into which the referenced element is placed. Default is ``'0'``. * **y** -- `` -- **insert** parameter The y-axis coordinate of one corner of the rectangular region into which the referenced element is placed. Default is ``'0'``. * **width** -- `` -- **size** parameter The width of the rectangular region into which the referenced element is placed. A negative value is an error. A value of zero disables rendering of this element. Default is ``'100%'``. * **height** -- `` -- **size** parameter The height of the rectangular region into which the referenced element is placed. A negative value is an error. A value of zero disables rendering of this element. Default is ``'100%'``. * **transform** -- :class:`svgwrite.mixins.Transform` interface * **xlink:href** -- `string` -- **href** parameter set on __init__(href) Standard SVG Attributes ----------------------- * :doc:`Core Attributes ` * :doc:`Conditional Processing Attributes ` * :doc:`Graphical Event Attributes ` * :doc:`Presentation Attributes ` * :doc:`XLink Attributes ` svgwrite-1.4.1/doc/conf.py000066400000000000000000000163221400026116000154250ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # svgwrite documentation build configuration file, created by # sphinx-quickstart on Sat Sep 18 20:44:38 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('..')) import svgwrite # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'svgwrite' copyright = u'%s, %s <%s>' % (svgwrite.CYEAR, svgwrite.AUTHOR_NAME, svgwrite.AUTHOR_EMAIL) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = "{}.{}.{}".format(*svgwrite.version) # The full version, including alpha/beta/rc tags. release = svgwrite.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options auto-doc ---------------------------------------------------------- autoclass_content = 'class' # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = "sphinx_rtd_theme" import sphinx_rtd_theme html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'svgwritedoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'svgwrite.tex', u'svgwrite Documentation', u'Manfred Moitzi ', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'svgwrite', u'svgwrite Documentation', [u'mozman'], 1) ] svgwrite-1.4.1/doc/extensions/000077500000000000000000000000001400026116000163215ustar00rootroot00000000000000svgwrite-1.4.1/doc/extensions/inkscape.rst000066400000000000000000000025771400026116000206630ustar00rootroot00000000000000Inkscape Extension ================== This extension adds support for layers in `inkscape`_. A layer in inkscape is an extended *group* container with additional *label* and *locked* attributes. Inkscape supports nested layers. First import the inkscape extension:: import svgwrite from svgwrite.extensions import Inkscape dwg = svgwrite.Drawing('test-inkscape-extension.svg', profile='full', size=(640, 480)) You have to activate the extension for each drawing, because additional XML name spaces are required:: inkscape = Inkscape(dwg) Create a new layer, all attributes that are supported by the *group* container are also allowed:: top_layer = inkscape.layer(label="Top LAYER 1", locked=True) Add new layer as top level layer to the SVG drawing:: dwg.add(top_layer) Create new elements and add them to a layer:: line = dwg.line((100, 100), (300, 100), stroke=svgwrite.rgb(10, 10, 16, '%'), stroke_width=10) top_layer.add(line) text = dwg.text('Test', insert=(100, 100), font_size=100, fill='red') top_layer.add(text) Create another layer and add them as nested layer to "Top LAYER 1":: nested_layer = inkscape.layer(label="Nested LAYER 2", locked=False) top_layer.add(nested_layer) text = dwg.text('Test2', insert=(100, 200), font_size=100, fill='blue') nested_layer.add(text) dwg.save() .. _inkscape: https://inkscape.orgsvgwrite-1.4.1/doc/index.rst000066400000000000000000000047631400026116000157750ustar00rootroot00000000000000.. svgwrite documentation master file, created by sphinx-quickstart on Sat Sep 18 20:44:38 2010. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. svgwrite |version| documentation ================================ Welcome! This is the documentation for svgwrite |version|, last updated |today|. This package is in maintenance mode, no new features will be added, there will be no change of behavior, just bugfixes will be merged. If you are looking for a SVG Documentation beyond the official W3C papers, go to O'Reilly commons: http://commons.oreilly.com/wiki/index.php/SVG_Essentials, or (german) http://www.selfsvg.info . .. toctree:: :maxdepth: 1 :caption: Contents overview reference .. toctree:: :maxdepth: 1 :caption: Modules svgwrite utils/utils .. toctree:: :maxdepth: 1 :caption: Structural Objects classes/base classes/drawing classes/svg classes/group classes/defs classes/symbol classes/marker classes/use classes/hyperlink classes/script classes/style .. toctree:: :maxdepth: 1 :caption: Graphical Objects classes/path classes/shapes classes/image .. toctree:: :maxdepth: 1 :caption: Text Objects classes/text .. toctree:: :maxdepth: 1 :caption: Paint server classes/gradients classes/pattern classes/solidcolor .. toctree:: :maxdepth: 1 :caption: Masking classes/masking .. toctree:: :maxdepth: 1 :caption: Animation classes/animate .. toctree:: :maxdepth: 1 :caption: Filter Effects classes/filters classes/filter_primitive classes/fe_blend classes/fe_color_matrix classes/fe_component_transfer classes/fe_composite classes/fe_convolve_matrix classes/fe_diffuse_lighting classes/fe_displacement_map classes/fe_flood classes/fe_gaussian_blur classes/fe_image classes/fe_merge classes/fe_morphology classes/fe_offset classes/fe_specular_lighting classes/fe_tile classes/fe_turbulence classes/fe_lights .. toctree:: :maxdepth: 1 :caption: MixIns classes/mixins .. toctree:: :maxdepth: 1 :caption: Extensions extensions/inkscape Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` Document License ================ Unless otherwise stated, the content of this document is licensed under `Creative Commons Attribution-ShareAlike 3.0 License `_ svgwrite-1.4.1/doc/make.bat000066400000000000000000000102511400026116000155260ustar00rootroot00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\svgwrite.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\svgwrite.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end svgwrite-1.4.1/doc/overview.rst000066400000000000000000000151071400026116000165260ustar00rootroot00000000000000Overview ======== As the name `svgwrite` implies, `svgwrite` creates new SVG drawings, it does not read/import existing drawings, but you can always include other SVG drawings by the `` entity. `svgwrite` has a debugging feature, activated by :code:`svgwrite.Drawing(debug=True)`. This feature is meant to find SVG errors produced by your code while developing. This validation algorithm is not optimized and therefore very slow for big SVG files. That will not change in the future. And because it is slow DON'T use it in production code! If `svgwrite` without debugging is still too slow, you have to use the `lxml` package without `svgwrite` as wrapper. That is the ugly truth since `svgwrite` is just a wrapper around `xml.etree.ElementTree`. If you learn the ElementTree API and the SVG elements and attributes, you do not need `svgwrite`. SVG Elements ------------ .. IMPORTANT:: Use the **factory-methods** of the class **Drawing** to create new objects. (This is necessary to support validation for different SVG versions.) All **factory-methods** have the original SVG Elementname (e.g. Drawing.a(...), Drawing.g(...), Drawing.symbol(...), Drawing.line(...)) a short example:: dwg = svgwrite.Drawing() link = dwg.add(dwg.a("http://link.to/internet")) square = link.add(dwg.rect((0, 0), (1, 1), fill='blue')) Structural Elements ~~~~~~~~~~~~~~~~~~~ :class:`~svgwrite.drawing.Drawing`, :class:`~svgwrite.container.SVG`, :class:`~svgwrite.container.Group`, :class:`~svgwrite.container.Defs`, :class:`~svgwrite.container.Symbol`, :class:`~svgwrite.container.Marker`, :class:`~svgwrite.container.Use`, :class:`~svgwrite.container.Hyperlink` Graphical Elements ~~~~~~~~~~~~~~~~~~ :class:`~svgwrite.shapes.Line`, :class:`~svgwrite.shapes.Rect`, :class:`~svgwrite.shapes.Circle`, :class:`~svgwrite.shapes.Ellipse`, :class:`~svgwrite.shapes.Polyline`, :class:`~svgwrite.shapes.Polygon`, :class:`~svgwrite.path.Path` Text Objects ~~~~~~~~~~~~ :class:`~svgwrite.text.Text`, :class:`~svgwrite.text.TSpan`, :class:`~svgwrite.text.TRef`, :class:`~svgwrite.text.TextPath`, :class:`~svgwrite.text.TextArea`, Paint Server ~~~~~~~~~~~~ :class:`~svgwrite.gradients.LinearGradient`, :class:`~svgwrite.gradients.RadialGradient`, :class:`~svgwrite.pattern.Pattern`, Masking ~~~~~~~ :class:`~svgwrite.masking.Mask`, :class:`~svgwrite.masking.ClipPath` Animation ~~~~~~~~~ :class:`~svgwrite.animate.Set`, :class:`~svgwrite.animate.Animate`, :class:`~svgwrite.animate.AnimateColor`, :class:`~svgwrite.animate.AnimateMotion`, :class:`~svgwrite.animate.AnimateTransform` Filter Effects ~~~~~~~~~~~~~~ :class:`~svgwrite.filters.Filter` Mixins ------ :class:`~svgwrite.mixins.ViewBox`, :class:`~svgwrite.mixins.Transform`, :class:`~svgwrite.mixins.XLink`, :class:`~svgwrite.mixins.Presentation`, :class:`~svgwrite.mixins.MediaGroup`, :class:`~svgwrite.mixins.Markers`, :class:`~svgwrite.mixins.Clipping`, Common Attributes ----------------- .. toctree:: :maxdepth: 1 attributes/core attributes/conditional_processing attributes/document_event attributes/graphical_event attributes/presentation attributes/xlink Basic Data Types ---------------- W3C: http://www.w3.org/TR/SVG11/types.html You can always use python-types (`int`, `float`) for length, coordinate or angle values, for length and coordinates the default unit is ``px``, for angles the default unit is ``deg``, or you can use a string including a unit (e.g. ``100in``, ``1.5cm``, ``3.141529rad``). Examples:: Drawing(height=100, width=100) # drawing area of 100px x 100px Drawing(height='10cm', width='20cm') # drawing area of 10cm x 20cm Numbers ------- Numbers can be intergers or floats, also in scientific notation: .. note:: *tiny profile*: numbers must **not** have more than 4 decimal digits in the fractional part of their decimal expansion and must be in the range -32,767.9999 to +32,767.9999, inclusive Examples: * 10, -23, 0 * 73.1234, -0.002, .154, -.897, +13.2, 0000.123 * 1.24E+2, 1.24e+2,1E0, -.0E-1 Angles ------ The unit identifier is optional. If not provided, the angle value is assumed to be in degrees. ==== ================ ======================== unit identifier description ==== ================ ======================== deg angle in degrees (full circle is 360deg) grad angle in grads (full circle is 400grad) rad angle in radians (full circle is 2*PI) ==== ================ ======================== Length ------ A ** is a distance measurement, given as a number along with a unit, the unit identifiers must be in lower case. The meaning of a percentage length value depends on the attribute for which the percentage length value has been specified. Two common cases are: 1. when a percentage length value represents a percentage of the viewport *width* or *height*, and 2. when a percentage length value represents a percentage of the bounding box *width* or *height* on a given object. Coordinates ----------- A ** is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for X coordinates, the y-axis for Y coordinates). Its syntax is the same as that for **. Units ----- W3C: http://www.w3.org/TR/SVG11/coords.html#Units When a coordinate or length value is a number without a unit identifier (e.g., "25"), then the given coordinate or length is assumed to be in user units (i.e., a value in the current user coordinate system). Absolute units identifiers are only recommended for the `width` and the `height` on and situations where the content contains no transformations and it is desirable to specify values relative to the device pixel grid or to a particular real world unit size. .. note:: *tiny profile*: no usage of units except for the *width* and *height* attributes of the Drawing object. ==== ====================== unit identifier description ==== ====================== px one px unit is defined to be equal to one user unit em font-size (actual font height) ex x-height (height of letter 'x' of actual font) pt point "1pt" equals "1.25px" (and therefore 1.25 user units) pc pica "1pc" equals "15px" (and therefore 15 user units) mm millimeter "1mm" would be "3.543307px" (3.543307 user units) cm centimeter "1cm" equals "35.43307px" (and therefore 35.43307 user units) in inch "1in" equals "90px" (and therefore 90 user units) ==== ====================== svgwrite-1.4.1/doc/reference.rst000066400000000000000000000022151400026116000166120ustar00rootroot00000000000000SVG References ============== * W3C (en): http://www.w3.org/Graphics/SVG/ * W3C SVG 1.1 (en): http://www.w3.org/TR/SVG11/ * W3C SVG Tiny 1.2 (en): http://www.w3.org/TR/SVGMobile12/ * W3C SVGMobile (1.1 tiny und basic) (de): http://www.schumacher-netz.de/TR/2003/REC-SVGMobile-20030114-de.html * SVG on Wikibooks (en): http://en.wikibooks.org/wiki/SVG * SVG on Wikibooks (de): http://de.wikibooks.org/wiki/Svg * SVG Authoring Guidelines: http://jwatt.org/svg/authoring/ by Jonathan Watt Additional SVG Documentation ============================ * O'Reilly commons: http://commons.oreilly.com/wiki/index.php/SVG_Essentials * SelfSVG (de): http://www.selfsvg.info SVG Implementation Status ========================= * Firefox: http://www.mozilla.org/projects/svg/status.html * Opera: - Elements: http://www.opera.com/docs/specs/opera95/svg/elements.xml - Attributes: http://www.opera.com/docs/specs/opera95/svg/attributes.xml - SVG-CSS: http://www.opera.com/docs/specs/opera95/svg/cssproperties.xml - SVG-DOM: http://www.opera.com/docs/specs/opera95/svg/dominterfaces.xml * Webkit: http://webkit.org/projects/svg/status.xml svgwrite-1.4.1/doc/svgwrite.rst000066400000000000000000000000761400026116000165310ustar00rootroot00000000000000svgwrite module =============== .. automodule:: svgwrite svgwrite-1.4.1/doc/utils/000077500000000000000000000000001400026116000152625ustar00rootroot00000000000000svgwrite-1.4.1/doc/utils/utils.rst000066400000000000000000000000761400026116000171570ustar00rootroot00000000000000utils module ============ .. automodule:: svgwrite.utils svgwrite-1.4.1/examples/000077500000000000000000000000001400026116000151735ustar00rootroot00000000000000svgwrite-1.4.1/examples/LSystem.py000066400000000000000000000072621400026116000171540ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 08.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import math import svgwrite LevyDragon = {'length':1, 'numAngle':4, 'level':16, 'init': 'FX', 'target': 'X', 'replacement': 'X+YF+', 'target2': 'Y', 'replacement2': '-FX-Y'} KochSnowflake = {'length':1, 'numAngle':6, 'level':6, 'init': 'F++F++F', 'target': 'F', 'replacement': 'F-F++F-F', 'target2': '', 'replacement2': ''} LevyCurve = {'length':1, 'numAngle':8, 'level':17, 'init': 'F', 'target': 'F', 'replacement': '+F--F+', 'target2': '', 'replacement2': ''} HilbertSpaceFillingCurve = {'length':1, 'numAngle':4, 'level':5, 'init': 'L', 'target': 'L', 'replacement': '+RF-LFL-FR+', 'target2': 'R', 'replacement2': '-LF+RFR+FL-'} def LSystem(name, formula=LevyCurve): ## {{{ http://code.activestate.com/recipes/577159/ (r1) # L-System Fractals # FB - 201003276 # image size # generate the fractal drawing string def _LSystem(formula): state = formula['init'] target = formula['target'] replacement = formula['replacement'] target2 = formula['target2'] replacement2 = formula['replacement2'] level = formula['level'] for counter in range(level): state2 = '' for character in state: if character == target: state2 += replacement elif character == target2: state2 += replacement2 else: state2 += character state = state2 return state print("creating: %s\n" % name) xmin, ymin = (100000, 100000) xmax, ymax = (-100000, -100000) numAngle = formula['numAngle'] length = formula['length'] fractal = _LSystem(formula) na = 2 * math.pi / numAngle sn = [] cs = [] for i in range(numAngle): sn.append(math.sin(na * i)) cs.append(math.cos(na * i)) x = 0.0 y = 0.0 # jx = int((x - xa) / (xb - xa) * (imgx - 1)) # jy = int((y - ya) / (yb - ya) * (imgy - 1)) k = 0 dwg = svgwrite.Drawing(name, debug=True) curve = dwg.polyline(points=[(x, y)], stroke='green', fill='none', stroke_width=0.1) for ch in fractal: if ch == 'F': # turtle forward(length) x += length * cs[k] y += length * sn[k] curve.points.append( (x, y) ) # find maxima xmin = min(xmin, x) xmax = max(xmax, x) ymin = min(ymin, y) ymax = max(ymax, y) elif ch == '+': # turtle right(angle) k = (k + 1) % numAngle elif ch == '-': # turtle left(angle) k = ((k - 1) + numAngle) % numAngle print("L-System with %d segements.\n" % (len(curve.points)-1)) dwg.viewbox(xmin, ymin, xmax-xmin, ymax-ymin) dwg.add(curve) dwg.save() ## end of http://code.activestate.com/recipes/577159/ }}} if __name__ == '__main__': LSystem('lsys_hilbertspacefillingcurve.svg', formula=HilbertSpaceFillingCurve) LSystem('lsys_levydragon.svg', formula=LevyDragon) LSystem('lsys_levycurve.svg', formula=LevyCurve) LSystem('lsys_kochsnowflake.svg', formula=KochSnowflake) svgwrite-1.4.1/examples/basic_shapes.py000066400000000000000000000031501400026116000201700ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 07.11.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite from svgwrite import cm, mm def basic_shapes(name): dwg = svgwrite.Drawing(filename=name, debug=True) hlines = dwg.add(dwg.g(id='hlines', stroke='green')) for y in range(20): hlines.add(dwg.line(start=(2*cm, (2+y)*cm), end=(18*cm, (2+y)*cm))) vlines = dwg.add(dwg.g(id='vline', stroke='blue')) for x in range(17): vlines.add(dwg.line(start=((2+x)*cm, 2*cm), end=((2+x)*cm, 21*cm))) shapes = dwg.add(dwg.g(id='shapes', fill='red')) # set presentation attributes at object creation as SVG-Attributes circle = dwg.circle(center=(15*cm, 8*cm), r='2.5cm', stroke='blue', stroke_width=3) circle['class'] = 'class1 class2' shapes.add(circle) # override the 'fill' attribute of the parent group 'shapes' shapes.add(dwg.rect(insert=(5*cm, 5*cm), size=(45*mm, 45*mm), fill='blue', stroke='red', stroke_width=3)) # or set presentation attributes by helper functions of the Presentation-Mixin ellipse = shapes.add(dwg.ellipse(center=(10*cm, 15*cm), r=('5cm', '10mm'))) ellipse.fill('green', opacity=0.5).stroke('black', width=5).dasharray([20, 20]) dwg.save() if __name__ == '__main__': basic_shapes('basic_shapes.svg') svgwrite-1.4.1/examples/basic_shapes.svg000066400000000000000000000045011400026116000203400ustar00rootroot00000000000000 svgwrite-1.4.1/examples/checkerboard.py000066400000000000000000000041571400026116000201700ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg example: inline stylesheets, css, viewbox, groups # Created: 09.06.2012 # Copyright (C) 2012, Manfred Moitzi # License: MIT License import sys from pathlib import Path try: import svgwrite except ImportError: sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite if svgwrite.version < (1,0,1): print("This script requires svgwrite 1.0.1 or newer for internal stylesheets.") sys.exit() BOARD_WIDTH = "10cm" BOARD_HEIGHT = "10cm" BOARD_SIZE = (BOARD_WIDTH, BOARD_HEIGHT) CSS_STYLES = """ .background { fill: lavenderblush; } .line { stroke: firebrick; stroke-width: .1mm; } .blacksquare { fill: indigo; } .whitesquare { fill: hotpink; } """ def draw_board(dwg): def group(classname): return dwg.add(dwg.g(class_=classname)) # setup element groups lines = group("line") white_squares = group("whitesquare") black_squares = group("blacksquare") # draw lines for i in range(9): y = i * 10 lines.add(dwg.line(start=(0, y), end=(80, y))) x = i * 10 lines.add(dwg.line(start=(x, 0), end=(x, 80))) # draw squares for x in range(8): for y in range(8): xc = x * 10 + 1 yc = y * 10 + 1 square = dwg.rect(insert=(xc, yc), size=(8, 8)) (white_squares if (x+y) % 2 else black_squares).add(square) def main(): dwg = svgwrite.Drawing('checkerboard.svg', size=BOARD_SIZE) dwg.viewbox(0, 0, 80, 80) # checkerboard has a size of 10cm x 10cm; # defining a viewbox with the size of 80x80 means, that a length of 1 # is 10cm/80 == 0.125cm (which is for now the famous USER UNIT) # but I don't have to care about it, I just draw 8x8 squares, each 10x10 USER-UNITS # always use css for styling dwg.defs.add(dwg.style(CSS_STYLES)) # set background dwg.add(dwg.rect(size=('100%','100%'), class_='background')) draw_board(dwg) dwg.save() if __name__== '__main__': main() svgwrite-1.4.1/examples/clickable_image.py000066400000000000000000000014641400026116000206250ustar00rootroot00000000000000#!/usr/bin/env python3 import svgwrite MAX_PIXELS = 1000 def clickable_image(dwg, image_href, dest_href, insert=None, size=None): insert = insert or ("0%", "0%") size = size or ("100%", "100%") dwg.add(dwg.a(href=dest_href)).add(dwg.image(image_href, insert=insert, size=size)) def make_drawing(filename="clickable_image.svg"): dwg = svgwrite.Drawing(filename, size=(MAX_PIXELS, MAX_PIXELS)) dwg.viewbox(0, 0, MAX_PIXELS, MAX_PIXELS) dwg.add(dwg.rect(size=('100%', '100%'), fill="lightgrey", class_='background')) clickable_image(dwg, image_href="https://github.com/fluidicon.png", dest_href="https://github.com/mozman/svgwrite", insert=("25%", "25%"), size=("50%", "50%")) return dwg make_drawing().save(pretty=True) svgwrite-1.4.1/examples/defs_test.py000066400000000000000000000060721400026116000175320ustar00rootroot00000000000000# Author: mozman # Purpose: svg examples # Copyright (C) 2010, Manfred Moitzi # License: MIT License import svgwrite PROGNAME = 'defs_test' STYLESHEET = PROGNAME + '.css' STYLES = """.red { fill: red; stroke=none; } .green { fill: green; stroke: none; } .blue { fill: blue; stroke: yellow; stroke-width: 5; } .yellow { fill: yellow; stroke: none; } .text { font-family: serif; fill: white; } """ def create_svg(name): svg_size_width = 900 svg_size_height = 900 font_size = 20 triangle_size = 50 title1 = name + ': Example of creating your own colors and defs/use.' dwg = svgwrite.Drawing(name, (svg_size_width, svg_size_height), debug=True) # To separate structure from visual presentation, better use stylesheets # inline stylesheets requires svgwrite version >= 1.0.1 # available at http://bitbucket.org/mozman/svgwrite if svgwrite.version >= (1, 0, 1): dwg.defs.add(dwg.style(STYLES)) else: # or use an external stylesheet with open(STYLESHEET, 'w') as f: f.write(STYLES) dwg.add_stylesheet(STYLESHEET, 'noname') # Background will be dark but not black so the background does not overwhelm the colors. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='grey')) # http://www.w3.org/TR/SVG11/struct.html#Head # "sometimes it is desired to define a graphical object and prevent it from being directly # rendered. it is only there to be referenced elsewhere. To do this, and to allow convenient # grouping defined content, SVG provides the 'defs' element." # 1. create template polygons half_size = triangle_size / 2 points = [ (-half_size, -half_size), (half_size, -half_size), (0, triangle_size * 0.433013) ] # 2. create the symbol symbol_without_fill = dwg.symbol(id='symbol_without_fill') # 3. add symbols to the defs section dwg.defs.add(symbol_without_fill) # 4. important: define viewbox of the symbol! symbol_without_fill.viewbox(-half_size, -half_size, triangle_size, triangle_size) # and define how the symbol should behave on resizing by # default parameters for fit(horiz="center", vert="middle", scale="meet") # seems not necessary # symbol_without_fill.fit() # 5. add triangles to the symbol containers symbol_without_fill.add(dwg.polygon(points)) # 6. use symbols - param size is necessary - and only unset params can be overwritten dwg.add(dwg.use(symbol_without_fill, insert=(200, 200), size=(triangle_size, triangle_size), class_='yellow')) dwg.add(dwg.use(symbol_without_fill, insert=(300, 300), size=(triangle_size*1.2, triangle_size*1.2), class_ ='red')) dwg.add(dwg.use(symbol_without_fill, insert=(400, 400), size=(triangle_size*0.5, triangle_size*0.5), class_ ='blue')) # Give the name of the example and a title. y = font_size + 5 dwg.add(dwg.text(title1, insert=(0, y), class_='text', font_size=font_size)) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/fePointLight.py000066400000000000000000000021201400026116000201340ustar00rootroot00000000000000# Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite dwg = svgwrite.Drawing("fePointLight.svg") filtr = dwg.defs.add( dwg.filter(id="DL", start=(0, 0), size=(500, 500), filterUnits="userSpaceOnUse")) diffuse_lighting = filtr.feDiffuseLighting( start=(0, 0), size=(500, 500), surfaceScale=10, diffuseConstant=1, kernelUnitLength=1, lighting_color="#f8f") point_light = diffuse_lighting.fePointLight( (500, 250, 250) ) point_light.add( dwg.animate('x', values=(0,100,500,100,0), dur='30s', repeatDur='indefinite')) point_light.add( dwg.animate('y', values=(0,500,400,-100,0), dur='31s', repeatDur='indefinite')) point_light.add( dwg.animate('z', values=(0,1000,500,-100,0), dur='37s', repeatDur='indefinite')) dwg.save() svgwrite-1.4.1/examples/fonts/000077500000000000000000000000001400026116000163245ustar00rootroot00000000000000svgwrite-1.4.1/examples/fonts/IndieFlower.ttf000066400000000000000000001701641400026116000212630ustar00rootroot00000000000000DSIGlFFTM[p(GDEF$D(OS/25r`cmapcvt ! 4fpgm7 sgasp glyf܃head8x76hheakT$hmtxclocaπ Hmaxp}x name(7postWprep} Bґ_<ɘɘz Z wzZff (3/PJ @  vK   S   i)  -= F I4 WC@I!c#ppQSI #I  2 wz {cP    y x$E#z"%&"0 2DD @@@@@@pppppp4pIIII2]!X%@@@TI!wzI!wzI!wzI!wz?c{c{ccUc {ppppppeQcQcQcSP S IIIIII(  IIIp241V^      & iii ^J^ks-= w&t5Q 8 ~%)17Ie~    " & : D !"" '+49Lh    & 9 D !""=%yi[<9874"=N a   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aWrdeiYxpk_vjsgwl|cn8m}Zb OPTUQR1]^[\bcXySV?EqABCzFD@,K PXY _^-, EiD`-,*!-, F%FRX#Y Id F had%F hadRX#eY/ SXi TX!@Yi TX!@eYY:-, F%FRX#Y F jad%F jadRX#Y/-,K &PXQXD@DY!! EPXD!YY-, EiD` E}iD`-,*-,K &SX@Y &SX#!#Y &SX#!#Y &SX#!#Y &SX#!@#Y &SX%EPX#!#!%E#!#!Y!YD- ,KSXED!!Y-++ E}iDlFT\@$PV  ` < l F * xjp&>PZ68l8Vr,4 J !J!":"##$$$ $%*%&&N&'''(J(v()V)z)*** *<**++J+V+b+,,,0,<,H,T,`,l,x-6.&.......////////00V0001111t1112222334 44"4.4t455^556666(646B6666667b7n7z7778B888889999*969B9:f:r:~::::;N;;;;;;<<<<&<2<> >z>>>?&?2?>?J?V?b?n?z????@.@:@F@R@^@j@v@@@@@@@AjB BB$B0BDJDVDbDnDzDDEtEEEEEEEEEEEFhFtFG GGGGH,HTHrHHI I8IDIPI\IhItIIIIIJ J0JRJJK(KL$LFLLM6MbN&NNOOP8PQL/747632#"&7.6454'7#"&   1 1   Ykuk,.:LRSH7    2 4.=676732432#".'>32#".        $"832&&8C;*"/880  2>90 %#".4.#"#+"&5465>7>='"&*#"#"&54>=4>332>54.'&5463:3;22#".'".+>2326+".+"##"./7476454&4&5.+"  (,( 2]1  !B?; ,CMC,          # !    VVCV  B   $%#    )+! C  - #)$`  A{%#".6'.7>3232>5<5.5465>7>732634&6763'#"&#&'.732>54&'6&"74>5'>'45"#"'7>5454.#"$ %25+ &(( & F)      5/!oe   M .4-         s   n"#)&   $,$#6C>4  $#0 42*    *&  (F' ,1:(iq "-78J #064TBFD5+@J@,t ").+ "&     rq4J_s74>32#"&74>32#".332>7654.#"4>7632#".7>54.#"2CFF9*662$(%  #''-9%1 )!   (m"1'&1-$:  ($ H[gf^H+ (AAH. 6DK>Q.--!%->3 " !/4M4) !-2& *    g}74>7<54>54>763>45>326'#/+"#*.#.77>54.' $.,  "       U $   9 ,'  L3WQQ. 4;3  " 3/1##"" /)')+& d %)"#$+3.#X<>7#".4     '/-&  -60!T-74>7632#".#"&#".4DJ&("    "D>4&!8I)/G. VYUC $54.'.54632#". 07/ %1  5-$ &179  /:DK(&D?7 0>@>JSUC* q"#".454>5"#".'&7>32;27>54.7>7;7;&>32>7>+.'&'.   "` $(*(&        9 /        , )+"P7"#"'&5467>7>454.'&=>7325321;2++".56'.''&&).)& .1           !%  >c 4>5<&45&54632#".   022  &' '26, ZG2#"&#"#4>703262 %9:9$-0.G  -74>32#".-   ` ! & ! +74>7>7#"&   ),.'  "),' *(" Okw[8.$/EX/>Yи*0174>32#".732>7>54.#"%;J%-*$,B,.P0  !>0+3/\<7<&454>5<&'&'#"=>?>32#"&         &/4/%  ! ## 5PegbL/  ,H%"#".'&>3232>54.#".54>32#".$C%+%  -+,$ &#2   "  ++* ! -96/ 64'%" #*>F4(&)  S7&=463232>54.5465>7>54.""&54>;2#.1E/$*AL@+ (/0(!&%  '!7+ +5-6F}$,$*6#    !* &2"-2i=%'".54>7>32>7632#".4./#&''5!   $"7-!   +AH!425"  6792*!1:224300/!2:2!-h7&>32>54.'.5457>7>764&5#4>326#".#"."#*#". (0* !D7"2@ED",,&00*  7gR0#;J!=?=/%(0   3&*:&  )/)   )*' &>[@&?/  0f4F74>76#".'&'#">3232#".72>54.#",>IQ*  151( 'B0*CR).A*1 G68.")$D4'YVP?)   %/31/A(.A(%< ,"*$ )$B7>5"&#&>2707>7>&'&.77:#".#*#"&!H $)% 584# ALN $"   / 7b7  $'+ ,T*   dJ2J_76767=<5.7&>762#".732>54.'"'"#">5>.'"1 # "&,& " & 6(P;D$/ '0  $ !   !$" *(&  &6 $=P/$ 7.$ #"  *g4//2014>32#".64&'.73267>54.#" &6"3'  $E6!9      2/!;-$2)_`[I2 *?KA+ 89% 02) =LLZ 74632#'46325#".     d      Dj'4>76&>7#".6&6".   #  !+&* " +499. "   97>7>73#".'.7M.894   &-)10.$)% 44'  (6?>6# (($   !$    37463>326!".%"'"&5>3:0'".+A<=&89/& 2KsY )=INN$'$      17>76'.'4&547632#"&#3?<55;<2"  4y:  .=E;)" %+**$  '  ".1*t B74632#"&4>54&#".654>322&#".i 83 !&9''+% ($& k8667: 43  3?!&ROI   '!.'4>32#".'#".54>32.#"32>767.4>7627>56.'32>3R^61ER^4 HKH@5 $ (-1$9($A[6<:,  &0-E. ()'   ( $=PUS >v\7 9O_h8%GFF$ 6O[a"e]/`XM8!!,15,--;<9,  %/N') $ $  4A@8ZH5'?_w>5pj]G( $ Th%4>54&'.#*.7.'&/54>7<545>32#"&2>74.#";;< ')      0J8,G7)    #0?')8###$@  ;8  #7AD   *_[T@&*G]hj`P   : KPL<$+EVVL@h%.7>'.#"1+""#54>32".'3272>54.54>54.#"4 % $7B=0275* '=F=(%:GB33: "00 :,3MZN2#($%+<  w|@    ,# "2=G(*8!  (#1A.  " 3z}x=4>7632#4>54&#"#"#32>32"#"..?L***   .XD( 7)"CCC"  !5)(WVN<$ "!  ;M]5"QE.   1+9>>W7463232>54.'#.'.'"#"5&#.=4>32"'. )0. ,ZJ//?FH!   HV3 +4-3tqgO/"  !762>37632>;3"#".'&54654&=>754>7/^0BJ@5P]Q "DCC" *@LF2(=)  1U>@X  09   ()) !*&L'    ufb7.4.'."'&5463>765&6&'&*"#"##'#.'5>".#".:36'."& " $F`rsnV =>?"(*$  K]( 9fG $% 1G.  470  -3'&!<W%"&#"#".54>76".#"32>54'&'#".546232632#".;:;*D0&@SZZ'%$PME5*2,]L0  #D$    -  4G*,RI=-  (7BL(,61     $'h..54>54.5<5>32;>?4>32#.'&'4.'l #.2-%     (545<&456'E)G=:   +8:7  5   %-;C"  =<9+)1,w3UacO3:;/XG%.'#".465.54>32>&28<6*       #*/0010 GN**(    !&((&142((>JB2 FHF  ,34.68,44'C< R$%7>763""#".    .M6#YYS>(BTXW$  %?rM%.'&6.'#"'"#"&'54654.54323>766"#"& $H(;;   "!+ (5!      ,6=7+  H   BB *4*-5-&E'3ded2 U$I74>7654&=>76;72>54.54632#".#"#".    &4DT4/$! 3G+/K;-    =/^]./.0$dhgQ1%2'C>>$$8ED:+G5$9@9$ 7T.&>767".72>5.'&2$$+KiB >T00(>iK+/)BR).67-/DPN""' ,L; 6TpF454.#"&+"'.54>32'4   =4#*BPMB '$  #(%"[a_J";JF8  OVL 98 / 1&  #3$#0"9-! #D# &.r%"#+.=4>32".7:>5.72232>54.'&'.#"##"'"./6."U2!QSO=%' % '%%'+"@*(.  ""  (&    %51"* (Ni<0\H, 7GMM"-%  )& /O8($ $/ !)'-,7  +6>6Z7.476>54'5.#"".54>7>32.     7@C6#:AH)B7$    1,->@9-$3>'4.'%.54>32.". .Q44<A<* )=G,21& "&<9)&AQSO;! 4PbhfT< AK(  !%&0  ! -)%'*29H4 /?r1$ /EX(/(>Y и01"&'.5:#."#".'.32">=.5>#".'&#"#".   %4%J@-  #),.+@. %'  DIH;(-; *8.0 .-5I)HHD3! )BUWQ04632>6"&#.'&'.   ""   ,;;&494',AMOI8%C\abP8 17 6CJC5 M%*+#".5<6763232>7>&'>32>54.56#".L,6 &7%   !  +>)/%   7G&9-!t(,+DWVL%*&74.5463>7>'.'#""&'9>  'F:$'" GE@ +1..*,  %RSL')+)' $*'<: 29<?@;*697##%( 87<54>74656.72>733>74>#"&  '8B7! #*/3 $(  +C@C* !2BR2241'(/   7c^]bj< 8zn74>=&'&'*&"#"#467>74.#"#"&'54>32#".#"32>7632#*&"#.$ 9 !;0'#6@*&!#01.ZE*#'9,$$GE#$" @CH,*)   /'$1  *H7  &:D   '-`5467>;##3263:231."#"&'.5&4.5.'.'&= ,jno0*]_])  :s:  UZ**  @ &  %)% k !&!+30(    -!%.'.54632'.Q (161'  #8FJF7! W 2>E?2  *+%3#!"&B3?A5"'5=7)#) /2~u*   #2 G]knk\H 2H!&'>7>32#".+'!(  z/ *$    !j%74632323:32#".$I$ '-'%+%  O^hdZE)W   8#".'.6X " $  V7>45'4.#"#"5&'.54>3"./.'"32>3:23#".&:Oe>/6   (I=. 43,),-#&68654 (1-'*^N3,*!  6+  )>QW,.(/:!  !!  %B );.676772632#".'.67674.#"  #DC?/-F)*$2B*  _ ;ML (354!#,>(  8GM@ #.<$.7,:EK&1;2,@) !," &0(/EX,/,>Yи,0174>32#4&#"6722"#".";N,-( 42&<(4DLL# &%:]A$,S@& !/? 4A".<%  7U0D(//EX,/,>Y6иA0174>326.67#".#"#".732>5<5.)?.037 '   3=C"&9'>   H>(5YF4"%RF-#(URI:&I`mpjY? 1%2FN $6"%:E 4- 4@;4>3#*.54>2>54.7#".;U8!1*@J  57( ##9( 7T>176:fN- 4_H+)$:''' 3>"42.# &EcI2&'#".'.'&/+"&54>7.>32#".#"R ,B'#*$  "%  +B0@7$"&"8('A>  &B<8  (+(  RXUD*,7%2> z w@U&>32>54.#"#".54>3#".32>5&'4.#"  %;FB #  6'#=S/$-  "1 ION>& 35 !8' *"*552+8<4  &4,\L0 Gh4?BA3 &1=!(<"#%7AC%>54.#"#.'.'54>3>H"3#      4UB1  886 :+   IOJ  &HfzH'!2E2" " @PZTG+ h'<645&32#".4636#".?   3  Z 4a_`4-ETM=   5U+8.'4&>732>56.'&'64>34676.0XF.  *6"    "  5 <6<&45.'6232>323"#".'&#"#"&2  "$))-88  95    .gfb)8SV&&%+$ $*.+($!$_J //017.46'4632&)     GF u8k%464574>5.#"#".#"#".'6.5<645>732>32232>32#".4,;3 -#*   /&(,."5*   #  DB0+ *AJA*&0(M' )F?@$    !/;?> 13' 2 /-// #01463232>32#".56.#"".4 (/5"9-     (:!6(  &  #:HKG $$Mf<&6@??@ .HZWM($/EX/>Yи$0174>32#".73>.'"0Na1-)  (DV-.M9 1)8 11-B:!G:&7R8!+./3P74M79*)1551&:dK74>32#".5232>54.#"1#".,Ia5+Q@&4?! C8$'(5/"0<(,%   ?V42H.(3 ,( "2!  %%CS\SB%?RXVJ6'?%#".54>32#".#'3267>74.#"1E,P*2aL.(,WWX+ 2@B@27*  GJJ#.DMZ53.'4&>732432;>32.n  &'( +/2. (^`[%     85554 E7>3232>56.'&'>.67.".   "<6&!8FJG83GPC-   &29/#8IMH:" 1:4;=>5*y   ! , +."   ! 3)- * K}/#*// /и и"01*.54637>.'4>326&.6(+#g  V "%$X %/)-$   6JTG2!AWUH? /01%#".5&>32>5464&5>32#".!") $:-! $/.)     %!5CGE6=9>=0#14 .4. 2:6)2/'   ~'EX!/!>Y01>32;>7>'". "    #((%d  )4;969:>$  2DJ=(+DQPC E%.6732>574>323>.'&>3.Z(QIA/  /+  &%, %$%,8%`6+0H[^Y#  " ',+# ($9@90;;6->LJ@ >.'"&54>54&5.'&'&>3>#"&.02%,-  -*)264,(2/' 98/  445/% 3-'*/ (,* #,- $"! 4;>  Q<67633>7>.#"#".54&>3232>7674.5>"../3!2CHH  " 3BDB3 '.)=,hwJ$*.b74>7'".454>723>7>54.+"#"&54>322>#2>7#".V  081    } &,,% 1" k"340 ,65- )'D*)%    ,  !#"  i74>5<&45&'&+"*#"&54545>7.54>32#".#;>3#.B 060 47/  .,$(=*3O]*! +G7' (453 "3<3" ")%G&$,+# $8&H%5,%)0   !->I$-P<#3C(-# #5+&,3" $ 5A)7.5&6.'&'&54754632+.L    (.*.OMN."&&$  GJ .'&'4>323>54.'.54654.546?>454.#"'2#"&54>3:323:7#D>   'L;%  ,' .6   %*!&% )-5-  !% &+&# & :M&   -C(.12/& !$,   # ("  $0 3-'&(  !%$ <@C&2J4}+).'&&'&>76367>57#)%$  '  =   !"+  0 G=&BV&6'.54>7'&5&>#4&'6722+..5&754&'gg3D('! $$!A/9 (!3$3np(M?)& "  (:(JO,+4   (7&  4$=; #2= z74>32>54&'&+"+.'5>7>73>32#".#"32#"'&'#*+"6#"&#"#".  ! "" ##$#($ #+?-8+  %(9(     (2=:15$E$,)+)!W  9CC   -774)%4 *=%  (4<@   " K BS%.'#"''&54767.5467.'&>3>32>#*3>.'"%27L6!  !"(e43%%0', )8 )Q<JJ!G;&)$# ?& 8"  &B8T&& 7+$?37'"&5&>7>32;>7676#'2'7'".#F  4H%  !0( V# 'F FN  E )b  +5<;7;= $1 >  WJ !.'.4?6=4&54632S     'h{B.C=B/!!A"@ 8:$Oe%.'&7>7.'>'&'.#".'&'>32>54.532>54.;@?:, 4$ (+?LMH!!2::-":HLI9" " 1:&WP"$(*0!<6&*;O3 #.8 ;6'* $&!+ 91 +!+ "3)2(-/       EL(4>7632#".74>32#".E              #84c&>76".72>56.'&>72#4'&#>2#.#*298j^N6);GIE>iL+0)BS(7CH<%'G[]**% Y$;+-( 2&)%08>" ** 8M4A@:.-H]o?"3% )IgC.O=& '?fM5  *.-(+!?7-!/ $*.'+  ;GD 1":u7>7>73#".'&/.7%>767673#"&/&'&/.7M.894   &-)10.$)% 44'  /?>6# 8-894 ',)01.$*% 35'   0?=6# (($   !$     '($   "$    "`.54>3%.6?60+73263 %9:9$-0.G  %J&>76".72>7.''.547>6>?.#"".54767>32'&'>56.'&%*378j]N6)hL+0(B**( ).10+  ++! $,$ !B:&/91 .!"1 )(F\\**1"&A@;--H\o?"4$ )IgC.N=  "%$ . 1?> (   (# "% >gM5 ;EC"*)2#"&#"#4>726!&$!$*6)  # 6GRI*^%26#".#"#&>7&65.'#"#"&54767>767>&54.=>7372;2+26(31% &*' 999 0C# &&&). & .1   o  !$       -G"x&[G!'q 2 4>767"& -%32>5464&5>32#. #3'+8$ 5$/.)    $" 6=9>=0#14 .4. 2:6)2/' &5 5.>4'&'&'#".>&'&.54>326J /+$&5"$?3$ R[]N.]XN>( )?I@*$!!;. P]c[K0 2*74>32#".2      .>323:>56.'>#".  #&$  .6.&/& +#   ,+$ #oG+*z6GRI*y1a7>76'.'4&547632#"&7>'.'4&547632#"&#3?<55;<2"  4y:  .=E;)9OT=5;<1#  4<=:  -=E;)" %+**$  '  ".1*' -6;5(     "-1*Mg ** )g.AHG).V'/"g/&3@g1AG(p/Q *g !)Dg.AG8&f*T%G".$&$C|$&$v$&$?>$&$E;r$&$jG$ey4>32#"&54>54&'.#*.7.'&/54>75>767&'&2>74.#"3>&'&'"!'#7)  ;;< ')      0%   #0?')8#f  O!   H]hj`P   ##$@  ;8  #7AD  *_[T@  KPL<$+EVVL   "'2>762>23632>;3+"'&'#"&54>76=4&'.#*.7.'&/54>75>3254>7/2>74.#"60BK?5P]R8"DDC" *@ME!(  ;;< ')      0J8,G7)2U}X  0G  #0?')8#<  '#  ## @  ;8  #7AD  *_[T@&*G]4_   KPL<$+EVVLl>32:>56.'67&'.54>7632#4>54&#"#"#32>32"#"'#".   $%$).?L***   .XD( 7)"CCC"  -6.'& +# +9>>(WVN<$ "!  ;M]5"QE.   1   ,+$#+&(C(&(v&(?P&(j@&,C&,v&,?&,jP}2#"&#"#.4'#4>767.'"#"5&#&/.=4>32"'.'&5463232>54.'26726!%!  8 HV3 +4-3tqgO/"sT&2jo4<aL;%.'".5>54&5.'&>3>     # #' B "     T6K[46767&'.5&>7677>7"'#"&72>5./''&'& "&*2$$+=8  7+5B >T00(,( .67-/D(-)"v '""' F* %g?,L; >*)! O6 "*pF467674.#"u#DC?/-F)*$ &)$ 7C ;ML (354!#c 2>C6 #.<$.7 .997*k,@) !," &!wJN.7>.>2#".722>54.54>54.#"" .&265* (=E=($;II!";@?33MZM3#)#%+< -horohZH0 ,# "2=G(' 1A.  " &DC^&Dv&D?F&DE1&Dj>xkz4>32"./.'"32>;2;#".5>45'4.#"#"5&'.54>?&'&73>.'" (  $=. 43,),-#&68654 (1-'*^N3&:Oe>/6     C!  !>QW,.(/:!  !!  %B4,*!  6+ %   |p7>45'4.#"#"5&'.54>367>3#".54>2>54.7#"&/#".%.'"32>;2&'&'&&:Oe>/6   (I=U8!0 +@%&  67( ##9) 7T>077:f'  (1-'*^N33,),-#&68654  ,*!  6+  )>), $*)6$:& && 3?! " $ %#   %BE!  !! _>3232>56.'67&'.54>32#4&#"6722+"'#".  #&$" $";N,-( 42&<(4DLL# &%-&.6.&/& ," T;,S@& !/? 4A".<%     ,,$ #&HCp&Hv&H?K&Hj*kb.546=&32#".#".'.6?     "Z   4a_`4-ETM=    %546=&32#".'4>7"&?   J ,/&<  Z   4a_`4-ETM=&" &2! 9546=&32#".&'>7>32".?   *( (   Z   4a_`4-ETM=+/ *$    !V-A546=&32#".74>32#".'4>32#".?   /        Z   4a_`4-ETM=       Qd##".54>3254&'.7>.'&+#".54>>6.#"3>  '>+&M>(-?$%   $$  0*.0@!'!+3E 698$E6!$:*#;+1          $  &'5&QEW8&RCl&Rv:&R?4+&RE7&Rj1%L.Z'F`@53HU7&767&'&74>3267>7#&'&'#"&7>'&'&''?&'"90Na1  ! (DV-.'  11- " z !G:& $&07R8   +./3P7+)15'''%! 9 &:&XCq{&Xv&X?Dq&Xj V &\v}@ +E7464>76?>#".'..>732>54.#"%1 X`^J04?!@B@  E:825/"0<(,% 5BI>  -N:(5  +B=>'6sfS?) "2" Y&\j#>$&$qXj&DqQr$&$A&DA|o> cw.'&7>76747>54&'.#*.7.'&/54>75>32#"'72>74.#"04Q1;;< ')      0J8,G7)  (&<  #0?')8#- #$@  ;8  #7AD  *_[T@&*G]hj`P  &  KPL<$+EVVLc.'&7#".5>45'4.#"#"5&'.54>3"./.'"32>;2;74Q1 *^N3&:Oe>/6   (I=. 43,),-#&68654  NQW,.(/:!  !!  &D&&v&Fvn&&?K&F?)!&&B2&FBB&&@un&F@(&'@C&GRr7463232>54.'2#"'&'#.'&'#4>7'&'.'"#"5&#&/.=4>32"'. )0. ,ZJ//?FH!    !$*   HV3 +4-3tqgO/"  !326&'&'#4>;&'.6732>5<5.!    3=C"&9')?.037 :$.    H>(5YF4"_ 7ojY? 1%2FN%RF-#(U(%:&$%.r$6"%:E 4- 4@&(q]&Hq\u"&(A!&HA&(B&HBxoys.767"+".'&54654&=>754>7/"'>762>37632>;3#74P1  " (=)  1U>@X  00BJ@5P]Q "DCC" * =)N<4-!*&L'       ())  0&rJ.767&'.54>3#*.54>2>54.774P1 +'3N-;U8!1*@J  57( ##9( 7T>1&N<4-Ec>4_H+)$:''' 3>"42.#  &&(@N&H@JP!<+&*?>z w&J?!<&*Az w5&JAD4!<&*BYz w2&JBd!<&*az w&JQ&+?L3&K?*F]2#"'&'>'>54.#"#.'&'#4>3&'.'54>36Z!4UB1  "3#     $*  <  " @PZTG+886 :+   IOJ &HfzD47# !2E&,E2B546=&32#".7.'&&'&>362?657?   )&$ %   > Z   4a_`4-ETM=  !"+  0 i0546=&32#".2#"&#"#4>3726?   ?!%% $*Z   4a_`4-ETM=  # &,Al1546=&32#".2#"&=>'?   g$&2 " Z   4a_`4-ETM=  -&o61.'&7>767&'.'&'.56'"#74Q1   ((&<- #((R(*$29:7U`fZF  & lh-<.7>76767&'.=46=&32#"'74636#".4Q0     -O;  4-"TM<    4a_`4&   &,B?546=&32#".?   Z   4a_`4-ETM=&-?5+M.'4&>732>56.'&'64>3&'>7>32#".0XF.  *6"    "B+( (   5 7#""#".'&5'D  2    -L6  $MJ@.1Qc1     #0:W(7.5'&'7>'46327#&3 &i   1  >z= JCB  2U&#QkA U&1v&QvtU$&1a&QaJU&1@zn&Q@-&QaT&2q)&RqST&2A]&RAc\T&2FB&RFZUbv"'>2>36326;+"&'".5&>754>7#'2>5.1BJ@,2ADB5" DD *AME 5I +(>iK+2H+&<, 2U~Z  08)BR)! -   .O=&);$J\1  #(,rXq74>3267>3#*.54>2>54.7#"&'&'#".%47&'&'"3>767&0Na1-V7!1 +@J    66)$#:( 7*+>077:g'"V-.M9 ~ :!G:&)8 11-7R8&$+)5$:''' 3 -#  &"#4MK&:&9*) 67&5vZ&Uvjk6&5aZ&Ua6E&5@gZn&U@g7&6v&Vvg&6?&V?Jggv>323:>56.'&56?&'.'4>3>'4.'%.54>32."'&'#".  $%$ +#*<  .Q44<A<* )=G,21& "&<9)&AQSO;! 4Pb4,+.6-&/' #  ?( AK(  !%&0  ! -)%'*29H4     ,+$ #v676323:>56.567&'.'>3232>56.'&'>.67."&'&'#". #&$*    "<6&!8FJG83GPC-   &29/#8IMH:" 1:4;.6.'.' +#  )     ! , +."   ! 3)-   ,+$ #g&6@n&V@Jr&7a K}&Wa&7@k &WRQ9&8Eb&XEJ~9&8qd&XqB:9&8Af&XAne9&8C^H&XC:9&8F&XFu([hW.7>767&'&#"#".54>32">=.5>#"'7Y4Q1  #),.+@.   %4%J@-  .N<4-  *BTVR $'   DIH;'-; *9-/".,5I)HHD4 &|T.'&7>7675.'#".5&>32>5464&5>32#"/74Q1 !") $:-! $/.)   "(&<-  %!5CGE6=9>=0#14 .4. 2:6)2/' &  &:? &Z?&<? &\?= &<j 8f&=v4&]v8&=B&]Bx8$&=@@&]@NQ2&'.763"65&>54/+"&54>7.>32#".#"R 3G(0;9-$)% "%  +B0@7$"&"3"'A> Pc */' ('  EZdW   RXUD*,7% 3?! u&vB|&vT4F[i46767&#.5&>767>7"'#"&&'&'&2>5.'&'4>767"& 4L+2$$+KD  $5B >T00( d)B)'""' .67-/"%& H -%N[7&7&'.54>3247>7#"'#"&'76?&'">'&'4>7"&g !0Na1   (DV-'"# ,!G:&11-  34!,/&7>32#".+'!(  z/ *$    !4Hn#>32#"&'.'&'>    !'*7   2#"&=2>'$&2  " ! -&1u2&6".2  #   ^H 4>32#"&73>.'"^ ( #&2 !  ! -%   i..7>774Q1 =*N<4- %0&}+).'&&'&>7636?657#)%$  '  =   !"+  0 B 4>767"&34>7"&-! r! .!  ("  ) &:C 8&ZC &:v &Zvb &:j &Zj=&<Ct 8&\CF2#"&#"#4>73263 %% %+5F  # E2#"&#"#4>2726"%;FLG<+ESPDE  X<>7#".5     '/-&  -60X<>7#".5     '/-&  -60\74>7#".5     (0,& .60 21.=6?372#".'>32#".        $"832&&8C;*"/880  2>90 21.=6?372#".'>32#".        $"832&&8C;*"/880  2>90J~1.=>73720#".'>32#".        Q"931&%9C:*".970  2>:/eH2#"&#"+.'.5&=4&'#&>7&'4'.54=46323: % &L&*7    NP (.* 95  $&&  4i5o"2>#+.'&4&4=#".5463>3.'#'"&5>3.'.54574632>727:'".H,# "%&!' $942$12F ,?M(   3.($ *>D  '7@Z&  *$&&   EF"$   kj4>7632#".k ' "  ! !& !-V(<74>32#".74>32#".74>32#".-         ` ! & !  ! &  !  ! & !:7>7>73#".'&/.7M.894   &-)10.$)% 44'  /?>6# (($   !$    17>76'.'4&547632#"&#3?<55;<2"  4y:  .=E;)" %+**$  '  ".1* +74>7>7#"&   ),.'  "),' *(" Okw[8"#507>73>3>?6&+"&"#"#4>7>32.'&#"+".+"+".#"32>326#&32>32#".&L( 0 ///#:EE<"@FL.(   *0) 34'     ." 021  (,( "7)(SRR' *BQMA;I*  )  <6%      ".    &A0  ':C:'Zrx%.5&4.'#"'"#"&'54654&'.'&+".'.'"&'.5:&54323>6"#"& %F):;   #DE$$%       FD Pn}q(" + (5"     ,6=7+  H   BB   .nrr2    +.7ggi8   *4*-5-&E'3ded2 F2#"&#"#4>73263 %% %+5F  # t4>=4&=&54632#".t      &' $! cq546=&32#".'&'&'#".'.'&/+"&54>7.>32#".#"4636#".T    B'#*$  "%  +B0@7$"&"8('A20  >   4a^`4-ET&&B<8  (+(  RXUD*,7%2>   ^&'&5#"'#".'.'&/+"&54>7.>32#".#"676'4632&R !'#*$  "%  +B0@7$"&"8(' (    GG>=&B<8  (+(  RXUD*,7%2> 43FGu86Z7.476>54'5.#"".54>7>32.     7@C6#:AH)B7$    1,->@9-$32>5464&5>32#".!") $:-! $/.)     %!5CGE6=9>=0#14 .4. 2:6)2/'  >:v #8 v  5 J  8%6 t   F \ $     F 4L "p 66HCopyright (c) 2010, Kimberly Geswein (kimberlygeswein.com)Copyright (c) 2010, Kimberly Geswein (kimberlygeswein.com)Indie FlowerIndie FlowerRegularRegularKimberlyGeswein: Indie Flower: 2010KimberlyGeswein: Indie Flower: 2010Indie FlowerIndie FlowerVersion 1.001 2010Version 1.001 2010IndieFlowerIndieFlowerKimberly GesweinKimberly GesweinKimberly GesweinKimberly Geswein..http://kimberlygeswein.comhttp://kimberlygeswein.comCopyright (c) 2010, Kimberly Geswein (kimberlygeswein.com) This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.Copyright (c) 2010, Kimberly Geswein (kimberlygeswein.com) This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. http://scripts.sil.org/OFL http://scripts.sil.org/OFL3f  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghjikmlnoqprsutvwxzy{}|~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvhyphen_AmacronamacronAbreveabreveAogonekaogonek Ccircumflex ccircumflex Cdotaccent cdotaccentDcarondcaronDcroatEmacronemacronEbreveebreve Edotaccent edotaccentEogonekeogonekEcaronecaron Gcircumflex gcircumflex Gdotaccent gdotaccent Gcommaaccent gcommaaccent Hcircumflex hcircumflexhbarItildeitildeimacronIbreveibreveIogonekiogonek Jcircumflex jcircumflex Kcommaaccent kcommaaccentLacutelacute Lcommaaccent lcommaaccentLcaronlcaronLdotldotNacutenacute Ncommaaccent ncommaaccentNcaronncaron napostropheOmacronomacronObreveobreve Ohungarumlaut ohungarumlautRacuteracute Rcommaaccent rcommaaccentRcaronrcaronSacutesacute Scircumflex scircumflex Tcommaaccent tcommaaccentTcarontcaronUtildeutildeUmacronumacronUbreveubreveUringuring Uhungarumlaut uhungarumlautUogonekuogonek Wcircumflex wcircumflex Ycircumflex ycircumflexZacutezacute Zdotaccent zdotaccentAEacuteaeacute Oslashacute oslashacute Scommaaccent scommaaccentWgravewgraveWacutewacute Wdieresis wdieresisYgraveygraveEuro commaaccentR.altu.endw%ɘf esvgwrite-1.4.1/examples/fonts/OFL.txt000066400000000000000000000104121400026116000175030ustar00rootroot00000000000000Copyright (c) 2010, Kimberly Geswein (kimberlygeswein.com) This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. svgwrite-1.4.1/examples/hyperlink.py000066400000000000000000000013371400026116000175560ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg hyperlink examples # Created: 05.05.2017 # Copyright (C) 2017, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite def hyperlink(name): dwg = svgwrite.Drawing(name, (200, 200), debug=True) # use the hyperlink element link = dwg.add(dwg.a('http://www.w3.org')) link.add(dwg.ellipse(center=(100, 50), r=(50, 25), fill='red')) dwg.save(pretty=True) if __name__ == '__main__': hyperlink("hyperlink.svg") svgwrite-1.4.1/examples/inkscape_drawing.py000066400000000000000000000067761400026116000210750ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: ao2 # Purpose: create Inkscape layers with svgwrite # Created: 26.01.2018 # License: MIT License # Copyright (C) 2018 Antonio Ospite import svgwrite from svgwrite.data.types import SVGAttribute class InkscapeDrawing(svgwrite.Drawing): """An svgwrite.Drawing subclass which supports Inkscape layers""" INKSCAPE_NAMESPACE = 'http://www.inkscape.org/namespaces/inkscape' SODIPODI_NAMESPACE = 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' def __init__(self, *args, **kwargs): super(InkscapeDrawing, self).__init__(*args, **kwargs) inkscape_attributes = { 'xmlns:inkscape': SVGAttribute('xmlns:inkscape', anim=False, types=[], const=frozenset([self.INKSCAPE_NAMESPACE])), 'xmlns:sodipodi': SVGAttribute('xmlns:sodipodi', anim=False, types=[], const=frozenset([self.SODIPODI_NAMESPACE])), 'inkscape:groupmode': SVGAttribute('inkscape:groupmode', anim=False, types=[], const=frozenset(['layer'])), 'inkscape:label': SVGAttribute('inkscape:label', anim=False, types=frozenset(['string']), const=[]), 'sodipodi:insensitive': SVGAttribute('sodipodi:insensitive', anim=False, types=frozenset(['string']), const=[]) } self.validator.attributes.update(inkscape_attributes) elements = self.validator.elements svg_attributes = set(elements['svg'].valid_attributes) svg_attributes.add('xmlns:inkscape') svg_attributes.add('xmlns:sodipodi') elements['svg'].valid_attributes = frozenset(svg_attributes) g_attributes = set(elements['g'].valid_attributes) g_attributes.add('inkscape:groupmode') g_attributes.add('inkscape:label') g_attributes.add('sodipodi:insensitive') elements['g'].valid_attributes = frozenset(g_attributes) self['xmlns:inkscape'] = self.INKSCAPE_NAMESPACE self['xmlns:sodipodi'] = self.SODIPODI_NAMESPACE def layer(self, **kwargs): """Create an inkscape layer. An optional 'label' keyword argument can be passed to set a user friendly name for the layer.""" label = kwargs.pop('label', None) new_layer = self.g(**kwargs) new_layer['inkscape:groupmode'] = 'layer' if label: new_layer['inkscape:label'] = label return new_layer def main(): svg = InkscapeDrawing('inkscape-test.svg', profile='full', size=(640, 480)) layer = svg.layer(label="Layer one") layer["sodipodi:insensitive"] = "true" svg.add(layer) line = svg.line((100, 100), (300, 100), stroke=svgwrite.rgb(10, 10, 16, '%'), stroke_width='10') layer.add(line) text = svg.text('Test', insert=(100, 100), font_size='100', fill='red') layer.add(text) svg.save() if __name__ == "__main__": main() svgwrite-1.4.1/examples/koch_snowflake.py000066400000000000000000000067531400026116000205550ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 08.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import math import svgwrite def koch_snowflake(name): # Koch Snowflake and Sierpinski Triangle combination fractal using recursion # ActiveState Recipe 577156 # Created by FB36 on Sat, 27 Mar 2010 (MIT) # http://code.activestate.com/recipes/577156-koch-snowflake-and-sierpinski-triangle-combination/ def tf (x0, y0, x1, y1, x2, y2): a = math.hypot(x1 - x0, y1 - y0) b = math.hypot(x2 - x1, y2 - y1) c = math.hypot(x0 - x2, y0 - y2) if (a < stop_val) or (b < stop_val) or (c < stop_val): return x3 = (x0 + x1) / 2 y3 = (y0 + y1) / 2 x4 = (x1 + x2) / 2 y4 = (y1 + y2) / 2 x5 = (x2 + x0) / 2 y5 = (y2 + y0) / 2 points = [(x3, y3), (x4, y4), (x5, y5)] # append new polygon to snowflake element snowflake.add(dwg.polygon(points)) tf(x0, y0, x3, y3, x5, y5) tf(x3, y3, x1, y1, x4, y4) tf(x5, y5, x4, y4, x2, y2) def sf (ax, ay, bx, by): f = math.hypot(bx - ax, by - ay) if f < 1.: return f3 = f / 3 cs = (bx - ax) / f sn = (by - ay) / f cx = ax + cs * f3 cy = ay + sn * f3 h = f3 * math.sqrt(3) / 2 dx = (ax + bx) / 2 + sn * h dy = (ay + by) / 2 - cs * h ex = bx - cs * f3 ey = by - sn * f3 tf(cx, cy, dx, dy, ex, ey) sf(ax, ay, cx, cy) sf(cx, cy, dx, dy) sf(dx, dy, ex, ey) sf(ex, ey, bx, by) # const values stop_val = 8. imgx = 512 imgy = 512 # create a new drawing dwg = svgwrite.Drawing(name, (imgx, imgy), profile='tiny', debug=True) # create a new element, we will insert the snowflake by the element # here we set stroke, fill and stroke-width for all subelements # attention: 'stroke-width' is not a valid Python identifier, so use 'stroke_witdth' # underlines '_' will be converted to dashes '-', this is true for all svg-keyword-attributes # if no 'id' is given ( like dwg.g(id="sflake") ), an automatic generated 'id' will be generated snowflake = dwg.g(stroke="blue", fill="rgb(90%,90%,100%)", stroke_width=0.25) # add the element to the element of the drawing dwg.defs.add(snowflake) mx2 = imgx / 2 my2 = imgy / 2 r = my2 a = 2 * math.pi / 3 for k in range(3): x0 = mx2 + r * math.cos(a * k) y0 = my2 + r * math.sin(a * k) x1 = mx2 + r * math.cos(a * (k + 1)) y1 = my2 + r * math.sin(a * (k + 1)) sf(x0, y0, x1, y1) x2 = mx2 + r * math.cos(a) y2 = my2 + r * math.sin(a) tf(x0, y0, x1, y1, x2, y2) # create an element use_snowflake = dwg.use(snowflake) # you can transform each element # use_snowflake.rotate(15, center=(imgx/2, imgy/2)) # insert snowflake by the element dwg.add(use_snowflake) # and save the drawing dwg.save() if __name__ == '__main__': koch_snowflake("koch_snowflake.svg") svgwrite-1.4.1/examples/linearGradient.py000066400000000000000000000056211400026116000205010ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 08.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite def linearGradient(name): dwg = svgwrite.Drawing(name, size=('20cm', '15cm'), profile='full', debug=True) # set user coordinate space dwg.viewbox(width=200, height=150) # create a new linearGradient element horizontal_gradient = dwg.linearGradient((0, 0), (1, 0)) vertical_gradient = dwg.linearGradient((0, 0), (0, 1)) diagonal_gradient = dwg.linearGradient((0, 0), (1, 1)) tricolor_gradient = dwg.linearGradient((0, 0), (1, 1)) # add gradient to the defs section of the drawing dwg.defs.add(horizontal_gradient) dwg.defs.add(vertical_gradient) dwg.defs.add(diagonal_gradient) dwg.defs.add(tricolor_gradient) # define the gradient from white to red horizontal_gradient.add_stop_color(0, 'white') horizontal_gradient.add_stop_color(1, 'red') # define the gradient from white to green vertical_gradient.add_stop_color(0, 'white') vertical_gradient.add_stop_color(1, 'green') # define the gradient from white to blue diagonal_gradient.add_stop_color(0, 'white') diagonal_gradient.add_stop_color(1, 'blue') # define the gradient from white to red to green to blue tricolor_gradient.add_stop_color(0, 'white') tricolor_gradient.add_stop_color(.33, 'red') tricolor_gradient.add_stop_color(.66, 'green') tricolor_gradient.add_stop_color(1, 'blue') # use gradient for filling the rect dwg.add(dwg.rect((10,10), (50,50), fill=horizontal_gradient.get_paint_server(default='currentColor'))) dwg.add(dwg.rect((70,10), (50,50), fill=vertical_gradient.get_paint_server(default='currentColor'))) dwg.add(dwg.rect((130,10), (50,50), fill=diagonal_gradient.get_paint_server(default='currentColor'))) dwg.add(dwg.rect((10,70), (50,50), fill=tricolor_gradient.get_paint_server(default='currentColor'))) # rotate gradient about 90 degree # first copy gradient tricolor2_gradient = tricolor_gradient.copy() # rotate the gradient tricolor2_gradient.rotate(90, (.5, .5)) # add gradient to the defs section of the drawing dwg.defs.add(tricolor2_gradient) # use the gradient dwg.add(dwg.rect((70,70), (50,50), fill=tricolor2_gradient.get_paint_server(default='currentColor'))) updown = dwg.linearGradient() dwg.defs.add(updown) updown.add_colors(['red', 'white', 'red', 'white', 'red'], sweep=(.2, .8)) dwg.add(dwg.rect((130,70), (50,50), fill=updown.get_paint_server(default='currentColor'))) dwg.save() if __name__ == '__main__': linearGradient("linearGradient.svg") svgwrite-1.4.1/examples/ltattrie/000077500000000000000000000000001400026116000170235ustar00rootroot00000000000000svgwrite-1.4.1/examples/ltattrie/bezier.py000066400000000000000000000172751400026116000206710ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite from itertools import * PROGNAME = sys.argv[0].rstrip('.py') # http://code.activestate.com/recipes/66472-frange-a-range-function-with-float-increments/ # but instead of parameter for float increments there is a parameter for n points. def nfrange(fstart, fstop, n): # n = number of points delta = (fstop - fstart) / n return [ fstart + delta * i for i in range(n) ] def create_svg(name): class bezier(object): def __init__(self, val_x, val_y): # The main point self.x = val_x self.y = val_y # control point before main point self.cbx = None self.cby = None # control point after main point self.cax = None self.cay = None def displayf(self): # display formatted with brackets and commas if self.cbx: self.s_cb = '({:f}, {:f})'.format(self.cbx, self.cby) else: self.s_cb = '(None, None)' if self.cax: self.s_ca = '({:f}, {:f})'.format(self.cax, self.cay) else: self.s_ca = ' (None, None)' return '({:s}, ({:f}, {:f}), {:s})'.format(self.s_cb, self.x, self.y, self.s_ca) def display(self): # display without formatted with brackets and commas if self.cbx: self.s_cb = '{:f} {:f}'.format(self.cbx, self.cby) else: self.s_cb = 'None None' if self.cax: self.s_ca = '{:f} {:f}'.format(self.cax, self.cay) else: self.s_ca = ' None None' return '{:s} {:f} {:f} {:s}'.format(self.s_cb, self.x, self.y, self.s_ca) svg_size = 900 font_size = 20 title = name + ': Example of Bezier curves' dwg = svgwrite.Drawing(name, (svg_size, svg_size), debug=True) # background will be white. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), rx=None, ry=None, fill='white')) # give the name of the example and a title. dwg.add(dwg.text(title, insert=(0, (font_size + 5)), font_family="serif", font_size=font_size, fill='black')) # http://www.w3.org/TR/SVG11/paths.html # M=move to L=line to z=close path. # Uppercase means absolute coordinates, lowercase means relative coordinates # H=draw horizonal line V=draw vertical line # # C (absolute) c (relative) curveto (x1 y1 x2 y2 x y)+ # Draws a cubic Bezier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve. C (uppercase) indicates that absolute coordinates will follow; c (lowercase) indicates that relative coordinates will follow. Multiple sets of coordinates may be specified to draw a polybezier. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. # S (absolute) s (relative) shorthand/smooth curveto (x2 y2 x y)+ # Draws a cubic Bezier curve from the current point to (x,y). The first control point is assumed to be the reflection of the second control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not an C, c, S or s, assume the first control point is coincident with the current point.) (x2,y2) is the second control point (i.e., the control point at the end of the curve). S (uppercase) indicates that absolute coordinates will follow; s (lowercase) indicates that relative coordinates will follow. Multiple sets of coordinates may be specified to draw a polybezier. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. # Q (absolute) q (relative) quadratic Bezier curveto (x1 y1 x y)+ # Draws a quadratic Bezier curve from the current point to (x,y) using (x1,y1) as the control point. Q (uppercase) indicates that absolute coordinates will follow; q (lowercase) indicates that relative coordinates will follow. Multiple sets of coordinates may be specified to draw a polybezier. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. # T (absolute) t (relative) Shorthand/smooth quadratic Bezier curveto (x y)+ # Draws a quadratic Bezier curve from the current point to (x,y). The control point is assumed to be the reflection of the control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not a Q, q, T or t, assume the control point is coincident with the current point.) T (uppercase) indicates that absolute coordinates will follow; t (lowercase) indicates that relative coordinates will follow. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. # # Draw rectangle but with wiggly Bezier line. start = [50.0, 100.0] size = [200.0, 200.0] pts_per_side = 7 ctl_pt_weight = 2.50 # what weight is given to control point? (distance to next point) x ctl_pt_weight vert_pt_weight = .80 # what weight is given to vertical distance? (distance to next point) x vert_pt_weight plus_minus = cycle([1, -1]) # create iterator which alternates between +1 and -1 forever. # s1 = 'M {0[0]} {0[1]}'.format(start) p3 = dwg.path(d=s1, stroke_width=1, stroke='red', fill='none') # top left to top right l1 = nfrange(start[0], (start[0] + size[0]), 7) for item in l1: circle_3 = dwg.circle(center=(item, start[1]), r=3) circle_3.fill('green', opacity=0.5).stroke('black', width=1) dwg.add(circle_3) pm = next(plus_minus) l1l = [] for i, item in enumerate(l1): # Do not add the starting point because the starting point is given by the M command ## TODO: change the loop to have the starting point M done within the loop. if i != 0: # create control point for the previous point ctl_pt_dist = ctl_pt_weight * (item - l1[i - 1]) vert_dist_chg = vert_pt_weight * (item - l1[i - 1]) * pm # vertical distance off off straight line. l1l.append(l1[i - 1] + ctl_pt_dist) # x l1l.append(start[1] + vert_dist_chg) # y circle_1 = dwg.circle(center=(l1[i - 1] + ctl_pt_dist, start[1] + vert_dist_chg), r=1) circle_1.fill('blue', opacity=0.5).stroke('black', width=1) dwg.add(circle_1) pm = next(plus_minus) vert_dist_chg = vert_pt_weight * (item - l1[i - 1]) * pm # vertical distance off off straight line. # create control point for the current point l1l.append(item - ctl_pt_dist) # x l1l.append(start[1] + vert_dist_chg) # y circle_1 = dwg.circle(center=(item - ctl_pt_dist, start[1] + vert_dist_chg), r=1) circle_1.fill('purple', opacity=0.5).stroke('black', width=1) dwg.add(circle_1) # create the current point l1l.append(item) l1l.append(start[1] + vert_dist_chg) circle_3 = dwg.circle(center=(item, start[1] + vert_dist_chg), r=3) circle_3.fill('blue', opacity=0.5).stroke('black', width=1) dwg.add(circle_3) p3.push('C', l1l) dwg.add(p3) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/circle_blur.py000066400000000000000000000037471400026116000216750ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): SVG_SIZE = 900 FONT_SIZE = 20 title = name + ': Test to see if feGaussianBlur filter can be used.' dwg = svgwrite.Drawing(name, (SVG_SIZE, SVG_SIZE), debug=True) #myfilter = dwg.defs.add(dwg.filter(id="myfilter", filterUnits="userSpaceOnUse")) myfilter = dwg.defs.add(dwg.filter()) # the short way, using auto ids myfilter.feGaussianBlur(in_='SourceGraphic', stdDeviation=2) defs_g_text = dwg.defs.add(dwg.g(id='defs_g_text')) defs_g_text.add(dwg.text("SVGWRITE", insert=(0, 0), font_family="serif", font_size=FONT_SIZE)) # background will be white. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='white')) # give the name of the example and a title. y = FONT_SIZE + 5 dwg.add(dwg.text(title, insert=(0, y), font_family="serif", font_size=FONT_SIZE, fill='black')) y += 50 circle_1 = dwg.circle(center=(100, y), r=30) circle_1.fill('green', opacity=0.5).stroke('black', width=5).scale([2,2]) dwg.add(circle_1) # setting the filter attribute # at the constructor by filter=myfilter.get_funciri() # get_funciri() returns the string 'url(#myfilter)' for id='myfilter' y += 30 circle_2 = dwg.circle(center=(100, y), r=30, filter=myfilter.get_funciri()) circle_2.fill('green', opacity=0.5).stroke('black', width=5).scale([2,2]) # or by setting the 'filter' attribute of the circle_2 object # HINT: all svg attributes can be set by this way, but you have to use # the REAL svg-attribute-name like: 'font-size' or 'class' circle_2['filter'] = myfilter.get_funciri() dwg.add(circle_2) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/color_names.py000066400000000000000000000201771400026116000217050ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite # # http://www.w3.org/TR/SVG11/types.html#ColorKeywords # Note both grey and gray are valid but only color not colour is valid. # PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): svg_size_width = 900 svg_size_height = 4500 font_size = 20 title1 = name + ': Example of svg predefined color names.' sample = ( ('aliceblue', 'rgb(240, 248, 255)'), ('antiquewhite', 'rgb(250, 235, 215)'), ('aqua', 'rgb( 0, 255, 255)'), ('aquamarine', 'rgb(127, 255, 212)'), ('azure', 'rgb(240, 255, 255)'), ('beige', 'rgb(245, 245, 220)'), ('bisque', 'rgb(255, 228, 196)'), ('black', 'rgb( 0, 0, 0)'), ('blanchedalmond', 'rgb(255, 235, 205)'), ('blue', 'rgb( 0, 0, 255)'), ('blueviolet', 'rgb(138, 43, 226)'), ('brown', 'rgb(165, 42, 42)'), ('burlywood', 'rgb(222, 184, 135)'), ('cadetblue', 'rgb( 95, 158, 160)'), ('chartreuse', 'rgb(127, 255, 0)'), ('chocolate', 'rgb(210, 105, 30)'), ('coral', 'rgb(255, 127, 80)'), ('cornflowerblue', 'rgb(100, 149, 237)'), ('cornsilk', 'rgb(255, 248, 220)'), ('crimson', 'rgb(220, 20, 60)'), ('cyan', 'rgb( 0, 255, 255)'), ('darkblue', 'rgb( 0, 0, 139)'), ('darkcyan', 'rgb( 0, 139, 139)'), ('darkgoldenrod', 'rgb(184, 134, 11)'), ('darkgray', 'rgb(169, 169, 169)'), ('darkgreen', 'rgb( 0, 100, 0)'), ('darkgrey', 'rgb(169, 169, 169)'), ('darkkhaki', 'rgb(189, 183, 107)'), ('darkmagenta', 'rgb(139, 0, 139)'), ('darkolivegreen', 'rgb( 85, 107, 47)'), ('darkorange', 'rgb(255, 140, 0)'), ('darkorchid', 'rgb(153, 50, 204)'), ('darkred', 'rgb(139, 0, 0)'), ('darksalmon', 'rgb(233, 150, 122)'), ('darkseagreen', 'rgb(143, 188, 143)'), ('darkslateblue', 'rgb( 72, 61, 139)'), ('darkslategray', 'rgb( 47, 79, 79)'), ('darkslategrey', 'rgb( 47, 79, 79)'), ('darkturquoise', 'rgb( 0, 206, 209)'), ('darkviolet', 'rgb(148, 0, 211)'), ('deeppink', 'rgb(255, 20, 147)'), ('deepskyblue', 'rgb( 0, 191, 255)'), ('dimgray', 'rgb(105, 105, 105)'), ('dimgrey', 'rgb(105, 105, 105)'), ('dodgerblue', 'rgb( 30, 144, 255)'), ('firebrick', 'rgb(178, 34, 34)'), ('floralwhite', 'rgb(255, 250, 240)'), ('forestgreen', 'rgb( 34, 139, 34)'), ('fuchsia', 'rgb(255, 0, 255)'), ('gainsboro', 'rgb(220, 220, 220)'), ('ghostwhite', 'rgb(248, 248, 255)'), ('gold', 'rgb(255, 215, 0)'), ('goldenrod', 'rgb(218, 165, 32)'), ('gray', 'rgb(128, 128, 128)'), ('grey', 'rgb(128, 128, 128)'), ('green', 'rgb( 0, 128, 0)'), ('greenyellow', 'rgb(173, 255, 47)'), ('honeydew', 'rgb(240, 255, 240)'), ('hotpink', 'rgb(255, 105, 180)'), ('indianred', 'rgb(205, 92, 92)'), ('indigo', 'rgb( 75, 0, 130)'), ('ivory', 'rgb(255, 255, 240)'), ('khaki', 'rgb(240, 230, 140)'), ('lavender', 'rgb(230, 230, 250)'), ('lavenderblush', 'rgb(255, 240, 245)'), ('lawngreen', 'rgb(124, 252, 0)'), ('lemonchiffon', 'rgb(255, 250, 205)'), ('lightblue', 'rgb(173, 216, 230)'), ('lightcoral', 'rgb(240, 128, 128)'), ('lightcyan', 'rgb(224, 255, 255)'), ('lightgoldenrodyellow', 'rgb(250, 250, 210)'), ('lightgray', 'rgb(211, 211, 211)'), ('lightgreen', 'rgb(144, 238, 144)'), ('lightgrey', 'rgb(211, 211, 211)'), ('lightpink', 'rgb(255, 182, 193)'), ('lightsalmon', 'rgb(255, 160, 122)'), ('lightseagreen', 'rgb( 32, 178, 170)'), ('lightskyblue', 'rgb(135, 206, 250)'), ('lightslategray', 'rgb(119, 136, 153)'), ('lightslategrey', 'rgb(119, 136, 153)'), ('lightsteelblue', 'rgb(176, 196, 222)'), ('lightyellow', 'rgb(255, 255, 224)'), ('lime', 'rgb( 0, 255, 0)'), ('limegreen', 'rgb( 50, 205, 50)'), ('linen', 'rgb(250, 240, 230)'), ('magenta', 'rgb(255, 0, 255)'), ('maroon', 'rgb(128, 0, 0)'), ('mediumaquamarine', 'rgb(102, 205, 170)'), ('mediumblue', 'rgb( 0, 0, 205)'), ('mediumorchid', 'rgb(186, 85, 211)'), ('mediumpurple', 'rgb(147, 112, 219)'), ('mediumseagreen', 'rgb( 60, 179, 113)'), ('mediumslateblue', 'rgb(123, 104, 238)'), ('mediumspringgreen', 'rgb( 0, 250, 154)'), ('mediumturquoise', 'rgb( 72, 209, 204)'), ('mediumvioletred', 'rgb(199, 21, 133)'), ('midnightblue', 'rgb( 25, 25, 112)'), ('mintcream', 'rgb(245, 255, 250)'), ('mistyrose', 'rgb(255, 228, 225)'), ('moccasin', 'rgb(255, 228, 181)'), ('navajowhite', 'rgb(255, 222, 173)'), ('navy', 'rgb( 0, 0, 128)'), ('oldlace', 'rgb(253, 245, 230)'), ('olive', 'rgb(128, 128, 0)'), ('olivedrab', 'rgb(107, 142, 35)'), ('orange', 'rgb(255, 165, 0)'), ('orangered', 'rgb(255, 69, 0)'), ('orchid', 'rgb(218, 112, 214)'), ('palegoldenrod', 'rgb(238, 232, 170)'), ('palegreen', 'rgb(152, 251, 152)'), ('paleturquoise', 'rgb(175, 238, 238)'), ('palevioletred', 'rgb(219, 112, 147)'), ('papayawhip', 'rgb(255, 239, 213)'), ('peachpuff', 'rgb(255, 218, 185)'), ('peru', 'rgb(205, 133, 63)'), ('pink', 'rgb(255, 192, 203)'), ('plum', 'rgb(221, 160, 221)'), ('powderblue', 'rgb(176, 224, 230)'), ('purple', 'rgb(128, 0, 128)'), ('red', 'rgb(255, 0, 0)'), ('rosybrown', 'rgb(188, 143, 143)'), ('royalblue', 'rgb( 65, 105, 225)'), ('saddlebrown', 'rgb(139, 69, 19)'), ('salmon', 'rgb(250, 128, 114)'), ('sandybrown', 'rgb(244, 164, 96)'), ('seagreen', 'rgb( 46, 139, 87)'), ('seashell', 'rgb(255, 245, 238)'), ('sienna', 'rgb(160, 82, 45)'), ('silver', 'rgb(192, 192, 192)'), ('skyblue', 'rgb(135, 206, 235)'), ('slateblue', 'rgb(106, 90, 205)'), ('slategray', 'rgb(112, 128, 144)'), ('slategrey', 'rgb(112, 128, 144)'), ('snow', 'rgb(255, 250, 250)'), ('springgreen', 'rgb( 0, 255, 127)'), ('steelblue', 'rgb( 70, 130, 180)'), ('tan', 'rgb(210, 180, 140)'), ('teal', 'rgb( 0, 128, 128)'), ('thistle', 'rgb(216, 191, 216)'), ('tomato', 'rgb(255, 99, 71)'), ('turquoise', 'rgb( 64, 224, 208)'), ('violet', 'rgb(238, 130, 238)'), ('wheat', 'rgb(245, 222, 179)'), ('white', 'rgb(255, 255, 255)'), ('whitesmoke', 'rgb(245, 245, 245)'), ('yellow', 'rgb(255, 255, 0)'), ('yellowgreen', 'rgb(154, 205, 50)') ) dwg = svgwrite.Drawing(name, (svg_size_width, svg_size_height), debug=True) # background will be a color not on the list so all listed colors will show. # Background will be dark but not black so the background does not overwhelm the colors. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='rgb(50,50,50)')) # give the name of the example and a title. dwg.add(dwg.text(title1, insert=(0, (font_size + 5)), font_family="serif", font_size=font_size, fill='white')) for i, sample_item in enumerate(sample): y_loc = 1.5 * font_size * (i + 2) dwg.add(dwg.rect(insert=(font_size, (y_loc - font_size)), size=(font_size, font_size), fill=sample_item[0])) dwg.add(dwg.text(sample_item[0] + " " + sample_item[1], insert=(3 * font_size, y_loc), font_family="serif", font_size=font_size, fill=sample_item[0])) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/color_triangles_function.py000066400000000000000000000074561400026116000245040ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import math, sys import svgwrite from svgwrite import rgb # # http://www.w3.org/TR/SVG11/types.html#ColorKeywords # Note both grey and gray are valide but only color not colour is valid. # PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): WIDTH = 900 HEIGHT = 900 FONT_SIZE = 20 COMPLETE_SIZE = 800 # size of the whole set of triangles. TRIANGLES_PER_SIDE = 50 # How many triangles there will be per side. integer. TRIHEIGHT = math.sqrt(3) / 2 title1 = name + ': Example of creating your own colors.' start = ((WIDTH - COMPLETE_SIZE)/2, (HEIGHT - COMPLETE_SIZE)/2) # center triangle #tri_color = ((255, 0, 0), (0, 255, 0), (0, 0, 255)) #tri_color = ((128, 0, 0), (0, 128, 0), (0, 0, 128)) tri_color = ((20, 128, 30), (10, 0, 50), (0, 0, 128)) dwg = svgwrite.Drawing(name, (WIDTH, HEIGHT), debug=True) def draw_triangle(insert, size, fill, rotate=None): x, y = insert points = [insert, (x + size, y), ((x + size / 2), (y + size * TRIHEIGHT))] triangle = dwg.add(dwg.polygon(points, fill=fill, stroke='none')) if rotate: triangle.rotate(rotate, center=insert) def nfrange(fstart, fstop, n): # n = number of points delta = (fstop - fstart) / n return [ fstart + delta * i for i in range(n) ] # Background will be dark but not black so the background does not overwhelm the colors. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='grey')) # Give the name of the example and a title. y = FONT_SIZE + 5 dwg.add(dwg.text(title1, insert=(0, y), font_family="serif", font_size=FONT_SIZE, fill='white')) tri_size = COMPLETE_SIZE / TRIANGLES_PER_SIDE tri_height = tri_size * TRIHEIGHT ratio_side = nfrange(0.0, 1.0, TRIANGLES_PER_SIDE) for i in range(TRIANGLES_PER_SIDE, 0, -1): # The number of triangle in the row is the sum of the point up and the point down # triangles. num_tri_in_row = 2 * i - 1 num_tri_drawn_in_row = 0 # Calculate color start_color = [int(tri_color[0][k] * ratio_side[i-1] + tri_color[2][k] * (1 - ratio_side[i-1])) for k in range(3)] end_color = [int(tri_color[1][k] * ratio_side[i-1] + tri_color[2][k] * (1 -ratio_side[i-1])) for k in range(3)] # calculate ratios of the two ending colors. ratio_row = nfrange(0.0, 1.0, num_tri_in_row) if num_tri_in_row > 1 else [0.5] for j in range(i): x = start[0] + (j + ((TRIANGLES_PER_SIDE - i) / 2)) * tri_size y = start[1] + (TRIANGLES_PER_SIDE - i) * tri_height # Calculate color new_color = [int(start_color[k] * (1 - ratio_row[num_tri_drawn_in_row ]) + end_color[k] * ratio_row[num_tri_drawn_in_row]) for k in range(3)] draw_triangle((x, y), tri_size, rgb(*new_color)) num_tri_drawn_in_row += 1 if j != (i - 1): # The on screen point up triangles have one fewer per row. x += tri_size # Calculate color new_color = [int(start_color[k] * (1 - ratio_row[num_tri_drawn_in_row ]) + end_color[k] * ratio_row[num_tri_drawn_in_row]) for k in range(3)] draw_triangle((x, y), tri_size, rgb(*new_color), rotate=60) num_tri_drawn_in_row += 1 dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/length_units.py000066400000000000000000000042051400026116000221010ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite # # http://www.w3.org/TR/SVG/coords.html#Units # The supported length unit identifiers are: em, ex, px, pt, pc, cm, mm, in, and percentages. # PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): SVG_SIZE = 900 FONT_SIZE = 20 title1 = name + ': Example of units of length' title2 = name + ': Example of class Unit and import from svgwrite cm, mm' sample = ( ('px', ' one user unit which may or may not be pixels. This is the default if no units are specified.'), ('pt', ' 1.25px.'), ('mm', ' 3.543307px.'), ('ex', " the current font's height of the character x."), ('%', ' percent of the size of the viewport.'), ('pc', ' 15px.'), ('em', " the current font's height."), ('cm', ' 35.43307px.'), ('in', ' 90px.') ) dwg = svgwrite.Drawing(name, (SVG_SIZE, SVG_SIZE)) # background will be white. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='white')) # give the name of the example and a title. y = FONT_SIZE + 5 x = 5 linespace = FONT_SIZE * 2 group = dwg.add(dwg.g(font_family="serif", font_size=FONT_SIZE, fill='black')) group.add(dwg.text(title1, insert=(x, y))) for i, sample_item in enumerate(sample): y += linespace unit = sample_item[0] group.add(dwg.rect(insert=(0, y), size=('1' + unit, '3px'), fill='red')) group.add(dwg.text("size='1%s': %s" % sample_item, insert=('2in', y+3))) # Show the use of class Unit y += linespace textlines = ( title2, 'The Unit class overrides the right hand multiply', '2*3*cm returns the string "6cm"' ) for txt in textlines: group.add(dwg.text(txt, insert=(x, y))) y += linespace dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/line_cap_join.py000066400000000000000000000051611400026116000221710ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): svg_size = 900 font_size = 20 title = name + ': Example of stroke_linecap, stroke_linejoin' dwg = svgwrite.Drawing(name, (svg_size, svg_size), debug=True) # background will be white. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='white')) # give the name of the example and a title. text = dwg.add(dwg.g(font_family="sans-serif", font_size=font_size, fill='black')) lines = dwg.add(dwg.g(stroke_width=10, stroke='green', fill='none')) text.add(dwg.text(title, insert=(0, (font_size + 5)))) lines.add(dwg.line(start=(50, 100), end=(150, 100))) text.add(dwg.text("Default is butt", insert=('175', '100'))) lines.add(dwg.line(start=(50, 130), end=(150, 130), stroke_linecap='butt')) text.add(dwg.text("stroke_linecap='butt'", insert=('175', '130'))) lines.add(dwg.line(start=(50, 160), end=(150, 160), stroke_linecap='square')) text.add(dwg.text("stroke_linecap='square'", insert=('175', '160'))) lines.add(dwg.line(start=(50, 190), end=(150, 190), stroke_linecap='round')) text.add(dwg.text("stroke_linecap='round'", insert=('175', '190'))) lines.add(dwg.polyline([(50, 250), (50, 300), (75, 250), (100, 300), (120, 250), (150, 250), (150, 300)])) text.add(dwg.text("Default is miter", insert=('175', '280'))) lines.add(dwg.polyline([(50, 350), (50, 400), (75, 350), (100, 400), (120, 350), (150, 350), (150, 400)], stroke_linejoin='miter')) text.add(dwg.text("stroke_linejoin='miter'", insert=('175', '380'))) lines.add(dwg.polyline([(50, 450), (50, 500), (75, 450), (100, 500), (120, 450), (150, 450), (150, 500)], stroke_linejoin='bevel')) text.add(dwg.text("stroke_linejoin='bevel'", insert=('175', '480'))) lines.add(dwg.polyline([(50, 550), (50, 600), (75, 550), (100, 600), (120, 550), (150, 550), (150, 600)], stroke_linejoin='round')) text.add(dwg.text("stroke_linejoin='round'", insert=('175', '580'))) lines.add(dwg.polyline([(50, 650), (50, 700), (75, 650), (100, 700), (120, 650), (150, 650), (150, 700)], stroke_linejoin='round', stroke_linecap='round')) text.add(dwg.text("stroke_linejoin='round', stroke_linecap='round'", insert=('175', '680'))) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/rgb.txt000066400000000000000000000454551400026116000203530ustar00rootroot00000000000000cloudy blue #acc2d9 dark pastel green #56ae57 dust #b2996e electric lime #a8ff04 fresh green #69d84f light eggplant #894585 nasty green #70b23f really light blue #d4ffff tea #65ab7c warm purple #952e8f yellowish tan #fcfc81 cement #a5a391 dark grass green #388004 dusty teal #4c9085 grey teal #5e9b8a macaroni and cheese #efb435 pinkish tan #d99b82 spruce #0a5f38 strong blue #0c06f7 toxic green #61de2a windows blue #3778bf blue blue #2242c7 blue with a hint of purple #533cc6 booger #9bb53c bright sea green #05ffa6 dark green blue #1f6357 deep turquoise #017374 green teal #0cb577 strong pink #ff0789 bland #afa88b deep aqua #08787f lavender pink #dd85d7 light moss green #a6c875 light seafoam green #a7ffb5 olive yellow #c2b709 pig pink #e78ea5 deep lilac #966ebd desert #ccad60 dusty lavender #ac86a8 purpley grey #947e94 purply #983fb2 candy pink #ff63e9 light pastel green #b2fba5 boring green #63b365 kiwi green #8ee53f light grey green #b7e1a1 orange pink #ff6f52 tea green #bdf8a3 very light brown #d3b683 egg shell #fffcc4 eggplant purple #430541 powder pink #ffb2d0 reddish grey #997570 baby shit brown #ad900d liliac #c48efd stormy blue #507b9c ugly brown #7d7103 custard #fffd78 darkish pink #da467d deep brown #410200 greenish beige #c9d179 manilla #fffa86 off blue #5684ae battleship grey #6b7c85 browny green #6f6c0a bruise #7e4071 kelley green #009337 sickly yellow #d0e429 sunny yellow #fff917 azul #1d5dec darkgreen #054907 green/yellow #b5ce08 lichen #8fb67b light light green #c8ffb0 pale gold #fdde6c sun yellow #ffdf22 tan green #a9be70 burple #6832e3 butterscotch #fdb147 toupe #c7ac7d dark cream #fff39a indian red #850e04 light lavendar #efc0fe poison green #40fd14 baby puke green #b6c406 bright yellow green #9dff00 charcoal grey #3c4142 squash #f2ab15 cinnamon #ac4f06 light pea green #c4fe82 radioactive green #2cfa1f raw sienna #9a6200 baby purple #ca9bf7 cocoa #875f42 light royal blue #3a2efe orangeish #fd8d49 rust brown #8b3103 sand brown #cba560 swamp #698339 tealish green #0cdc73 burnt siena #b75203 camo #7f8f4e dusk blue #26538d fern #63a950 old rose #c87f89 pale light green #b1fc99 peachy pink #ff9a8a rosy pink #f6688e light bluish green #76fda8 light bright green #53fe5c light neon green #4efd54 light seafoam #a0febf tiffany blue #7bf2da washed out green #bcf5a6 browny orange #ca6b02 nice blue #107ab0 sapphire #2138ab greyish teal #719f91 orangey yellow #fdb915 parchment #fefcaf straw #fcf679 very dark brown #1d0200 terracota #cb6843 ugly blue #31668a clear blue #247afd creme #ffffb6 foam green #90fda9 grey/green #86a17d light gold #fddc5c seafoam blue #78d1b6 topaz #13bbaf violet pink #fb5ffc wintergreen #20f986 yellow tan #ffe36e dark fuchsia #9d0759 indigo blue #3a18b1 light yellowish green #c2ff89 pale magenta #d767ad rich purple #720058 sunflower yellow #ffda03 green/blue #01c08d leather #ac7434 racing green #014600 vivid purple #9900fa dark royal blue #02066f hazel #8e7618 muted pink #d1768f booger green #96b403 canary #fdff63 cool grey #95a3a6 dark taupe #7f684e darkish purple #751973 true green #089404 coral pink #ff6163 dark sage #598556 dark slate blue #214761 flat blue #3c73a8 mushroom #ba9e88 rich blue #021bf9 dirty purple #734a65 greenblue #23c48b icky green #8fae22 light khaki #e6f2a2 warm blue #4b57db dark hot pink #d90166 deep sea blue #015482 carmine #9d0216 dark yellow green #728f02 pale peach #ffe5ad plum purple #4e0550 golden rod #f9bc08 neon red #ff073a old pink #c77986 very pale blue #d6fffe blood orange #fe4b03 grapefruit #fd5956 sand yellow #fce166 clay brown #b2713d dark blue grey #1f3b4d flat green #699d4c light green blue #56fca2 warm pink #fb5581 dodger blue #3e82fc gross green #a0bf16 ice #d6fffa metallic blue #4f738e pale salmon #ffb19a sap green #5c8b15 algae #54ac68 bluey grey #89a0b0 greeny grey #7ea07a highlighter green #1bfc06 light light blue #cafffb light mint #b6ffbb raw umber #a75e09 vivid blue #152eff deep lavender #8d5eb7 dull teal #5f9e8f light greenish blue #63f7b4 mud green #606602 pinky #fc86aa red wine #8c0034 shit green #758000 tan brown #ab7e4c darkblue #030764 rosa #fe86a4 lipstick #d5174e pale mauve #fed0fc claret #680018 dandelion #fedf08 orangered #fe420f poop green #6f7c00 ruby #ca0147 dark #1b2431 greenish turquoise #00fbb0 pastel red #db5856 piss yellow #ddd618 bright cyan #41fdfe dark coral #cf524e algae green #21c36f darkish red #a90308 reddy brown #6e1005 blush pink #fe828c camouflage green #4b6113 lawn green #4da409 putty #beae8a vibrant blue #0339f8 dark sand #a88f59 purple/blue #5d21d0 saffron #feb209 twilight #4e518b warm brown #964e02 bluegrey #85a3b2 bubble gum pink #ff69af duck egg blue #c3fbf4 greenish cyan #2afeb7 petrol #005f6a royal #0c1793 butter #ffff81 dusty orange #f0833a off yellow #f1f33f pale olive green #b1d27b orangish #fc824a leaf #71aa34 light blue grey #b7c9e2 dried blood #4b0101 lightish purple #a552e6 rusty red #af2f0d lavender blue #8b88f8 light grass green #9af764 light mint green #a6fbb2 sunflower #ffc512 velvet #750851 brick orange #c14a09 lightish red #fe2f4a pure blue #0203e2 twilight blue #0a437a violet red #a50055 yellowy brown #ae8b0c carnation #fd798f muddy yellow #bfac05 dark seafoam green #3eaf76 deep rose #c74767 dusty red #b9484e grey/blue #647d8e lemon lime #bffe28 purple/pink #d725de brown yellow #b29705 purple brown #673a3f wisteria #a87dc2 banana yellow #fafe4b lipstick red #c0022f water blue #0e87cc brown grey #8d8468 vibrant purple #ad03de baby green #8cff9e barf green #94ac02 eggshell blue #c4fff7 sandy yellow #fdee73 cool green #33b864 pale #fff9d0 blue/grey #758da3 hot magenta #f504c9 greyblue #77a1b5 purpley #8756e4 baby shit green #889717 brownish pink #c27e79 dark aquamarine #017371 diarrhea #9f8303 light mustard #f7d560 pale sky blue #bdf6fe turtle green #75b84f bright olive #9cbb04 dark grey blue #29465b greeny brown #696006 lemon green #adf802 light periwinkle #c1c6fc seaweed green #35ad6b sunshine yellow #fffd37 ugly purple #a442a0 medium pink #f36196 puke brown #947706 very light pink #fff4f2 viridian #1e9167 bile #b5c306 faded yellow #feff7f very pale green #cffdbc vibrant green #0add08 bright lime #87fd05 spearmint #1ef876 light aquamarine #7bfdc7 light sage #bcecac yellowgreen #bbf90f baby poo #ab9004 dark seafoam #1fb57a deep teal #00555a heather #a484ac rust orange #c45508 dirty blue #3f829d fern green #548d44 bright lilac #c95efb weird green #3ae57f peacock blue #016795 avocado green #87a922 faded orange #f0944d grape purple #5d1451 hot green #25ff29 lime yellow #d0fe1d mango #ffa62b shamrock #01b44c bubblegum #ff6cb5 purplish brown #6b4247 vomit yellow #c7c10c pale cyan #b7fffa key lime #aeff6e tomato red #ec2d01 lightgreen #76ff7b merlot #730039 night blue #040348 purpleish pink #df4ec8 apple #6ecb3c baby poop green #8f9805 green apple #5edc1f heliotrope #d94ff5 yellow/green #c8fd3d almost black #070d0d cool blue #4984b8 leafy green #51b73b mustard brown #ac7e04 dusk #4e5481 dull brown #876e4b frog green #58bc08 vivid green #2fef10 bright light green #2dfe54 fluro green #0aff02 kiwi #9cef43 seaweed #18d17b navy green #35530a ultramarine blue #1805db iris #6258c4 pastel orange #ff964f yellowish orange #ffab0f perrywinkle #8f8ce7 tealish #24bca8 dark plum #3f012c pear #cbf85f pinkish orange #ff724c midnight purple #280137 light urple #b36ff6 dark mint #48c072 greenish tan #bccb7a light burgundy #a8415b turquoise blue #06b1c4 ugly pink #cd7584 sandy #f1da7a electric pink #ff0490 muted purple #805b87 mid green #50a747 greyish #a8a495 neon yellow #cfff04 banana #ffff7e carnation pink #ff7fa7 tomato #ef4026 sea #3c9992 muddy brown #886806 turquoise green #04f489 buff #fef69e fawn #cfaf7b muted blue #3b719f pale rose #fdc1c5 dark mint green #20c073 amethyst #9b5fc0 blue/green #0f9b8e chestnut #742802 sick green #9db92c pea #a4bf20 rusty orange #cd5909 stone #ada587 rose red #be013c pale aqua #b8ffeb deep orange #dc4d01 earth #a2653e mossy green #638b27 grassy green #419c03 pale lime green #b1ff65 light grey blue #9dbcd4 pale grey #fdfdfe asparagus #77ab56 blueberry #464196 purple red #990147 pale lime #befd73 greenish teal #32bf84 caramel #af6f09 deep magenta #a0025c light peach #ffd8b1 milk chocolate #7f4e1e ocher #bf9b0c off green #6ba353 purply pink #f075e6 lightblue #7bc8f6 dusky blue #475f94 golden #f5bf03 light beige #fffeb6 butter yellow #fffd74 dusky purple #895b7b french blue #436bad ugly yellow #d0c101 greeny yellow #c6f808 orangish red #f43605 shamrock green #02c14d orangish brown #b25f03 tree green #2a7e19 deep violet #490648 gunmetal #536267 blue/purple #5a06ef cherry #cf0234 sandy brown #c4a661 warm grey #978a84 dark indigo #1f0954 midnight #03012d bluey green #2bb179 grey pink #c3909b soft purple #a66fb5 blood #770001 brown red #922b05 medium grey #7d7f7c berry #990f4b poo #8f7303 purpley pink #c83cb9 light salmon #fea993 snot #acbb0d easter purple #c071fe light yellow green #ccfd7f dark navy blue #00022e drab #828344 light rose #ffc5cb rouge #ab1239 purplish red #b0054b slime green #99cc04 baby poop #937c00 irish green #019529 pink/purple #ef1de7 dark navy #000435 greeny blue #42b395 light plum #9d5783 pinkish grey #c8aca9 dirty orange #c87606 rust red #aa2704 pale lilac #e4cbff orangey red #fa4224 primary blue #0804f9 kermit green #5cb200 brownish purple #76424e murky green #6c7a0e wheat #fbdd7e very dark purple #2a0134 bottle green #044a05 watermelon #fd4659 deep sky blue #0d75f8 fire engine red #fe0002 yellow ochre #cb9d06 pumpkin orange #fb7d07 pale olive #b9cc81 light lilac #edc8ff lightish green #61e160 carolina blue #8ab8fe mulberry #920a4e shocking pink #fe02a2 auburn #9a3001 bright lime green #65fe08 celadon #befdb7 pinkish brown #b17261 poo brown #885f01 bright sky blue #02ccfe celery #c1fd95 dirt brown #836539 strawberry #fb2943 dark lime #84b701 copper #b66325 medium brown #7f5112 muted green #5fa052 robin's egg #6dedfd bright aqua #0bf9ea bright lavender #c760ff ivory #ffffcb very light purple #f6cefc light navy #155084 pink red #f5054f olive brown #645403 poop brown #7a5901 mustard green #a8b504 ocean green #3d9973 very dark blue #000133 dusty green #76a973 light navy blue #2e5a88 minty green #0bf77d adobe #bd6c48 barney #ac1db8 jade green #2baf6a bright light blue #26f7fd light lime #aefd6c dark khaki #9b8f55 orange yellow #ffad01 ocre #c69c04 maize #f4d054 faded pink #de9dac british racing green #05480d sandstone #c9ae74 mud brown #60460f light sea green #98f6b0 robin egg blue #8af1fe aqua marine #2ee8bb dark sea green #11875d soft pink #fdb0c0 orangey brown #b16002 cherry red #f7022a burnt yellow #d5ab09 brownish grey #86775f camel #c69f59 purplish grey #7a687f marine #042e60 greyish pink #c88d94 pale turquoise #a5fbd5 pastel yellow #fffe71 bluey purple #6241c7 canary yellow #fffe40 faded red #d3494e sepia #985e2b coffee #a6814c bright magenta #ff08e8 mocha #9d7651 ecru #feffca purpleish #98568d cranberry #9e003a darkish green #287c37 brown orange #b96902 dusky rose #ba6873 melon #ff7855 sickly green #94b21c silver #c5c9c7 purply blue #661aee purpleish blue #6140ef hospital green #9be5aa shit brown #7b5804 mid blue #276ab3 amber #feb308 easter green #8cfd7e soft blue #6488ea cerulean blue #056eee golden brown #b27a01 bright turquoise #0ffef9 red pink #fa2a55 red purple #820747 greyish brown #7a6a4f vermillion #f4320c russet #a13905 steel grey #6f828a lighter purple #a55af4 bright violet #ad0afd prussian blue #004577 slate green #658d6d dirty pink #ca7b80 dark blue green #005249 pine #2b5d34 yellowy green #bff128 dark gold #b59410 bluish #2976bb darkish blue #014182 dull red #bb3f3f pinky red #fc2647 bronze #a87900 pale teal #82cbb2 military green #667c3e barbie pink #fe46a5 bubblegum pink #fe83cc pea soup green #94a617 dark mustard #a88905 shit #7f5f00 medium purple #9e43a2 very dark green #062e03 dirt #8a6e45 dusky pink #cc7a8b red violet #9e0168 lemon yellow #fdff38 pistachio #c0fa8b dull yellow #eedc5b dark lime green #7ebd01 denim blue #3b5b92 teal blue #01889f lightish blue #3d7afd purpley blue #5f34e7 light indigo #6d5acf swamp green #748500 brown green #706c11 dark maroon #3c0008 hot purple #cb00f5 dark forest green #002d04 faded blue #658cbb drab green #749551 light lime green #b9ff66 snot green #9dc100 yellowish #faee66 light blue green #7efbb3 bordeaux #7b002c light mauve #c292a1 ocean #017b92 marigold #fcc006 muddy green #657432 dull orange #d8863b steel #738595 electric purple #aa23ff fluorescent green #08ff08 yellowish brown #9b7a01 blush #f29e8e soft green #6fc276 bright orange #ff5b00 lemon #fdff52 purple grey #866f85 acid green #8ffe09 pale lavender #eecffe violet blue #510ac9 light forest green #4f9153 burnt red #9f2305 khaki green #728639 cerise #de0c62 faded purple #916e99 apricot #ffb16d dark olive green #3c4d03 grey brown #7f7053 green grey #77926f true blue #010fcc pale violet #ceaefa periwinkle blue #8f99fb light sky blue #c6fcff blurple #5539cc green brown #544e03 bluegreen #017a79 bright teal #01f9c6 brownish yellow #c9b003 pea soup #929901 forest #0b5509 barney purple #a00498 ultramarine #2000b1 purplish #94568c puke yellow #c2be0e bluish grey #748b97 dark periwinkle #665fd1 dark lilac #9c6da5 reddish #c44240 light maroon #a24857 dusty purple #825f87 terra cotta #c9643b avocado #90b134 marine blue #01386a teal green #25a36f slate grey #59656d lighter green #75fd63 electric green #21fc0d dusty blue #5a86ad golden yellow #fec615 bright yellow #fffd01 light lavender #dfc5fe umber #b26400 poop #7f5e00 dark peach #de7e5d jungle green #048243 eggshell #ffffd4 denim #3b638c yellow brown #b79400 dull purple #84597e chocolate brown #411900 wine red #7b0323 neon blue #04d9ff dirty green #667e2c light tan #fbeeac ice blue #d7fffe cadet blue #4e7496 dark mauve #874c62 very light blue #d5ffff grey purple #826d8c pastel pink #ffbacd very light green #d1ffbd dark sky blue #448ee4 evergreen #05472a dull pink #d5869d aubergine #3d0734 mahogany #4a0100 reddish orange #f8481c deep green #02590f vomit green #89a203 purple pink #e03fd8 dusty pink #d58a94 faded green #7bb274 camo green #526525 pinky purple #c94cbe pink purple #db4bda brownish red #9e3623 dark rose #b5485d mud #735c12 brownish #9c6d57 emerald green #028f1e pale brown #b1916e dull blue #49759c burnt umber #a0450e medium green #39ad48 clay #b66a50 light aqua #8cffdb light olive green #a4be5c brownish orange #cb7723 dark aqua #05696b purplish pink #ce5dae dark salmon #c85a53 greenish grey #96ae8d jade #1fa774 ugly green #7a9703 dark beige #ac9362 emerald #01a049 pale red #d9544d light magenta #fa5ff7 sky #82cafc light cyan #acfffc yellow orange #fcb001 reddish purple #910951 reddish pink #fe2c54 orchid #c875c4 dirty yellow #cdc50a orange red #fd411e deep red #9a0200 orange brown #be6400 cobalt blue #030aa7 neon pink #fe019a rose pink #f7879a greyish purple #887191 raspberry #b00149 aqua green #12e193 salmon pink #fe7b7c tangerine #ff9408 brownish green #6a6e09 red brown #8b2e16 greenish brown #696112 pumpkin #e17701 pine green #0a481e charcoal #343837 baby pink #ffb7ce cornflower #6a79f7 blue violet #5d06e9 chocolate #3d1c02 greyish green #82a67d scarlet #be0119 green yellow #c9ff27 dark olive #373e02 sienna #a9561e pastel purple #caa0ff terracotta #ca6641 aqua blue #02d8e9 sage green #88b378 blood red #980002 deep pink #cb0162 grass #5cac2d moss #769958 pastel blue #a2bffe bluish green #10a674 green blue #06b48b dark tan #af884a greenish blue #0b8b87 pale orange #ffa756 vomit #a2a415 forrest green #154406 dark lavender #856798 dark violet #34013f purple blue #632de9 dark cyan #0a888a olive drab #6f7632 pinkish #d46a7e cobalt #1e488f neon purple #bc13fe light turquoise #7ef4cc apple green #76cd26 dull green #74a662 wine #80013f powder blue #b1d1fc off white #ffffe4 electric blue #0652ff dark turquoise #045c5a blue purple #5729ce azure #069af3 bright red #ff000d pinkish red #f10c45 cornflower blue #5170d7 light olive #acbf69 grape #6c3461 greyish blue #5e819d purplish blue #601ef9 yellowish green #b0dd16 greenish yellow #cdfd02 medium blue #2c6fbb dusty rose #c0737a light violet #d6b4fc midnight blue #020035 bluish purple #703be7 red orange #fd3c06 dark magenta #960056 greenish #40a368 ocean blue #03719c coral #fc5a50 cream #ffffc2 reddish brown #7f2b0a burnt sienna #b04e0f brick #a03623 sage #87ae73 grey green #789b73 white #ffffff robin's egg blue #98eff9 moss green #658b38 steel blue #5a7d9a eggplant #380835 light yellow #fffe7a leaf green #5ca904 light grey #d8dcd6 puke #a5a502 pinkish purple #d648d7 sea blue #047495 pale purple #b790d4 slate blue #5b7c99 blue grey #607c8e hunter green #0b4008 fuchsia #ed0dd9 crimson #8c000f pale yellow #ffff84 ochre #bf9005 mustard yellow #d2bd0a light red #ff474c cerulean #0485d1 pale pink #ffcfdc deep blue #040273 rust #a83c09 light teal #90e4c1 slate #516572 goldenrod #fac205 dark yellow #d5b60a dark grey #363737 army green #4b5d16 grey blue #6b8ba4 seafoam #80f9ad puce #a57e52 spring green #a9f971 dark orange #c65102 sand #e2ca76 pastel green #b0ff9d mint #9ffeb0 light orange #fdaa48 bright pink #fe01b1 chartreuse #c1f80a deep purple #36013f dark brown #341c02 taupe #b9a281 pea green #8eab12 puke green #9aae07 kelly green #02ab2e seafoam green #7af9ab blue green #137e6d khaki #aaa662 burgundy #610023 dark teal #014d4e brick red #8f1402 royal purple #4b006e plum #580f41 mint green #8fff9f gold #dbb40c baby blue #a2cffe yellow green #c0fb2d bright purple #be03fd dark red #840000 pale blue #d0fefe grass green #3f9b0b navy #01153e aquamarine #04d8b2 burnt orange #c04e01 neon green #0cff0c bright blue #0165fc rose #cf6275 light pink #ffd1df mustard #ceb301 indigo #380282 lime #aaff32 sea green #53fca1 periwinkle #8e82fe dark pink #cb416b olive green #677a04 peach #ffb07c pale green #c7fdb5 light brown #ad8150 hot pink #ff028d black #000000 lilac #cea2fd navy blue #001146 royal blue #0504aa beige #e6daa6 salmon #ff796c olive #6e750e maroon #650021 bright green #01ff07 dark purple #35063e mauve #ae7181 forest green #06470c aqua #13eac9 cyan #00ffff tan #d1b26f dark blue #00035b lavender #c79fef turquoise #06c2ac dark green #033500 violet #9a0eea light purple #bf77f6 lime green #89fe05 grey #929591 sky blue #75bbfd yellow #ffff14 magenta #c20078 light green #96f97b orange #f97306 teal #029386 light blue #95d0fc red #e50000 brown #653700 pink #ff81c0 blue #0343df green #15b01a purple #7e1e9c svgwrite-1.4.1/examples/ltattrie/runall.bat000066400000000000000000000000541400026116000210070ustar00rootroot00000000000000@echo off for %%e in (*.py) do python %%e svgwrite-1.4.1/examples/ltattrie/runall.sh000066400000000000000000000001041400026116000206470ustar00rootroot00000000000000#!/bin/sh for f in `ls *.py` do echo running $f ... python $f done svgwrite-1.4.1/examples/ltattrie/runall3.bat000066400000000000000000000000551400026116000210730ustar00rootroot00000000000000@echo off for %%e in (*.py) do python3 %%e svgwrite-1.4.1/examples/ltattrie/tenticles.py000066400000000000000000000343041400026116000213730ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import math, sys import random import svgwrite # globals PROGNAME = sys.argv[0].rstrip('.py') file_log = '' dwg = '' def gen_colour(start_p, end_p, n_p): """ gen_colour generates a list of colours from start to end. Colours are linearly interpreted between start and end. start and end must be (int, int, int), n integer is how many colours are to be generated. """ c_start = start_p c_end = end_p n = n_p # yielding a c_end separately gives the exact c_end thus not something that is 99.99% c_end which is slightly off colour. for i in range(n): ccolour = (int(c_start[0] + (i / n) * (c_end[0] - c_start[0])), int(c_start[1] + (i / n) * (c_end[1] - c_start[1])), int(c_start[2] + (i / n) * (c_end[2] - c_start[2]))) yield ccolour yield c_end def gen_incr_num(): i = 0 while True: i += 1 yield i unique_num = gen_incr_num() class tendrile: #global angle_max #global angle_min global file_log global dwg global unique_num def __init__(self, p_x, p_y, p_width, p_angle, p_step, p_v, p_curl, p_n, p_scolour, p_ecolour, p_can_branch): """tendrile class instance for each arm """ self.x = p_x self.y = p_y self.width = p_width #self.angle = max(min(p_angle, angle_max), angle_min) # limit value of angle self.angle_set(p_angle) # limit value of angle self.step = p_step self.v = p_v self.curl = p_curl self.n = p_n # length of tendrile self.scolour = p_scolour # starting colour self.ecolour = p_ecolour # ending colour self.can_branch = p_can_branch # Can tendrile branch? self.stroke_width = 1 self.lin_colour = gen_colour(self.scolour, self.ecolour, self.n) self.r = self.width # The purpose of having a group for all of the circles is be able to add all of the circles # of a tendrile to the drawing at the same time. If a tendrile branches, creating a new # tendrile the new tendrile will be drawn completely before the older tendrile is drawn. # This puts the new tendrile in the background and the old tendrile in front. When the # program had been written to start writting the old tendrile, write the new tendrile, then # finish the old tendrile there was a problem that slivers of some of the new tendrile's # colour was over top of the old tendrile causing a confusing mix of colour. # Using a group does create a small problem. The whole new tendrile is in the background of # the whole old tendrile. This is not perspectively correct because if a old tendrile # branches near the end of the tendrile the new tendrile should be in front of any part of # of the beginning part of the old tendrile but instead the new tendrile will be behind all # of the old tendrile. self.group = dwg.g(id='branch' + str(next(unique_num))) #file_log.write("new tend x="+ str(self.x)+ # " y="+str(self.y)+ # " width="+str(self.width)+ # " angle="+str(self.angle)+ # " step="+str(self.step)+ # " v="+str(self.v)+ # " curl="+str(self.curl)+ # " n="+str(self.n)+ # "\n") def angle_set(self, p_val): # limit the angle to range -2*math.pi to 2*math.pi which is +- full circle. # Use math.fmod because % returns with the sign of the second number. self.angle = math.fmod(p_val, 2 * math.pi) def create(self): global file_log #green_light1 =(102, 229, 132) # starting colour. Colour will linearly change to ending colour. #green_dark1=(25, 76, 37) #v =0.0 #branch_at = (self.n * 1) / 10 for i in range(self.n): if i != 0: # if (i == 2) #random.randint(1, 100) #if (i == branch_at) and self.can_branch: if (random.randint(1, 100) == 1) and self.can_branch: distance = self.r * .8 # The new circle is % of the previouse circle's width x_temp = self.x + math.cos(self.angle) * distance y_temp = self.y + math.sin(self.angle) * distance # separate angles for branches #v_rand = 3*random.uniform(-self.step, self.step) #v_rand = random.uniform(-self.step, self.step) v_delta_split = math.pi / 31.4 # .05 degrees #v_rand = random.uniform(0.0, self.step) +math.pi/6.0 #30 degrees self.v = self.v + v_delta_split + random.uniform(-self.step, self.step) self.v *= 0.9 + self.curl * 0.1 #self.angle += self.v self.angle_set(self.angle + self.v) # limit value of angle #self.angle = max(min(self.angle, angle_max), angle_min) # limit value of angle # draw branch #tend = tendrile(x_temp, y_temp, self.r, angle_temp, self.step, self.v, (-1*self.curl), (self.n-i-1), new_colour, self.ecolour, False) #file_log.write("before new tend x="+ str(self.x)+ # " y="+str(self.y)+ # " r="+str(self.r)+ # " angle="+str(self.angle)+ # " step="+str(self.step)+ # " curl="+str(self.curl)+ # " i="+str(i)+ # " v="+str(self.v)+ # "\n") #file_log.write("******************************************************************"+ #"\n") ## Branch creating a new smaller tendrile #pink1=(251,170,176) # debug #tend = tendrile(x_temp, y_temp, self.r, self.angle, (self.step*1.2), (-1.0*self.v), self.curl, (self.n-i-1), green_dark1, green_light1, False) # create the tendrile # The use of the original colour, usually darker green, to start the new tendrile gives a slight look # of shadow on the the start of the new tendrile. It also gives a clear visual # separation between the existing tendrile and the new tendrile. tend = tendrile(x_temp, y_temp, self.r, self.angle, (self.step * 1.2), (-1 * self.v), self.curl, (self.n - i - 1), self.scolour, self.ecolour, False) # create the tendrile as svg elements tend.create() # draw the tendrile as svg elements tend.draw() #file_log.write("******************************************************************"+ #"\n") #file_log.write("after tend x="+ str(self.x)+ # " y="+str(self.y)+ # " r="+str(self.r)+ # " angle="+str(self.angle)+ # " step="+str(self.step)+ # " curl="+str(self.curl)+ # " i="+str(i)+ # " v="+str(self.v)+ # "\n") #self.v = self.v - v_rand -math.pi/6.0 # change angle of tendrile #self.v = self.v - v_rand #self.v *= 0.9 + self.curl*0.1 #self.angle += self.v self.x += math.cos(self.angle) * distance self.y += math.sin(self.angle) * distance # set up angle for next circle self.v += random.uniform(-self.step, self.step) self.v *= 0.9 + self.curl * 0.1 self.angle_set(self.angle + self.v) # limit value of angle #self.angle += self.v #self.angle = max(min(self.angle, angle_max), angle_min) # limit value of angle else: distance = self.r * .8 # The new circle is % of the previouse circle's width self.x += math.cos(self.angle) * distance self.y += math.sin(self.angle) * distance #file_log.write("tend x="+ str(self.x)+ # " y="+str(self.y)+ # " r="+str(self.r)+ # " angle="+str(self.angle)+ # " step="+str(self.step)+ # " curl="+str(self.curl)+ # " i="+str(i)+ # " v="+str(self.v)+ # "\n") self.v += random.uniform(-self.step, self.step) self.v *= 0.9 + self.curl * 0.1 #self.angle += self.v self.angle_set(self.angle + self.v) # limit value of angle #self.angle = max(min(self.angle, angle_max), angle_min) # limit value of angle self.r = (1 - i / self.n) * self.width # radius size gradually decreases. ## new_colour = next(self.lin_colour) stroke_colour = 'rgb(%s,%s,%s)' % new_colour fill_colour = 'rgb(%s,%s,%s)' % new_colour self.group.add(dwg.circle(center=(self.x, self.y), r=self.r, fill=fill_colour, stroke=stroke_colour, stroke_width=3)) def draw(self): global file_log dwg.add(self.group) def create_svg(name): """ Create many circles in a curling tentril fashion. """ global file_log global dwg svg_size_width = 900 svg_size_height = 900 dwg = svgwrite.Drawing(name, (svg_size_width, svg_size_height), debug=True) # Background will be black so the background does not overwhelm the colors. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), rx=None, ry=None, fill='black')) #angle_max = 2*math.pi # maximum angle allowed. 360 degrees. #angle_min = -1 * angle_max # minimum angle allowed -360 degrees. #file_log = open("tendriles_branch.log", "w") # Create effect instance and apply it. # option values. n = 100 # number of circles default 100 #n = 20 # number of circles default 100 num_arms = 5 # number of tendriles default 5 #num_arms = 10 # number of tendriles default 5 #num_arms = 1 # number of tendriles default 5 d_width = svg_size_width d_height = svg_size_height ########################### #x_org = d_height / 10 #y_org = d_width / 10 #delta_x = d_width / 6 #delta_y = d_width / 10 ########################### stroke_width = 1 #n = 200 #number of circles #n = 75 #number of circles #num_arms = 9 #step = 0.05 #step = 0.02 step = 4 / n #curl = 1.0 #c_width= d_width/12.0 #c_width= d_width/50.0 green_light1 = (102, 229, 132) # starting colour. Colour will linearly change to ending colour. green_dark1 = (25, 76, 37) salmon1 = (240, 184, 178) pink1 = (251, 170, 176) pink2 = (255, 170, 204) pink2light = (255, 215, 231) pink2dsat = (247, 225, 234) blue1 = (193, 197, 251) grey7_5 = (236, 236, 236) grey80 = (51, 51, 51) # starting colour. Colour will linearly change to ending colour. #start_colour = pink2light #end_colour = blue1 start_colour = green_dark1 end_colour = green_light1 #distance = 9.0 #distance = c_width/3.0 # The next circle is 1/3 the original circle's width from the centre. #n - number of circles in each tendrile. #num_arms - number of arms that is tendriles. # x, y - centre of current circle, 0,0 is top left of screen # c_width - initial circle width. # r - radius of current circle. gradually decreases. # distance - length to next circle. # angle - angle to next circle. value -pi to +pi. # step - range of randomness of angle. constant. # curl - how much curl will happen. constant. .1*curl incremented to v, angle. # v - change in angle. random value -step to +step plus curl # can_branch - true or false. Can this tendrile branch? can_branch = True #can_branch = False ########################### # The change in the starting colour is small so all of the tenticles seem like a group but # still have a very slight variation to give individuality. If the starting colour is too # different the arms look like they are not connected at the centre. #start_lin_colour = gen_colour(start_colour, blue1, num_arms) # debug start_lin_colour = gen_colour(start_colour, end_colour, num_arms * 8) # Create all tendriles for j in range(num_arms): # set start of arm x y x = d_height / 2 y = d_width / 2 angle = random.uniform(-math.pi, math.pi) # random angle in radians. 2*pi radians = 360 degrees v = 0.0 # variety to the size of the starting circle c_width = random.uniform((d_width * .015), (d_width * .025)) r = random.uniform((c_width * .9), (c_width * 1.1)) new_start_colour = next(start_lin_colour) #curl = random.choice((-1, 1)) # random.choice picks random item from list #curl = random.choice((-1.1, 1.1)) # random.choice picks random item from list #curl = random.choice((-1.05, 1.05)) # random.choice picks random item from list #curl = 1.1 curl = 1.0 # create a tendrile tend = tendrile(x, y, r, angle, step, v, curl, n, new_start_colour, end_colour, can_branch) #tend = tendrile(x, y, r, angle, step, v, curl, n, blue1, end_colour, can_branch) # create the tendrile as svg elements tend.create() # draw the tendrile as svg elements tend.draw() #file_log.close() dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/text_font_generic_family.py000066400000000000000000000032551400026116000244510ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite # http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#propdef-font-family # 'serif', 'sans-serif', 'cursive', 'fantasy', and 'monospace' from the CSS specification PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): svg_size = 900 font_size = 20 title = name + ': Example of text using generic family fonts' font_family_sample = (('serif', 'have finishing strokes, flared or tapering ends.'), ('sans-serif', 'have stroke endings that are plain.'), ('cursive', 'the characters are partially or completely connected'), ('fantasy', ' primarily decorative characters.'), ('monospace', 'all characters have the same fixed width.')) dwg = svgwrite.Drawing(name, (svg_size, svg_size), debug=True) # background will be white. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='white')) # give the name of the example and a title. dwg.add(dwg.text(title, insert=(0, (font_size + 5)), font_family="serif", font_size=font_size, fill='black')) for i, font_family_item in enumerate(font_family_sample): dwg.add(dwg.text("font_family='" + font_family_item[0] + "': " + font_family_item[1], insert=(font_size, font_size * (i * 2 + 4)), font_family=font_family_item[0], font_size=font_size, fill='black')) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/text_font_size.py000066400000000000000000000040641400026116000224450ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite PROGNAME = sys.argv[0].rstrip('.py') # http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-size-props def create_svg(name): svg_size = 900 font_size = 20 title = name + ': Example of text font_sizes' sample = (8, 10, 12, 15, 20, 30, 40, 50) dwg = svgwrite.Drawing(name, (svg_size, svg_size), debug=True) # background will be white. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='white')) # give the name of the example and a title. y = font_size + 5 dwg.add(dwg.text(title, insert=(0, y), font_family="serif", font_size=font_size, fill='black')) for i, item in enumerate(sample): # font_size has many properties and adjustments which can be done. See the web page listed # above for the complete description. y += item + 10 dwg.add(dwg.text("font_size='" + str(item) + "'", insert=(font_size, y), font_family="serif", font_size=item, fill='black')) y += font_size + 10 dwg.add(dwg.text('Since svg fonts are usually vectors, font_size can be very large.', insert=(0, y), font_family="serif", font_size=font_size, fill='black')) y += font_size + 10 # Show just the top of the single letter 'f'. The whole letter will not fit in the view area. dwg.add(dwg.text('Enlarged small parts of a character are like looking through a microscope. (font_size=4000)', insert=(0, y), font_family="serif", font_size=font_size, fill='black')) y += 2800 + 10 # Note the insert value of x is a negative number which is actually outside the view area. dwg.add(dwg.text('f', insert=(-1100, y), font_family="serif", font_size=4000, fill='black')) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/text_justify.py000066400000000000000000000032741400026116000221440ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): svg_size = 900 font_size = 20 title = name + ': Example of text_anchor (justified) text' dwg = svgwrite.Drawing(name, (svg_size, svg_size), debug=True) # background will be white. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='white')) # give the name of the example and a title. dwg.add(dwg.text(title, insert=(0, (font_size + 5)), font_family="serif", font_size=font_size, fill='black')) # Show default dwg.add(dwg.text("No specified text_anchor means 'start' justified text", insert=('50%', font_size * 3), font_family="sans-serif", font_size=font_size, fill='black')) # add a circle to show the anchor point printing on top of the text. dwg.add(dwg.circle(('50%', font_size * 3), r='3px', fill='red')) for i, anchor in enumerate(['start', 'end', 'middle']): # also 'inherit' which inherits from parent. dwg.add(dwg.text("text_anchor='" + anchor + "' means " + anchor + " justified text", insert=('50%', font_size * (i + 4)), text_anchor=anchor, font_family="sans-serif", font_size=font_size, fill='black')) # add a circle to show the anchor point printing on top of the text. dwg.add(dwg.circle(('50%', font_size * (i + 4)), r='3px', fill='red')) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/tiling_part_1.py000066400000000000000000000237251400026116000221420ustar00rootroot00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite # http://www.w3.org/TR/SVG11/struct.html#UseElement # # For more information on tesselation / tiling see http://en.wikipedia.org/wiki/Wallpaper_group # The organization of these tilings are from the interesting book # Designing Testellations: The Secrets of Interlocking Patterns by Jinny Beyer. PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): svg_size_width = 900 svg_size_height = 2800 font_size = 20 square_size = 30 title1 = name + ': Part 1 tiling with multiple def, groups, use, translate and scale.' sample = () dwg = svgwrite.Drawing(name, (svg_size_width, svg_size_height), debug=True) # clip path to prevent drawing outside of tile # Having a clip path seems to increase the visibility of the lines between the tiles. # A clipping path may be necessary if the shapes go outside the triangle. # defs_g_kite = dwg.defs.add(dwg.g(id='defs_g_kite', clip_path='url(#clipkite)')) clip_path = dwg.defs.add(dwg.clipPath(id='clipsq')) # clip_path.add(dwg.circle((100, 100), 50)) clip_path.add(dwg.rect((0, 0), (square_size, square_size))) # define the group (tile) which will be repeated. defs_g = dwg.defs.add(dwg.g(id='defs_g', clip_path='url(#clipsq)')) defs_g.add(dwg.rect((0, 0), (square_size, square_size))) #defs_g.add(dwg.circle(center=(0, 5), r=6, stroke='blue', fill='green', stroke_width=1)) defs_g.add(dwg.ellipse(center=(5, 5), r=(5, 10), fill='green')) defs_g.add(dwg.polygon([(square_size / 2.0, 0), (square_size, square_size), (0, square_size)], stroke='none', fill='navy')) #defs_g.add(dwg.line(start=(0, 0), end=(square_size, square_size), stroke_width=2, stroke='black')) # Background will be dark but not black so the background does not overwhelm the colors. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), rx=None, ry=None, fill='grey')) # Give the name of the example and a title. y = font_size + 5 dwg.add(dwg.text(title1, insert=(0, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size + 20 # show sample of tile sq_created = dwg.use(defs_g, insert=(10, y), fill='yellow') dwg.add(sq_created) y += square_size title2 = 'Translation, math name: p1' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): sq_created = dwg.use(defs_g, insert=(50 + j * square_size, y), fill='yellow') dwg.add(sq_created) y += square_size # p2 (180 rotation to side) title2 = '180 rotation to side, math name: p2' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, insert=(x, y), fill='yellow') # rotate every second square if j % 2: sq_created.rotate(180, center=(x + square_size / 2, y + square_size / 2)) dwg.add(sq_created) y += square_size # p2 (180 rotation below) title2 = '180 rotation below, math name: p2' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, insert=(x, y), fill='yellow') # rotate every second row if i % 2 == 1: sq_created.rotate(180, center=(x + square_size / 2, y + square_size / 2)) dwg.add(sq_created) y += square_size # p2 (180 rotation side, below, and diagonally) title2 = '180 rotation below, math name: p2' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, insert=(x, y), fill='yellow') # rotate every second square if i % 2 != j % 2: sq_created.rotate(180, center=(x + square_size / 2, y + square_size / 2)) dwg.add(sq_created) y += square_size # p4 (90 rotation effectively rotating around the lower right corner.) title2 = '90 degree rotation around lower right, math name: p4' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, insert=(x, y), fill='yellow') # rotate every second square if i % 2 == 1: # odd row if j % 2: sq_created.rotate(-90, center=(x + square_size / 2, y + square_size / 2)) else: sq_created.rotate(180, center=(x + square_size / 2, y + square_size / 2)) elif j % 2: sq_created.rotate(90, center=(x + square_size / 2, y + square_size / 2)) dwg.add(sq_created) y += square_size # p4 (90 rotation effectively rotating around the upper left corner.) title2 = '90 degree rotation around upper left, math name: p4' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, insert=(x, y), fill='yellow') # rotate every second square if i % 2: # even row if j % 2: sq_created.rotate(180, center=(x + square_size / 2, y + square_size / 2)) else: sq_created.rotate(-90, center=(x + square_size / 2, y + square_size / 2)) elif j % 2: sq_created.rotate(90, center=(x + square_size / 2, y + square_size / 2)) dwg.add(sq_created) y += square_size # pg (moved horizontally then flipped vertically) # scale(1,-1) title2 = 'Glide: move horizontally then flip vertically, math name: pg' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') # flip vertically every second square if j % 2: # odd column 1, 3, 5 sq_created.translate(x, y + square_size) sq_created.scale(1, -1) else: # even column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += square_size # pg (moved vertically then flipped horizontally) title2 = 'Glide: move vertically then flip horizontally, math name: pg' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') # flip horizontally every second row if i % 2: # odd row 1, 3, 5 sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) else: # even row 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += square_size # pgg (moved horizontally then flipped vertically, moved vertically then flipped horizontally) title2 = 'Double Glide: Move vert, flip horiz. Move horiz flip vert. math name: pgg' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') if i % 2: # odd row 1, 3, 5 if j % 2: # odd column 1, 3, 5 # flip vertically and horizontally every second square sq_created.translate(x + square_size, y + square_size) sq_created.scale(-1, -1) else: # even column 0, 2, 4 # flip vertically every second square sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) elif j % 2: # even row 0, 2, 4 # odd column 1, 3, 5 # flip vertically every second square but start with the first square sq_created.translate(x, y + square_size) sq_created.scale(1, -1) else: # even row 0, 2, 4 # even column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/tiling_part_2.py000066400000000000000000000260631400026116000221410ustar00rootroot00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- #!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite PROGNAME = sys.argv[0].rstrip('.py') # # http://www.w3.org/TR/SVG11/struct.html#UseElement # # For more information on tesselation / tiling see http://en.wikipedia.org/wiki/Wallpaper_group # The organization of these tilings are from the interesting book # Designing Testellations: The Secrets of Interlocking Patterns by Jinny Beyer. def create_svg(name): svg_size_width = 900 svg_size_height = 2200 font_size = 20 square_size = 30 title1 = name + ': Part 2 tiling with multiple def, groups, use, translate and scale.' sample = () dwg = svgwrite.Drawing(name, (svg_size_width, svg_size_height), debug=True) # Having a clip path seems to increase the visibility of the lines between the tiles. # A clipping path may be necessary if the shapes go outside the triangle. # clip path to prevent drawing outside of tile clip_path = dwg.defs.add(dwg.clipPath(id='clipsq')) clip_path.add(dwg.rect((0, 0), (square_size, square_size))) # define the group (tile) which will be repeated. defs_g = dwg.defs.add(dwg.g(id='defs_g', clip_path='url(#clipsq)')) defs_g.add(dwg.rect((0, 0), (square_size, square_size))) defs_g.add(dwg.circle(center=(0, 10), r=5, stroke='blue', fill='green', stroke_width=1)) defs_g.add(dwg.polygon([(square_size, 0), (square_size, square_size), (0, square_size)], stroke='none', fill='navy')) # Background will be dark but not black so the background does not overwhelm the colors. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='grey')) # Give the name of the example and a title. y = font_size + 5 dwg.add(dwg.text(title1, insert=(0, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size + 20 # Sample of tile. y = y + 20 sq_created = dwg.use(defs_g, insert=(10, y), fill='yellow') dwg.add(sq_created) y += square_size # pm (mirror horizontally) title2 = 'Mirror horizontally, math name: pm' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') # flip vertically every second square if j % 2: # odd column 1, 3, 5 sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) else: # even column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y = y + square_size # pm (mirror vertically) title2 = 'Mirror vertically, math name: pm' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') # flip vertically every second row if i % 2: # odd row 1, 3, 5 sq_created.translate(x, y + square_size) sq_created.scale(1, -1) else: # even row 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += square_size # cm (move horizontally then mirror. That pair is then moved vertically and staggered.) title2 = 'Move horiz & mirror vert. Move vert & mirror vert, math name: cm' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') if i % 2: # odd row 1, 3, 5 if j % 2: # odd row 1, 3, 5 # odd column 1, 3, 5 sq_created.translate(x, y) else: # odd row 1, 3, 5 # even column 0, 2, 4 # flip vertically every second square sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) elif j % 2: # even row 0, 2, 4 # odd column 1, 3, 5 # flip vertically every second square sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) else: # even row 0, 2, 4 # even column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += square_size # cm (move vertically then mirror. That pair is then moved horizontally and staggered.) title2 = 'Move horiz & mirror horiz, Move vert & mirror horiz, math name: cm' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') if i % 2: # odd row 1, 3, 5 if j % 2: # odd row 1, 3, 5 # odd column 1, 3, 5 sq_created.translate(x, y) else: # odd row 1, 3, 5 # even column 0, 2, 4 # flip horizontally every second square sq_created.translate(x, y + square_size) sq_created.scale(1, -1) elif j % 2: # even row 0, 2, 4 # odd column 1, 3, 5 # flip horizontally every second square sq_created.translate(x, y + square_size) sq_created.scale(1, -1) else: # even row 0, 2, 4 # even column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += square_size # pmg (moved horizontally flip vertically. That pair is then moved vertically, mirrored and # staggered.) title2 = 'Move horiz mirror horiz. Pair is glided horiz and mirrored horiz, math name: pmg' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') if i % 2: # odd row 1, 3, 5 if j % 2: # odd row 1, 3, 5 # odd column 1, 3, 5 # flip horizontally every second square sq_created.translate(x, y + square_size) sq_created.scale(1, -1) else: # odd row 1, 3, 5 # even column 0, 2, 4 # flip vertically and horizontally every second square sq_created.translate(x + square_size, y + square_size) sq_created.scale(-1, -1) elif j % 2: # even row 0, 2, 4 # odd column 1, 3, 5 # flip vertically every second square sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) else: # even row 0, 2, 4 # even column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += square_size # pmg (moved vertically flip horizontally. That pair is then moved horizontally, mirrored and # staggered.) title2 = 'Move vert mirror vert. Pair is glided vert and mirrored horiz, math name: pmg' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') if i % 2: # odd row 1, 3, 5 if j % 2: # odd row 1, 3, 5 # odd column 1, 3, 5 # flip vertically every second square sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) else: # odd row 1, 3, 5 # even column 0, 2, 4 # flip horizontally every second square sq_created.translate(x, y + square_size) sq_created.scale(1, -1) elif j % 2: # even row 0, 2, 4 # odd column 1, 3, 5 # flip vertically and horizontally every second square sq_created.translate(x + square_size, y + square_size) sq_created.scale(-1, -1) else: # even row 0, 2, 4 # even column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += square_size # pmm (as if mirrors were placed on all sides of square and diagonally.) title2 = 'Mirror all sides, math name: pm' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') if i % 2: # odd row 1, 3, 5 if j % 2: # odd row 1, 3, 5 # odd column 1, 3, 5 # flip vertically and horizontally every second square sq_created.translate(x + square_size, y + square_size) sq_created.scale(-1, -1) else: # odd row 1, 3, 5 # even column 0, 2, 4 # flip horizontally every second square sq_created.translate(x, y + square_size) sq_created.scale(1, -1) elif j % 2: # even row 0, 2, 4 # odd column 1, 3, 5 # flip vertically every second square sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) else: # even row 0, 2, 4 # even column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) # All items have been added so save the svg to a the file. dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/tiling_part_3.py000066400000000000000000000372271400026116000221460ustar00rootroot00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- #!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import svgwrite # http://www.w3.org/TR/SVG11/struct.html#UseElement # # For more information on tesselation / tiling see http://en.wikipedia.org/wiki/Wallpaper_group # The organization of these tilings are from the interesting book # Designing Testellations: The Secrets of Interlocking Patterns by Jinny Beyer. PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): svg_size_width = 900 svg_size_height = 2000 font_size = 20 square_size = 30 title1 = name + ': Part 3 tiling with multiple def, groups, use, translate and scale.' sample = () dwg = svgwrite.Drawing(name, (svg_size_width, svg_size_height), debug=True) # clip path to prevent drawing outside of tile clip_path = dwg.defs.add(dwg.clipPath(id='clipsq')) # clip_path.add(dwg.circle((100, 100), 50)) clip_path.add(dwg.rect((0, 0), (square_size, square_size))) # define the group (tile) which will be repeated. defs_g = dwg.defs.add(dwg.g(id='defs_g', clip_path='url(#clipsq)')) # defs_g.add(dwg.rect((0,0), (square_size, square_size))) defs_g.add(dwg.rect((0, 0), (square_size, square_size))) defs_g.add(dwg.circle(center=(0, 10), r=5, stroke='blue', fill='green', stroke_width=1)) defs_g.add(dwg.polygon([(square_size, 0), (square_size, square_size), (0, square_size)], stroke='none', fill='navy')) # Background will be dark but not black so the background does not overwhelm the colors. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), rx=None, ry=None, fill='grey')) # Give the name of the example and a title. y = font_size + 5 dwg.add(dwg.text(title1, insert=(0, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size # # Sample of tile. y = y + 20 sq_created = dwg.use(defs_g, insert=(10, y), fill='yellow') dwg.add(sq_created) y += square_size # cmm variation 1 (as if mirrors were placed on all sides of square and diagonally.) # similar to pmm but the group of four tiles will be mirrored, staggered, or centered. title2 = 'Mirror all sides, then all are moved, variation 1, math name: cmm' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') if i % 2: # row 1, 3, 5 if j % 4 == 0: # column 0, 4, 8 # flip horizontally sq_created.translate(x, y + square_size) sq_created.scale(1, -1) elif j % 4 == 1: # column 1, 5, 9 # flip vertically and horizontally sq_created.translate(x + square_size, y + square_size) sq_created.scale(-1, -1) elif j % 4 == 2: # column 2, 6, 10 sq_created.translate(x, y) else: # column 3, 7, 11 # flip vertically sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) else: # row 0, 2, 4 if j % 4 == 0: # column 0, 4, 8 sq_created.translate(x, y) elif j % 4 == 1: # column 1, 5, 9 # flip vertically sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) elif j % 4 == 2: # column 2, 6, 10 # flip horizontally sq_created.translate(x, y + square_size) sq_created.scale(1, -1) else: # column 3, 7, 11 # flip vertically and horizontally sq_created.translate(x + square_size, y + square_size) sq_created.scale(-1, -1) dwg.add(sq_created) y += square_size # cmm variation 2 (as if mirrors were placed on all sides of square and diagonally.) # similar to pmm but the group of four tiles will be mirrored, staggered, or centered. title2 = 'Mirror all sides, then all are moved, variation 2, math name: cmm' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) y = y + font_size for i in range(8): y += square_size for j in range(16): x = 50 + j * square_size sq_created = dwg.use(defs_g, fill='yellow') if i % 2: # row 1, 3, 5 if j % 4 == 0: # column 0, 4, 8 # flip horizontally sq_created.translate(x, y + square_size) sq_created.scale(1, -1) elif j % 4 == 1: # column 1, 5, 9 sq_created.translate(x, y) elif j % 4 == 2: # column 2, 6, 10 # flip vertically and horizontally sq_created.translate(x + square_size, y + square_size) sq_created.scale(-1, -1) else: # column 3, 7, 11 # flip horizontally sq_created.translate(x, y + square_size) sq_created.scale(1, -1) else: # row 0, 2, 4 if j % 4 == 0: # column 0, 4, 8 # flip vertically and horizontally sq_created.translate(x + square_size, y + square_size) sq_created.scale(-1, -1) elif j % 4 == 1: # column 1, 5, 9 # flip horizontally sq_created.translate(x, y + square_size) sq_created.scale(1, -1) elif j % 4 == 2: # column 2, 6, 10 # flip vertically sq_created.translate(x + square_size, y) sq_created.scale(-1, 1) else: # column 3, 7, 11 sq_created.translate(x, y) dwg.add(sq_created) y += square_size # Instead of writing the p4g four times this code would have been better if it had been # put into a function and called indicating which corner is to be used for rotation. # p4g variation 1 (mirrored pinwheel which depending on which corner is the rotation center.) # lower right is the rotation corner defs_g_p4g_v1_size = square_size * 2 defs_g_lr_90 = dwg.defs.add(dwg.g(id='defs_g_lr_90')) defs_g_lr_90.add(dwg.use(defs_g, insert=(0, 0))) defs_g_lr_90.rotate(90, center=(square_size, square_size)) defs_g_lr_m90 = dwg.defs.add(dwg.g(id='defs_g_lr_m90')) defs_g_lr_m90.add(dwg.use(defs_g, insert=(0, 0))) defs_g_lr_m90.rotate(-90, center=(square_size, square_size)) defs_g_lr_180 = dwg.defs.add(dwg.g(id='defs_g_lr_180')) defs_g_lr_180.add(dwg.use(defs_g, insert=(0, 0))) defs_g_lr_180.rotate(180, center=(square_size, square_size)) defs_g_p4g_v1 = dwg.defs.add(dwg.g(id='defs_g_p4g_v1')) defs_g_p4g_v1.add(dwg.use(defs_g, insert=(0, 0))) defs_g_p4g_v1.add(dwg.use(defs_g_lr_90, insert=(0, 0))) defs_g_p4g_v1.add(dwg.use(defs_g_lr_m90, insert=(0, 0))) defs_g_p4g_v1.add(dwg.use(defs_g_lr_180, insert=(0, 0))) title2 = 'Mirrored pinwheel, rotate lower right, math name: p4g' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) # y = y + font_size for i in range(4): y += defs_g_p4g_v1_size for j in range(8): x = 50 + j * defs_g_p4g_v1_size sq_created = dwg.use(defs_g_p4g_v1, fill='yellow') if i % 2: # row 1, 3, 5 if j % 2: # column 1, 3, 5 sq_created.translate(x, y) else: # column 0, 2, 4 # flip horizontally sq_created.translate(x, y + defs_g_p4g_v1_size) sq_created.scale(1, -1) else: # row 0, 2, 4 if j % 2: # column 1, 3, 5 # flip vertically sq_created.translate(x + defs_g_p4g_v1_size, y) sq_created.scale(-1, 1) else: # column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += defs_g_p4g_v1_size # p4g variation 2 (mirrored pinwheel which depending on which corner is the rotation center.) # upper right is the rotation corner title2 = 'Mirrored pinwheel, rotate upper right, math name: p4g' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) # y = y + font_size defs_g_p4g_v2_size = square_size * 2 defs_g_ur_90 = dwg.defs.add(dwg.g(id='defs_g_ur_90')) defs_g_ur_90.add(dwg.use(defs_g, insert=(0, 0))) defs_g_ur_90.rotate(90, center=(square_size, 0)) defs_g_ur_m90 = dwg.defs.add(dwg.g(id='defs_g_ur_m90')) defs_g_ur_m90.add(dwg.use(defs_g, insert=(0, 0))) defs_g_ur_m90.rotate(-90, center=(square_size, 0)) defs_g_ur_180 = dwg.defs.add(dwg.g(id='defs_g_ur_180')) defs_g_ur_180.add(dwg.use(defs_g, insert=(0, 0))) defs_g_ur_180.rotate(180, center=(square_size, 0)) defs_g_p4g_v2 = dwg.defs.add(dwg.g(id='defs_g_p4g_v2')) defs_g_p4g_v2.add(dwg.use(defs_g, insert=(0, square_size))) defs_g_p4g_v2.add(dwg.use(defs_g_ur_90, insert=(0, square_size))) defs_g_p4g_v2.add(dwg.use(defs_g_ur_m90, insert=(0, square_size))) defs_g_p4g_v2.add(dwg.use(defs_g_ur_180, insert=(0, square_size))) for i in range(4): y += defs_g_p4g_v2_size for j in range(8): x = 50 + j * defs_g_p4g_v2_size sq_created = dwg.use(defs_g_p4g_v2, fill='yellow') if i % 2: # row 1, 3, 5 if j % 2: # column 1, 3, 5 sq_created.translate(x, y) else: # column 0, 2, 4 # flip horizontally sq_created.translate(x, y + defs_g_p4g_v2_size) sq_created.scale(1, -1) else: # row 0, 2, 4 if j % 2: # column 1, 3, 5 # flip vertically sq_created.translate(x + defs_g_p4g_v2_size, y) sq_created.scale(-1, 1) else: # column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += defs_g_p4g_v2_size # p4g variation 3 (mirrored pinwheel which depending on which corner is the rotation center.) # upper left is the rotation corner defs_g_p4g_v3_size = square_size * 2 defs_g_ul_90 = dwg.defs.add(dwg.g(id='defs_g_ul_90')) defs_g_ul_90.add(dwg.use(defs_g, insert=(0, 0))) defs_g_ul_90.rotate(90, center=(0, 0)) defs_g_ul_m90 = dwg.defs.add(dwg.g(id='defs_g_ul_m90')) defs_g_ul_m90.add(dwg.use(defs_g, insert=(0, 0))) defs_g_ul_m90.rotate(-90, center=(0, 0)) defs_g_ul_180 = dwg.defs.add(dwg.g(id='defs_g_ul_180')) defs_g_ul_180.add(dwg.use(defs_g, insert=(0, 0))) defs_g_ul_180.rotate(180, center=(0, 0)) defs_g_p4g_v3 = dwg.defs.add(dwg.g(id='defs_g_p4g_v3')) defs_g_p4g_v3.add(dwg.use(defs_g, insert=(square_size, square_size))) defs_g_p4g_v3.add(dwg.use(defs_g_ul_90, insert=(square_size, square_size))) defs_g_p4g_v3.add(dwg.use(defs_g_ul_m90, insert=(square_size, square_size))) defs_g_p4g_v3.add(dwg.use(defs_g_ul_180, insert=(square_size, square_size))) title2 = 'Mirrored pinwheel, rotate upper left, math name: p4g' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) # y = y + font_size for i in range(4): y += defs_g_p4g_v3_size for j in range(8): x = 50 + j * defs_g_p4g_v3_size sq_created = dwg.use(defs_g_p4g_v3, fill='yellow') if i % 2: # row 1, 3, 5 if j % 2: # column 1, 3, 5 sq_created.translate(x, y) else: # column 0, 2, 4 # flip horizontally sq_created.translate(x, y + defs_g_p4g_v3_size) sq_created.scale(1, -1) else: # row 0, 2, 4 if j % 2: # column 1, 3, 5 # flip vertically sq_created.translate(x + defs_g_p4g_v3_size, y) sq_created.scale(-1, 1) else: # column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) y += defs_g_p4g_v3_size # p4g variation 4 (mirrored pinwheel which depending on which corner is the rotation center.) # lower left is the rotation corner defs_g_p4g_v4_size = square_size * 2 defs_g_ll_90 = dwg.defs.add(dwg.g(id='defs_g_ll_90')) defs_g_ll_90.add(dwg.use(defs_g, insert=(0, 0))) defs_g_ll_90.rotate(90, center=(0, square_size)) defs_g_ll_m90 = dwg.defs.add(dwg.g(id='defs_g_ll_m90')) defs_g_ll_m90.add(dwg.use(defs_g, insert=(0, 0))) defs_g_ll_m90.rotate(-90, center=(0, square_size)) defs_g_ll_180 = dwg.defs.add(dwg.g(id='defs_g_ll_180')) defs_g_ll_180.add(dwg.use(defs_g, insert=(0, 0))) defs_g_ll_180.rotate(180, center=(0, square_size)) defs_g_p4g_v4 = dwg.defs.add(dwg.g(id='defs_g_p4g_v4')) defs_g_p4g_v4.add(dwg.use(defs_g, insert=(square_size, 0))) defs_g_p4g_v4.add(dwg.use(defs_g_ll_90, insert=(square_size, 0))) defs_g_p4g_v4.add(dwg.use(defs_g_ll_m90, insert=(square_size, 0))) defs_g_p4g_v4.add(dwg.use(defs_g_ll_180, insert=(square_size, 0))) title2 = 'Mirrored pinwheel, rotate lower left, math name: p4g' dwg.add(dwg.text(title2, insert=(50, y + square_size), font_family='serif', font_size=font_size, fill='white')) # y = y + font_size for i in range(4): y += defs_g_p4g_v4_size for j in range(8): x = 50 + j * defs_g_p4g_v4_size sq_created = dwg.use(defs_g_p4g_v4, fill='yellow') if i % 2: # row 1, 3, 5 if j % 2: # column 1, 3, 5 sq_created.translate(x, y) else: # column 0, 2, 4 # flip horizontally sq_created.translate(x, y + defs_g_p4g_v4_size) sq_created.scale(1, -1) else: # row 0, 2, 4 if j % 2: # column 1, 3, 5 # flip vertically sq_created.translate(x + defs_g_p4g_v4_size, y) sq_created.scale(-1, 1) else: # column 0, 2, 4 sq_created.translate(x, y) dwg.add(sq_created) # All items have been added so save the svg to a the file. dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/tiling_part_4.py000066400000000000000000000475431400026116000221510ustar00rootroot00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- #!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import math, sys import svgwrite # http://www.w3.org/TR/SVG11/struct.html#UseElement # # For more information on tesselation / tiling see http://en.wikipedia.org/wiki/Wallpaper_group # The organization of these tilings are from the interesting book # Designing Testellations: The Secrets of Interlocking Patterns by Jinny Beyer. PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): svg_size_width = 900 svg_size_height = 2200 font_size = 20 triangle_size = 30 square_size = 30 title1 = name + ': Part 4 tiling with multiple def, groups, use, translate and scale.' sqrt3 = math.sqrt(3) # do this calc once instead of repeating the calc many times. # sqrt2 = math.sqrt(2) # do this calc once instead of repeating the calc many times. 1.41421356237 dwg = svgwrite.Drawing(name, (svg_size_width, svg_size_height), debug=True) # 45 degrees, 90 degrees, 45 degrees Right angle triangle triright = dwg.defs.add(dwg.polygon([(0, 0), (triangle_size, 0), (triangle_size, triangle_size)], id='triangle', stroke='none')) # clip path to prevent drawing outside of tile clip_path_triright = dwg.defs.add(dwg.clipPath(id='cliptriright')) clip_path_triright.add(dwg.polygon([(0, 0), (triangle_size, 0), (triangle_size, triangle_size)])) # define the group (tile) which will be repeated. # Having a clip path seems to increase the visibility of the lines which can occur between tiles and patterns. defs_g_triright = dwg.defs.add(dwg.g(id='defs_g_triright', clip_path='url(#cliptriright)')) defs_g_triright.add(dwg.polygon([(0, 0), (triangle_size, 0), (triangle_size, triangle_size)], stroke='none')) defs_g_triright.add(dwg.polygon([(3 * triangle_size / 4, 0), (triangle_size, 0), (triangle_size, triangle_size)], stroke='none', fill='navy')) defs_g_triright.add(dwg.circle(center=(triangle_size / 2, triangle_size / 2), r=5, stroke='blue', fill='green', stroke_width=1)) # define the mirror of defs_g_triright defs_g_tr_m = dwg.defs.add(dwg.g(id='defs_g_tr_m')) defs_g_tr_m.add(dwg.use(defs_g_triright, insert=(0, 0))) defs_g_tr_m.rotate(90, center=(triangle_size / 2, triangle_size / 2)) defs_g_tr_m.translate(0, triangle_size) defs_g_tr_m.scale(1, -1) # defs_g_tr_m.rotate(-90, center=(triangle_size, triangle_size)) # defs_g_tr_m.rotate(-90, center=(0, 0)) # sq_created.translate(x, (y + defs_g_p4g_v1_size)) # create the cell by using one triangle and one mirrored triangle defs_g_p4m_cell_size = triangle_size defs_g_p4m_cell = dwg.defs.add(dwg.g(id='defs_g_p4m_cell')) # defs_g_p4m_cell.add(dwg.use(defs_g_triright, insert=(0, 0), fill='aqua')) defs_g_p4m_cell.add(dwg.use(defs_g_triright, insert=(0, 0))) defs_g_p4m_cell.add(dwg.use(defs_g_tr_m, insert=(0, 0))) # Create rotations of the cell. defs_g_p4m_cell_lr_90 = dwg.defs.add(dwg.g(id='defs_g_p4m_cell_lr_90')) defs_g_p4m_cell_lr_90.add(dwg.use(defs_g_p4m_cell, insert=(0, 0))) defs_g_p4m_cell_lr_90.rotate(90, center=(square_size, square_size)) defs_g_p4m_cell_lr_m90 = dwg.defs.add(dwg.g(id='defs_g_p4m_cell_lr_m90')) defs_g_p4m_cell_lr_m90.add(dwg.use(defs_g_p4m_cell, insert=(0, 0))) defs_g_p4m_cell_lr_m90.rotate(-90, center=(square_size, square_size)) defs_g_p4m_cell_lr_180 = dwg.defs.add(dwg.g(id='defs_g_p4m_cell_lr_180')) defs_g_p4m_cell_lr_180.add(dwg.use(defs_g_p4m_cell, insert=(0, 0))) defs_g_p4m_cell_lr_180.rotate(180, center=(square_size, square_size)) # Now use the cell and three rotated cells to create the pattern. defs_g_p4m_pattern_size = 2 * defs_g_p4m_cell_size defs_g_p4m_pattern = dwg.defs.add(dwg.g(id='defs_g_p4m_pattern')) defs_g_p4m_pattern.add(dwg.use(defs_g_p4m_cell, insert=(0, 0))) defs_g_p4m_pattern.add(dwg.use(defs_g_p4m_cell_lr_90, insert=(0, 0))) defs_g_p4m_pattern.add(dwg.use(defs_g_p4m_cell_lr_m90, insert=(0, 0))) defs_g_p4m_pattern.add(dwg.use(defs_g_p4m_cell_lr_180, insert=(0, 0))) # #################### # p3 - rombus - For the purpose of these tessellations a rombus is 4 * 30-60-90 triangles. # 30, 60, 90 angle triangle # The length of the sides are 1:sqrt(3):2 2 is the hypotenuse # invsqrt2 = 1/sqrt2 # invsqrt2_2 = invsqrt2 * invsqrt2 = 1/2 = .5 by definition # sin and cos(45 degrees) is 1/sqrt2 = 0.707106781187 # cos(30 degrees) is sqrt3/2 # sin(30 degrees) is 1/2 defs_g_rombus_size_x = square_size defs_g_rombus_scale = defs_g_rombus_size_x / (sqrt3 * 2) defs_g_rombus_size_y = 2 * defs_g_rombus_scale # Having a clip path seems to increase the visibility of the lines between the tiles. # A clipping path may be necessary if the shapes go outside the triangle. # defs_g_rombus = dwg.defs.add(dwg.g(id='defs_g_rombus', clip_path='url(#cliprombus)')) defs_g_rombus = dwg.defs.add(dwg.g(id='defs_g_rombus')) defs_g_rombus.add(dwg.polygon([(0, defs_g_rombus_size_y / 2), (defs_g_rombus_size_x / 2, 0), (0, -defs_g_rombus_size_y / 2), (-defs_g_rombus_size_x / 2, 0)], stroke='none')) defs_g_rombus.add(dwg.polygon([(0, -defs_g_rombus_size_y / 2), (defs_g_rombus_size_x / 4, defs_g_rombus_size_y / 4), (0, defs_g_rombus_size_y / 2)], stroke='none', fill='darkolivegreen')) # (0, defs_g_rombus_size_y/2.0) ], stroke='none', fill='aqua')) # (0, defs_g_rombus_size_y/2.0) ], stroke='none')) # (defs_g_rombus_size_x/4.0, defs_g_rombus_size_y/4.0), # (defs_g_rombus_size_x*invsqrt2_2/2.0, defs_g_rombus_size_y*invsqrt2_2/2.0), defs_g_rombus.add(dwg.polygon([(0, -defs_g_rombus_size_y / 2), (-defs_g_rombus_size_x / 2, 0), (0, 0)], stroke='none', fill='palegreen')) # Create rotations of the rombus. defs_g_rombus_120 = dwg.defs.add(dwg.g(id='defs_g_rombus_120')) defs_g_rombus_120.add(dwg.use(defs_g_rombus, insert=(0, 0))) defs_g_rombus_120.rotate(120, center=(0, 0)) defs_g_rombus_m120 = dwg.defs.add(dwg.g(id='defs_g_rombus_m120')) defs_g_rombus_m120.add(dwg.use(defs_g_rombus, insert=(0, 0))) defs_g_rombus_m120.rotate(-120, center=(0, 0)) # Create the pattern by using the cell and two rotated cells defs_g_rombus_pattern_size_x = defs_g_rombus_size_x defs_g_rombus_pattern_size_y = 2 * defs_g_rombus_size_y defs_g_rombus_pattern = dwg.defs.add(dwg.g(id='defs_g_rombus_pattern')) defs_g_rombus_pattern.add(dwg.use(defs_g_rombus, insert=(defs_g_rombus_size_x / 2, 3 * defs_g_rombus_size_y / 2))) defs_g_rombus_pattern.add(dwg.use(defs_g_rombus_120, insert=(defs_g_rombus_size_x / 4, 3 * defs_g_rombus_size_y / 4))) defs_g_rombus_pattern.add(dwg.use(defs_g_rombus_m120, insert=(.75 * defs_g_rombus_size_x, 3 * defs_g_rombus_size_y / 4))) # #################### # p6 - Equilateral triangle # All three sides are the same length, all three angles are 60 degrees. # The height of the triangle h = sqrt(3)/2.0 * length of a side # The centre of the triangle is sqrt(3)/6.0 * length of a side defs_g_trieq_size_x = square_size defs_g_trieq_size_y = defs_g_trieq_size_x * sqrt3 / 2 defs_g_trieq_centre = sqrt3 / 6 * defs_g_trieq_size_x # width of equilateral triangle at the centre defs_g_trieq_centre_size_x = defs_g_trieq_size_x - defs_g_trieq_size_x * defs_g_trieq_centre / defs_g_trieq_size_y # defs_g_trieq = dwg.defs.add(dwg.g(id='defs_g_trieq', clip_path='url(#cliptrieq)')) defs_g_trieq = dwg.defs.add(dwg.g(id='defs_g_trieq')) defs_g_trieq.add(dwg.polygon([(0, -defs_g_trieq_size_y + defs_g_trieq_centre), (defs_g_trieq_size_x / 2, defs_g_trieq_centre), (-defs_g_trieq_size_x / 2, defs_g_trieq_centre)], stroke='none')) defs_g_trieq.add(dwg.polygon([(-defs_g_trieq_size_x / 2, defs_g_trieq_centre), (-defs_g_trieq_centre_size_x / 2, 0), (defs_g_trieq_centre_size_x / 2, 0), (0, defs_g_trieq_centre)], stroke='none', fill='yellow')) # Create rotations of the equilateral triangle. defs_g_trieq_60 = dwg.defs.add(dwg.g(id='defs_g_trieq_60')) defs_g_trieq_60.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_60.rotate(60, center=(defs_g_trieq_size_x / 2, defs_g_trieq_centre)) defs_g_trieq_120 = dwg.defs.add(dwg.g(id='defs_g_trieq_120')) defs_g_trieq_120.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_120.rotate(120, center=(defs_g_trieq_size_x / 2, defs_g_trieq_centre)) defs_g_trieq_180 = dwg.defs.add(dwg.g(id='defs_g_trieq_180')) defs_g_trieq_180.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_180.rotate(180, center=(defs_g_trieq_size_x / 2, defs_g_trieq_centre)) defs_g_trieq_m60 = dwg.defs.add(dwg.g(id='defs_g_trieq_m60')) defs_g_trieq_m60.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_m60.rotate(-60, center=(defs_g_trieq_size_x / 2, defs_g_trieq_centre)) defs_g_trieq_m120 = dwg.defs.add(dwg.g(id='defs_g_trieq_m120')) defs_g_trieq_m120.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_m120.rotate(-120, center=(defs_g_trieq_size_x / 2, defs_g_trieq_centre)) # Now use the cell and five rotated cells to create the pattern. defs_g_trieq_pattern_size_x = 2 * defs_g_trieq_size_x defs_g_trieq_pattern_size_y = 2 * defs_g_trieq_size_y defs_g_trieq_pattern = dwg.defs.add(dwg.g(id='defs_g_trieq_pattern')) defs_g_trieq_pattern.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_pattern.add(dwg.use(defs_g_trieq_60, insert=(0, 0))) defs_g_trieq_pattern.add(dwg.use(defs_g_trieq_120, insert=(0, 0))) defs_g_trieq_pattern.add(dwg.use(defs_g_trieq_180, insert=(0, 0))) defs_g_trieq_pattern.add(dwg.use(defs_g_trieq_m60, insert=(0, 0))) defs_g_trieq_pattern.add(dwg.use(defs_g_trieq_m120, insert=(0, 0))) # Create centered rotations of the equilateral triangle. defs_g_trieq_c60 = dwg.defs.add(dwg.g(id='defs_g_trieq_c60')) defs_g_trieq_c60.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_c60.rotate(60, center=(0, 0)) defs_g_trieq_c120 = dwg.defs.add(dwg.g(id='defs_g_trieq_c120')) defs_g_trieq_c120.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_c120.rotate(120, center=(0, 0)) defs_g_trieq_c180 = dwg.defs.add(dwg.g(id='defs_g_trieq_c180')) defs_g_trieq_c180.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_c180.rotate(180, center=(0, 0)) defs_g_trieq_cm60 = dwg.defs.add(dwg.g(id='defs_g_trieq_cm60')) defs_g_trieq_cm60.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_cm60.rotate(-60, center=(0, 0)) defs_g_trieq_cm120 = dwg.defs.add(dwg.g(id='defs_g_trieq_cm120')) defs_g_trieq_cm120.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_cm120.rotate(-120, center=(0, 0)) # Now use the cell and five rotated cells to create the pattern variation 2. # Variation 2 is the equilateral triangle rotated around a the upper corner. defs_g_trieq_pattern_v2_size_x = 2 * defs_g_trieq_size_x defs_g_trieq_pattern_v2_size_y = 2 * defs_g_trieq_size_y defs_g_trieq_pattern_v2 = dwg.defs.add(dwg.g(id='defs_g_trieq_pattern_v2')) defs_g_trieq_pattern_v2.add(dwg.use(defs_g_trieq, insert=(0, defs_g_trieq_size_y - defs_g_trieq_centre))) defs_g_trieq_pattern_v2.add(dwg.use(defs_g_trieq_c60, insert=(-defs_g_trieq_size_x / 2, defs_g_trieq_centre))) defs_g_trieq_pattern_v2.add(dwg.use(defs_g_trieq_c120, insert=(-defs_g_trieq_size_x / 2, -defs_g_trieq_centre))) defs_g_trieq_pattern_v2.add(dwg.use(defs_g_trieq_c180, insert=(0, defs_g_trieq_centre - defs_g_trieq_size_y))) defs_g_trieq_pattern_v2.add(dwg.use(defs_g_trieq_cm60, insert=(defs_g_trieq_size_x / 2, defs_g_trieq_centre))) defs_g_trieq_pattern_v2.add(dwg.use(defs_g_trieq_cm120, insert=(defs_g_trieq_size_x / 2, -defs_g_trieq_centre))) # Now use the cell and five rotated cells to create the pattern variation 3. # Variation 3 is the equilateral triangle rotated around a the lower left corner. defs_g_trieq_pattern_v3_size_x = 2 * defs_g_trieq_size_x defs_g_trieq_pattern_v3_size_y = 2 * defs_g_trieq_size_y defs_g_trieq_pattern_v3 = dwg.defs.add(dwg.g(id='defs_g_trieq_pattern_v3')) defs_g_trieq_pattern_v3.add(dwg.use(defs_g_trieq, insert=(defs_g_trieq_size_x / 2, -defs_g_trieq_centre))) defs_g_trieq_pattern_v3.add(dwg.use(defs_g_trieq_c60, insert=(defs_g_trieq_size_x / 2, defs_g_trieq_centre))) defs_g_trieq_pattern_v3.add(dwg.use(defs_g_trieq_c120, insert=(0, defs_g_trieq_size_y - defs_g_trieq_centre))) defs_g_trieq_pattern_v3.add(dwg.use(defs_g_trieq_c180, insert=(-defs_g_trieq_size_x / 2, defs_g_trieq_centre))) defs_g_trieq_pattern_v3.add(dwg.use(defs_g_trieq_cm60, insert=(0, defs_g_trieq_centre - defs_g_trieq_size_y))) defs_g_trieq_pattern_v3.add(dwg.use(defs_g_trieq_cm120, insert=(-defs_g_trieq_size_x / 2, -defs_g_trieq_centre))) # ######################## # Background will be dark but not black so the background does not overwhelm the colors. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), rx=None, ry=None, fill='grey')) # Give the name of the example and a title. y = font_size + 5 dwg.add(dwg.text(title1, insert=(0, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size # # p4m 45 45 90 triangle title2 = '45 45 90 triangle mirrored and rotated, math name: p4m' dwg.add(dwg.text(title2, insert=(50, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size # Sample of tile. y = y + triangle_size tri_created = dwg.use(defs_g_triright, insert=(50, y), fill='yellow') dwg.add(tri_created) tri_created = dwg.use(defs_g_p4m_cell, insert=(150, y), fill='yellow') dwg.add(tri_created) tri_created = dwg.use(defs_g_p4m_pattern, insert=(250, y), fill='yellow') dwg.add(tri_created) y = y + defs_g_p4m_pattern_size for i in range(4): y += defs_g_p4m_pattern_size for j in range(8): x = 50 + j * defs_g_p4m_pattern_size sq_created = dwg.use(defs_g_p4m_pattern, fill='yellow') sq_created.translate(x, y) dwg.add(sq_created) y += 2 * defs_g_p4m_pattern_size # p4m rombus title2 = 'Rombus rotated, math name: p3' dwg.add(dwg.text(title2, insert=(50, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size # Sample of tile. # rombus_created = dwg.use(defs_g_rombus, insert=(100, y ), fill='yellow') rombus_created = dwg.use(defs_g_rombus, insert=(75, y), fill='black') dwg.add(rombus_created) tile_created = dwg.use(defs_g_rombus_120, insert=(150, y), fill='black') dwg.add(tile_created) pattern_created = dwg.use(defs_g_rombus_pattern, insert=(250, y), fill='black') dwg.add(pattern_created) y = y + defs_g_rombus_size_y y_offset = defs_g_rombus_size_y / 2 for i in range(12): y += defs_g_rombus_pattern_size_y - y_offset for j in range(16): if i % 2: x = 50 + defs_g_rombus_pattern_size_x / 2 + j * defs_g_rombus_pattern_size_x else: x = 50 + j * defs_g_rombus_pattern_size_x pattern_created = dwg.use(defs_g_rombus_pattern, fill='black') pattern_created.translate(x, y) dwg.add(pattern_created) y += 2 * defs_g_rombus_pattern_size_y # p6 Equilateral triangle title2 = 'Equilateral triangle rotated lower right point, math name: p6' dwg.add(dwg.text(title2, insert=(50, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size # Sample of tile. y = y + triangle_size tri_created = dwg.use(defs_g_trieq, insert=(50 + defs_g_trieq_size_x / 2, y), fill='navy') dwg.add(tri_created) dwg.add(dwg.circle(center=(50 + defs_g_trieq_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) tile_created = dwg.use(defs_g_trieq_pattern, insert=(150 + defs_g_trieq_pattern_size_x / 2, y), fill='navy') dwg.add(tile_created) dwg.add(dwg.circle(center=(150 + defs_g_trieq_pattern_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) y += defs_g_trieq_pattern_size_y for i in range(9): y += defs_g_trieq_pattern_size_y / 2 for j in range(6): if i % 2: x = 50 + j * 1.5 * defs_g_trieq_pattern_size_x else: x = 50 + 1.5 * defs_g_trieq_size_x + j * 1.5 * defs_g_trieq_pattern_size_x pattern_created = dwg.use(defs_g_trieq_pattern, fill='navy') pattern_created.translate(x, y) dwg.add(pattern_created) y += defs_g_trieq_pattern_size_y title2 = 'Equilateral triangle rotated upper point, math name: p6' dwg.add(dwg.text(title2, insert=(50, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size + defs_g_trieq_pattern_size_y # sample centered rotated eqilateral triangle variation 2 tri_created = dwg.use(defs_g_trieq, insert=(50 + defs_g_trieq_size_x / 2, y), fill='navy') dwg.add(tri_created) dwg.add(dwg.circle(center=(50 + defs_g_trieq_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) tile_created = dwg.use(defs_g_trieq_c60, insert=(150 + defs_g_trieq_size_x / 2, y), fill='navy') dwg.add(tile_created) dwg.add(dwg.circle(center=(150 + defs_g_trieq_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) tile_created = dwg.use(defs_g_trieq_pattern_v2, insert=(250 + defs_g_trieq_pattern_size_x / 2, y), fill='navy') dwg.add(tile_created) dwg.add(dwg.circle(center=(250 + defs_g_trieq_pattern_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) y += defs_g_trieq_pattern_size_y for i in range(9): y += defs_g_trieq_pattern_v2_size_y / 2 for j in range(6): if i % 2: x = 50 + j * 1.5 * defs_g_trieq_pattern_v2_size_x else: x = 50 + 1.5 * defs_g_trieq_size_x + j * 1.5 * defs_g_trieq_pattern_v2_size_x pattern_created = dwg.use(defs_g_trieq_pattern_v2, fill='navy') pattern_created.translate(x, y) dwg.add(pattern_created) y += defs_g_trieq_pattern_size_y title2 = 'Equilateral triangle rotated lower left, math name: p6' dwg.add(dwg.text(title2, insert=(50, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size + defs_g_trieq_pattern_size_y # sample centered rotated eqilateral triangle variation 3 tri_created = dwg.use(defs_g_trieq, insert=(50 + defs_g_trieq_size_x / 2, y), fill='navy') dwg.add(tri_created) dwg.add(dwg.circle(center=(50 + defs_g_trieq_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) tile_created = dwg.use(defs_g_trieq_c60, insert=(150 + defs_g_trieq_size_x / 2, y), fill='navy') dwg.add(tile_created) dwg.add(dwg.circle(center=(150 + defs_g_trieq_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) tile_created = dwg.use(defs_g_trieq_pattern_v3, insert=(250 + defs_g_trieq_pattern_size_x / 2, y), fill='navy') dwg.add(tile_created) dwg.add(dwg.circle(center=(250 + defs_g_trieq_pattern_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) y += defs_g_trieq_pattern_size_y for i in range(9): y += defs_g_trieq_pattern_v3_size_y / 2 for j in range(6): if i % 2: x = 50 + j * 1.5 * defs_g_trieq_pattern_v3_size_x else: x = 50 + 1.5 * defs_g_trieq_size_x + j * 1.5 * defs_g_trieq_pattern_v3_size_x pattern_created = dwg.use(defs_g_trieq_pattern_v3, fill='navy') pattern_created.translate(x, y) dwg.add(pattern_created) y += defs_g_trieq_pattern_size_y # All items have been added so save the svg to a the file.# Sample of tile. dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/tiling_part_5.py000066400000000000000000000411351400026116000221410ustar00rootroot00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- #!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import math, sys import svgwrite # # http://www.w3.org/TR/SVG11/struct.html#UseElement # # For more information on tesselation / tiling see http://en.wikipedia.org/wiki/Wallpaper_group # The organization of these tilings are from the interesting book # Designing Testellations: The Secrets of Interlocking Patterns by Jinny Beyer. PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): svg_size_width = 900 svg_size_height = 1600 font_size = 20 square_size = 30 title1 = name + ': Part 5 tiling with multiple def, groups, use, translate and scale.' sqrt3 = math.sqrt(3) # do this calc once instead of repeating the calc many times. dwg = svgwrite.Drawing(name, (svg_size_width, svg_size_height), debug=True) # #################### # p3m1 - Mirror and Three rotations # - Equilateral triangle mirrored, rotated # All three sides are the same length, all three angles are 60 degrees. # The height of the triangle h = sqrt(3)/2.0 * length of a side # The centre of the triangle is sqrt(3)/6.0 * length of a side defs_g_trieq_size_x = square_size defs_g_trieq_size_y = defs_g_trieq_size_x * sqrt3 / 2 defs_g_trieq_centre = sqrt3 / 6 * defs_g_trieq_size_x # width of equilateral triangle at the centre defs_g_trieq_centre_size_x = defs_g_trieq_size_x - defs_g_trieq_size_x * defs_g_trieq_centre / defs_g_trieq_size_y # defs_g_trieq = dwg.defs.add(dwg.g(id='defs_g_trieq', clip_path='url(#cliptrieq)')) defs_g_trieq = dwg.defs.add(dwg.g(id='defs_g_trieq')) defs_g_trieq.add(dwg.polygon([(0, -defs_g_trieq_size_y + defs_g_trieq_centre), (defs_g_trieq_size_x / 2, defs_g_trieq_centre), (-defs_g_trieq_size_x / 2, defs_g_trieq_centre)], stroke='none')) defs_g_trieq.add(dwg.polygon([(-defs_g_trieq_size_x / 2, defs_g_trieq_centre), (-defs_g_trieq_centre_size_x / 2, 0), (defs_g_trieq_centre_size_x / 2, 0), (0, defs_g_trieq_centre)], stroke='none', fill='yellow')) # Create mirror of the equilateral triangle. defs_g_trieq_m = dwg.defs.add(dwg.g(id='defs_g_trieq_m')) defs_g_trieq_m.add(dwg.use(defs_g_trieq, insert=(0, 0))) defs_g_trieq_m.scale(-1, -1) # Create combined cell defs_g_trieq_cc_size_x = 1.5 * defs_g_trieq_size_x defs_g_trieq_cc_size_y = defs_g_trieq_size_y defs_g_trieq_cc = dwg.defs.add(dwg.g(id='defs_g_trieq_cc')) defs_g_trieq_cc.add(dwg.use(defs_g_trieq, insert=(-defs_g_trieq_size_x / 4, defs_g_trieq_size_y / 2 - defs_g_trieq_centre))) defs_g_trieq_cc.add(dwg.use(defs_g_trieq_m, insert=(defs_g_trieq_size_x / 4, -(defs_g_trieq_size_y / 2 - defs_g_trieq_centre)))) # Create rotations of combined cell defs_g_trieq_cc_120 = dwg.defs.add(dwg.g(id='defs_g_trieq_cc_120')) defs_g_trieq_cc_120.add(dwg.use(defs_g_trieq_cc, insert=(0, 0), fill='mediumblue')) defs_g_trieq_cc_120.rotate(120, center=(0, 0)) defs_g_trieq_cc_m120 = dwg.defs.add(dwg.g(id='defs_g_trieq_cc_m120')) defs_g_trieq_cc_m120.add(dwg.use(defs_g_trieq_cc, insert=(0, 0), fill='navy')) defs_g_trieq_cc_m120.rotate(-120, center=(0, 0)) # Create pattern from rotations of combined cell defs_g_trieq_pattern_size_x = 2 * defs_g_trieq_size_x defs_g_trieq_pattern_size_y = 2 * defs_g_trieq_size_y defs_g_trieq_pattern = dwg.defs.add(dwg.g(id='defs_g_trieq_pattern')) defs_g_trieq_pattern.add(dwg.use(defs_g_trieq_cc, insert=(-defs_g_trieq_size_x / 4, -defs_g_trieq_cc_size_y / 2))) defs_g_trieq_pattern.add(dwg.use(defs_g_trieq_cc_120, insert=(defs_g_trieq_size_x / 2, 0))) defs_g_trieq_pattern.add(dwg.use(defs_g_trieq_cc_m120, insert=(-defs_g_trieq_size_x / 4, defs_g_trieq_cc_size_y / 2))) # #################### # p31m - Three rotations and a mirror # - A Kite shape, half hexagon, and half of a 60 degree diamond will all work for this # symmetry. This one will use a kite. # 30, 60, 90 angle triangle # The length of the sides are 1:sqrt(3):2 2 is the hypotenuse # invsqrt2 = 1/sqrt2 # invsqrt2_2 = invsqrt2 * invsqrt2 = 1/2 = .5 by definition # sin and cos(45 degrees) is 1/sqrt2 = 0.707106781187 # cos(30 degrees) is sqrt3/2 # sin(30 degrees) is 1/2 # tan(30) = 1/sqrt(3) # The height of equilateral triangle h = sqrt(3)/2.0 * length of a side # The centre of equilateral triangle is sqrt(3)/6.0 * length of a side defs_g_kite_size_x = square_size defs_g_kite_size_y = defs_g_kite_size_x * sqrt3 / 2 + defs_g_kite_size_x * sqrt3 / 6 # Having a clip path seems to increase the visibility of the lines between the tiles. # A clipping path may be necessary if the shapes go outside the triangle. # defs_g_kite = dwg.defs.add(dwg.g(id='defs_g_kite', clip_path='url(#clipkite)')) defs_g_kite = dwg.defs.add(dwg.g(id='defs_g_kite')) defs_g_kite.add(dwg.polygon([(0, 0), (defs_g_kite_size_x / 2, defs_g_kite_size_x / (sqrt3 * 2)), (0, defs_g_kite_size_y), (-defs_g_kite_size_x / 2, defs_g_kite_size_x / (sqrt3 * 2))], stroke='none')) #defs_g_kite.add(dwg.polygon([(0, 0), # (defs_g_kite_size_x / 4.0, (defs_g_kite_size_y + defs_g_kite_size_x / (sqrt3 * 2.0)) / 2.0), # (-defs_g_kite_size_x / 2.0, defs_g_kite_size_x / (sqrt3 * 2.0))], stroke='none', fill='yellow')) defs_g_kite.add(dwg.polygon([(0, 0), (defs_g_kite_size_x / 2, defs_g_kite_size_x / (sqrt3 * 2)), (0, defs_g_kite_size_y / 12), (-defs_g_kite_size_x / 2, defs_g_kite_size_x / (sqrt3 * 2))], stroke='none', fill='black')) defs_g_kite.add(dwg.polygon([(0, defs_g_kite_size_y), (defs_g_kite_size_x / 2, defs_g_kite_size_x / (sqrt3 * 2)), (0, defs_g_kite_size_y * 8 / 12), (-defs_g_kite_size_x / 2, defs_g_kite_size_x / (sqrt3 * 2))], stroke='none', fill='green')) # Create rotations of the kite. defs_g_kite_120 = dwg.defs.add(dwg.g(id='defs_g_kite_120')) defs_g_kite_120.add(dwg.use(defs_g_kite, insert=(0, 0))) defs_g_kite_120.rotate(120, center=(0, 0)) defs_g_kite_m120 = dwg.defs.add(dwg.g(id='defs_g_kite_m120')) defs_g_kite_m120.add(dwg.use(defs_g_kite, insert=(0, 0))) defs_g_kite_m120.rotate(-120, center=(0, 0)) # Now use the cell, rotated cells to create the combined cell. # The height of equilateral triangle h = sqrt(3) / 2.0 * length of a side defs_g_kite_cc_size_x = 2 * defs_g_kite_size_x defs_g_kite_cc_size_y = defs_g_kite_size_x * sqrt3 # 2*(sqrt(3)/2.0) defs_g_kite_cc = dwg.defs.add(dwg.g(id='defs_g_kite_cc')) defs_g_kite_cc.add(dwg.use(defs_g_kite, insert=(0, 0))) defs_g_kite_cc.add(dwg.use(defs_g_kite_120, insert=(0, 0))) defs_g_kite_cc.add(dwg.use(defs_g_kite_m120, insert=(0, 0))) # Now use the combined cell to create a mirrored combined cell defs_g_kite_mcc = dwg.defs.add(dwg.g(id='defs_g_kite_mcc')) defs_g_kite_mcc.add(dwg.use(defs_g_kite_cc, insert=(0, 0))) defs_g_kite_mcc.scale(-1, -1) # Now use the combined cell, and mirrored combined cell to create a pattern defs_g_kite_pattern_size_x = 1.5 * defs_g_kite_cc_size_x defs_g_kite_pattern_size_y = defs_g_kite_cc_size_y defs_g_kite_pattern = dwg.defs.add(dwg.g(id='defs_g_kite_pattern')) defs_g_kite_pattern.add(dwg.use(defs_g_kite_cc, insert=(-defs_g_kite_cc_size_x / 4, -sqrt3 / 12 * defs_g_kite_cc_size_x))) defs_g_kite_pattern.add(dwg.use(defs_g_kite_mcc, insert=(defs_g_kite_cc_size_x / 4, sqrt3 / 12 * defs_g_kite_cc_size_x))) # #################### # p6m - Kaleidoscope Either of the two long sides of the primary triangle is mirrored. The # resulting shape is rotated six times. # 30, 60, 90 angle triangle # The length of the sides are 1:sqrt(3):2 2 is the hypotenuse # invsqrt2 = 1/sqrt2 # invsqrt2_2 = invsqrt2 * invsqrt2 = 1/2 = .5 by definition # sin and cos(45 degrees) is 1/sqrt2 = 0.707106781187 # cos(30 degrees) is sqrt3/2 # sin(30 degrees) is 1/2 # tan(30) = 1/sqrt(3) # # The height of equilateral triangle h = sqrt(3) / 2.0 * length of a side # # The centre of equilateral triangle is sqrt(3) / 6.0 * length of a side defs_g_kale_tri_size_x = square_size defs_g_kale_tri_size_y = defs_g_kale_tri_size_x * 4 / sqrt3 # Having a clip path seems to increase the visibility of the lines between the tiles. # A clipping path may be necessary if the shapes go outside the triangle. # defs_g_kale_tri = dwg.defs.add(dwg.g(id='defs_g_kale_tri', clip_path='url(#clipkale)')) defs_g_kale_tri = dwg.defs.add(dwg.g(id='defs_g_kale_tri')) defs_g_kale_tri.add(dwg.polygon([(0, -defs_g_kale_tri_size_y), (0, 0), (-defs_g_kale_tri_size_x, defs_g_kale_tri_size_x / sqrt3 - defs_g_kale_tri_size_y)], stroke='none')) defs_g_kale_tri.add(dwg.polygon([(-defs_g_kale_tri_size_x, defs_g_kale_tri_size_x / sqrt3 - defs_g_kale_tri_size_y), (0, 2 * defs_g_kale_tri_size_x / sqrt3 - defs_g_kale_tri_size_y), (0, 3 * defs_g_kale_tri_size_x / sqrt3 - defs_g_kale_tri_size_y)], stroke='none', fill='yellow')) # Create mirror of the kale. defs_g_kale_tri_m = dwg.defs.add(dwg.g(id='defs_g_kale_tri_m')) defs_g_kale_tri_m.add(dwg.use(defs_g_kale_tri, insert=(0, 0))) defs_g_kale_tri_m.scale(-1, 1) # Now use the tri, rotated tri to create the combined cell. defs_g_kale_cc_size_x = 2 * defs_g_kale_tri_size_x defs_g_kale_cc_size_y = defs_g_kale_tri_size_y defs_g_kale_cc = dwg.defs.add(dwg.g(id='defs_g_kale_cc')) defs_g_kale_cc.add(dwg.use(defs_g_kale_tri, insert=(0, 0))) defs_g_kale_cc.add(dwg.use(defs_g_kale_tri_m, insert=(0, 0))) # Now rotate the combined cell. defs_g_kale_cc_60 = dwg.defs.add(dwg.g(id='defs_g_kale_cc_60')) defs_g_kale_cc_60.add(dwg.use(defs_g_kale_cc, insert=(0, 0))) defs_g_kale_cc_60.rotate(60, center=(0, 0)) defs_g_kale_cc_120 = dwg.defs.add(dwg.g(id='defs_g_kale_cc_120')) defs_g_kale_cc_120.add(dwg.use(defs_g_kale_cc, insert=(0, 0))) defs_g_kale_cc_120.rotate(120, center=(0, 0)) defs_g_kale_cc_180 = dwg.defs.add(dwg.g(id='defs_g_kale_cc_180')) defs_g_kale_cc_180.add(dwg.use(defs_g_kale_cc, insert=(0, 0))) defs_g_kale_cc_180.rotate(180, center=(0, 0)) defs_g_kale_cc_m60 = dwg.defs.add(dwg.g(id='defs_g_kale_cc_m60')) defs_g_kale_cc_m60.add(dwg.use(defs_g_kale_cc, insert=(0, 0))) defs_g_kale_cc_m60.rotate(-60, center=(0, 0)) defs_g_kale_cc_m120 = dwg.defs.add(dwg.g(id='defs_g_kale_cc_m120')) defs_g_kale_cc_m120.add(dwg.use(defs_g_kale_cc, insert=(0, 0))) defs_g_kale_cc_m120.rotate(-120, center=(0, 0)) # Now use the cell and five rotated cells to create the pattern. defs_g_kale_pattern_size_x = 2 * defs_g_kale_cc_size_x defs_g_kale_pattern_size_y = 2 * defs_g_kale_cc_size_y defs_g_kale_pattern = dwg.defs.add(dwg.g(id='defs_g_kale_pattern')) defs_g_kale_pattern.add(dwg.use(defs_g_kale_cc, insert=(0, 0))) defs_g_kale_pattern.add(dwg.use(defs_g_kale_cc_60, insert=(0, 0))) defs_g_kale_pattern.add(dwg.use(defs_g_kale_cc_120, insert=(0, 0))) defs_g_kale_pattern.add(dwg.use(defs_g_kale_cc_180, insert=(0, 0))) defs_g_kale_pattern.add(dwg.use(defs_g_kale_cc_m60, insert=(0, 0))) defs_g_kale_pattern.add(dwg.use(defs_g_kale_cc_m120, insert=(0, 0))) # ######################## # Background will be dark but not black so the background does not overwhelm the colors. dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), rx=None, ry=None, fill='grey')) # Give the name of the example and a title. y = font_size + 5 dwg.add(dwg.text(title1, insert=(0, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size # p3m1 - Mirror and three rotations title2 = 'Mirror and three rotations, math name: p3m1' dwg.add(dwg.text(title2, insert=(50, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size + defs_g_trieq_size_x cell_created = dwg.use(defs_g_trieq, insert=(50 + defs_g_trieq_size_x, y), fill='lightblue') dwg.add(cell_created) dwg.add(dwg.circle(center=(50 + defs_g_trieq_size_x, y), r=3, stroke='none', fill='purple', opacity='0.5')) cc_created = dwg.use(defs_g_trieq_cc, insert=(150 + defs_g_trieq_cc_size_x, y), fill='lightblue') dwg.add(cc_created) dwg.add(dwg.circle(center=(150 + defs_g_trieq_cc_size_x, y), r=3, stroke='none', fill='purple', opacity='0.5')) pattern_created = dwg.use(defs_g_trieq_pattern, insert=(250 + defs_g_trieq_cc_size_x, y), fill='lightblue') dwg.add(pattern_created) dwg.add(dwg.circle(center=(250 + defs_g_trieq_cc_size_x, y), r=3, stroke='none', fill='purple', opacity='0.5')) y += defs_g_trieq_pattern_size_y for i in range(8): y += defs_g_trieq_pattern_size_y / 2 for j in range(6): if i % 2: x = 50 + j * 1.5 * defs_g_trieq_pattern_size_x else: x = 50 + 1.5 * defs_g_trieq_size_x + j * 1.5 * defs_g_trieq_pattern_size_x pattern_created = dwg.use(defs_g_trieq_pattern, fill='lightblue') pattern_created.translate(x, y) dwg.add(pattern_created) y += defs_g_trieq_pattern_size_y # # p31m sample cell, combined cell and tile title2 = 'Kite rotated and mirrored, math name: p31m' dwg.add(dwg.text(title2, insert=(50, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size + defs_g_kite_size_y cell_created = dwg.use(defs_g_kite, insert=(50 + defs_g_kite_size_x / 2, y), fill='navy') dwg.add(cell_created) dwg.add(dwg.circle(center=(50 + defs_g_kite_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) cc_created = dwg.use(defs_g_kite_cc, insert=(150 + defs_g_kite_size_x / 2, y), fill='navy') dwg.add(cc_created) dwg.add(dwg.circle(center=(150 + defs_g_kite_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) mcc_created = dwg.use(defs_g_kite_mcc, insert=(250 + defs_g_kite_cc_size_x / 2, y), fill='navy') dwg.add(mcc_created) dwg.add(dwg.circle(center=(250 + defs_g_kite_cc_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) pattern_created = dwg.use(defs_g_kite_pattern, insert=(350 + defs_g_kite_cc_size_x, y), fill='navy') dwg.add(pattern_created) dwg.add(dwg.circle(center=(350 + defs_g_kite_cc_size_x, y), r=3, stroke='none', fill='purple', opacity='0.5')) y += defs_g_kite_pattern_size_y for i in range(6): y += defs_g_kite_pattern_size_y for j in range(8): if i % 2: x = 100 + (j + 0.5) * defs_g_kite_cc_size_x else: x = 100 + j * defs_g_kite_cc_size_x pattern_created = dwg.use(defs_g_kite_pattern, fill='navy') pattern_created.translate(x, y) dwg.add(pattern_created) y += defs_g_kite_pattern_size_y # ## # p6m kaleidoscope title2 = 'Kaleidoscope 30, 60, 90 triangle mirrored and rotated, math name: p6m' dwg.add(dwg.text(title2, insert=(50, y), font_family='serif', font_size=font_size, fill='white')) y = y + font_size y += defs_g_kale_tri_size_y cell_created = dwg.use(defs_g_kale_tri, insert=(50 + defs_g_kale_tri_size_x, y), fill='navy') dwg.add(cell_created) dwg.add(dwg.circle(center=(50 + defs_g_kale_tri_size_x, y), r=3, stroke='none', fill='purple', opacity='0.5')) cc_created = dwg.use(defs_g_kale_cc, insert=(150 + defs_g_kale_cc_size_x / 2, y), fill='navy') dwg.add(cc_created) dwg.add(dwg.circle(center=(150 + defs_g_kale_cc_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) pattern_created = dwg.use(defs_g_kale_pattern, insert=(250 + defs_g_kale_pattern_size_x / 2, y), fill='navy') dwg.add(pattern_created) dwg.add(dwg.circle(center=(250 + defs_g_kale_pattern_size_x / 2, y), r=3, stroke='none', fill='purple', opacity='0.5')) y += defs_g_kale_pattern_size_y / 2 for i in range(4): y += defs_g_kale_pattern_size_y - defs_g_kale_pattern_size_x / (sqrt3 * 2) for j in range(6): if i % 2: x = 100 + j * defs_g_kale_pattern_size_x else: x = 100 + defs_g_kale_cc_size_x + j * defs_g_kale_pattern_size_x pattern_created = dwg.use(defs_g_kale_pattern, fill='navy') pattern_created.translate(x, y) dwg.add(pattern_created) y += defs_g_kale_pattern_size_y # All items have been added so save the svg to a the file. dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/ltattrie/xkcd_colour_data_svgwrite_3.py000066400000000000000000000122431400026116000250600ustar00rootroot00000000000000#!/usr/bin/env python # Author: L. Tattrie # Purpose: svgwrite examples # Created: 2012/5/31 # Copyright (C) 2012, L. Tattrie # License: LGPL # Python version 2.7 import sys import colorsys import svgwrite from pathlib import Path PROGNAME = sys.argv[0].rstrip('.py') RGB_TXT = Path('rgb.txt') # To Do # Automate the file name and title and axis swatch_y # Create multiple layers and put the third component divided into 10 layers? # Create new examples for svgwrite # text follow path based on http://www.w3.org/TR/SVG/text.html example toap01 # text stroke, stroke colour # text font names # colour names, colour by rbg, colour by hex, colour by hsl. # clipping and masking perhaps use http://www.w3.org/TR/SVG/masking.html example opacity01 # multishapes with various opacities overlapping. ex rounded corner rectangles. # Are clones an inkscape feature? # View examples by following links at http://tavmjong.free.fr/INKSCAPE/ # Table of contents page to show example svgs. Links go to each svg. # It does this by looking at the current dir and listing *.svg or example*.svg # Drop shadow? # Create sample programs which match the svg test in the www.? pages # Complain / document that # sq_created.translate(x, (y+square_size)) # sq_created.scale(1, -1) is not the same as # sq_created.scale(1, -1) # sq_created.translate(x, (y+square_size)) # www.? said that evaluation is done RIGHT to LEFT! But the program puts the most recent on # the left so what appears in the program to happen first actually happens last! To me this # should be changed and is likely that the author of svgwrite did not know of the Right to # Left evaluation. Needs example from www.? # Note that sq_created.scale='(1, -1)' does not work and is incorrect but does not produce an # error. The program ignores it and caused me a lot of debugging time. # # read the name and colour data provided by xkcd and change to svg diagram. # http://blog.xkcd.com/2010/05/03/color-survey-results/ # # The file format is tab delimeted: colour name tab hex colour tab newline # max name length =26 # # http://stackoverflow.com/questions/214359/converting-hex-to-rgb-and-vice-versa # A hex value is just RGB numbers represented in hexadecimal. So you just have to take each pair of hex digits # and convert them to decimal. Example: #FF6400 = RGB(0xFF, 0x64, 0x00) = RGB(255, 100, 0) def hex_to_rgb(value): value = value.lstrip('#') def get_int(pos): start = pos * 2 return int(value[start:start+2], 16) return get_int(0), get_int(1), get_int(2) def create_svg(name): swatch_w = 10 # swatch width swatch_h = 10 # swatch height if not RGB_TXT.exists(): print("Error. The data file is not readable. File name is: %s" % RGB_TXT) sys.exit(1) # 1050 = 1000 width of color + width of last rectangle which might start at 1000 + approx width of font name text svg_size = 1050 dwg = svgwrite.Drawing(name, (svg_size, svg_size)) dwg.add(dwg.rect(insert=(0, 0), size=('100%', '100%'), fill='grey')) dwg.add(dwg.text('XKCD.com color name survey x=hue, y=lightness', insert=(svg_size/2, '28px'), text_anchor='middle', font_family="sans-serif", font_size='25px', fill='black')) # http://www.svgbasics.com/using_fonts.html # http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#propdef-font-family # 'serif', 'sans-serif', 'cursive', 'fantasy', and 'monospace' from the CSS specification # You can also use other family names like "Times", "Baskerville", "Verdena", and "Symbol." I got those names from the CSS specification and some experimenting, but I'm looking for more. # 'font-weight' Value: normal | bold + others. for line_count, line in enumerate(RGB_TXT.read_text().splitlines()): colour_item = line.split('\t') # strip the trailing newline \n char then split by the tab chars colour_item = line.strip().split('\t') rgb = hex_to_rgb(colour_item[1]) # hsl is also called hls #hsl = #h, l, s = colorsys.rgb_to_hls(r, g, b) # rgb values are integer but colorsys wants float(0..1) and returns float h, l, s = colorsys.rgb_to_hls(rgb[0] / 255, rgb[1] / 255, rgb[2] / 255) hsl = (h, s, l) swatch_x=int(h*1000) # hue by lightness swatch_y=svg_size - 25 - int(l*1000) # hue by saturation #swatch_y=int(s*1000) + 25 ## svg can handle colors in hex mode so no conversion is necessary. group_rec_text = dwg.add(dwg.g()) group_rec_text.add(dwg.rect(insert=(swatch_x, swatch_y), size=(swatch_w, swatch_h), rx=None, ry=None, fill=colour_item[1])) # text is to start on the right side of swatch in the middle. tx_x = int(swatch_x + swatch_w) tx_y = int(swatch_y + swatch_h/2) group_rec_text.add(dwg.text(colour_item[0], insert = (tx_x, tx_y), font_family="sans-serif", font_size='6px', fill='white', stroke='black', stroke_width='0.1px')) dwg.save() if __name__ == '__main__': create_svg(PROGNAME + '_hl.svg') # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 textwidth=99 svgwrite-1.4.1/examples/mandelbrot.py000066400000000000000000000032011400026116000176700ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 08.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite from svgwrite import rgb def mandelbrot(name): ## {{{ http://code.activestate.com/recipes/577111/ (r2) # Mandelbrot fractal # FB - 201003254 def putpixel(pos, color): mandelbrot_group.add(dwg.circle(center=pos, r=.5, fill=color)) # image size imgx = 160 imgy = 100 # drawing defines the output size dwg = svgwrite.Drawing(name, ('32cm', '20cm'), debug=True) # define a user coordinate system with viewbox() dwg.viewbox(0, 0, imgx, imgy) mandelbrot_group = dwg.add(dwg.g(stroke_width=0, stroke='none')) # drawing area xa = -2.0 xb = 1.0 ya = -1.5 yb = 1.5 maxIt = 255 # max iterations allowed for y in range(imgy): zy = y * (yb - ya) / (imgy - 1) + ya for x in range(imgx): zx = x * (xb - xa) / (imgx - 1) + xa z = zx + zy * 1j c = z for i in range(maxIt): if abs(z) > 2: break z = z * z + c putpixel((x, y), rgb(i % 4 * 64, i % 8 * 32, i % 16 * 16)) dwg.save() ## end of http://code.activestate.com/recipes/577111/ }}} if __name__ == '__main__': mandelbrot("mandelbrot.svg") svgwrite-1.4.1/examples/marker.py000066400000000000000000000065171400026116000170370ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 08.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite def marker(name): # Shows how to use the element. # W3C reference: http://www.w3.org/TR/SVG11/painting.html#MarkerElement # dwg = svgwrite.Drawing(name, size=('20cm', '15cm'), profile='full', debug=True) # set user coordinate space dwg.viewbox(width=200, height=150) #--start-- A red point as marker-start element # 'insert' represents the insertation point in user coordinate space # in this example its the midpoint of the circle, see below marker_start = dwg.marker(insert=(0, 0), size=(5, 5)) # target size of the marker # setting a user coordinate space for the appanded graphic elements # bounding coordinates for this example: # minx = -5, maxx = +5, miny = -5, maxy = +5 marker_start.viewbox(minx=-5, miny=-5, width=10, height=10) # the marker user coordinate space marker_start.add(dwg.circle((0, 0), r=5)).fill('red', opacity=0.5) #--end-- A blue point as marker-end element # a shorter form of the code above: marker_end = dwg.marker(size=(5, 5)) # marker defaults: insert=(0,0) # set viewbox to the bounding coordinates of the circle marker_end.viewbox(-1, -1, 2, 2) marker_end.add(dwg.circle(fill='blue', fill_opacity=0.5)) # circle defaults: insert=(0,0), r=1 #--mid-- A green point as marker-mid element # if you don't setup a user coordinate space, the default ucs is # minx = 0, miny = 0, maxx=size[0], maxy=size[1] # default size = (3, 3) defined by the SVG standard # bounding coordinates for this example: # minx = 0, maxx = 6, miny = 0, maxy = 6 # => center of the viewbox = (3, 3)! marker_mid = dwg.marker(insert=(3, 3), size=(6, 6)) marker_mid.add(dwg.circle((3, 3), r=3)).fill('green', opacity=0.7) # The drawing size of the 'start-marker' is greater than the drawing size of # the 'marker-mid' (r=5 > r=3), but the resulting size is defined by the # 'size' parameter of the marker object (size=(6,6) > size=(5,5)), so the # 'marker-start' is smaller than the 'marker-mid'. # add marker to defs section of the drawing dwg.defs.add(marker_start) dwg.defs.add(marker_mid) dwg.defs.add(marker_end) # create a new line object, fill='none' is important, because by default # the polyline and the polygon object is filled (tested with FF, Chrome). # I am not sure, if this is concurring to the SVG Standard. line = dwg.add(dwg.polyline( [(10, 10), (50, 20), (70, 50), (100, 30), (120, 140), (170, 100)], stroke='black', fill='none')) # set markers 3-tuple = ('marker-start', 'marker-mid', 'marker-end') line.set_markers( (marker_start, marker_mid, marker_end) ) # or set markers direct as SVG Attributes 'marker-start', 'marker-mid', # 'marker-end' or 'marker' if all markers are the same. # line['marker'] = marker.get_funciri() # but 'marker' works only with Firefox (26.10.2010) dwg.save() if __name__ == '__main__': marker("marker.svg") svgwrite-1.4.1/examples/pattern.py000066400000000000000000000016041400026116000172230ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 08.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite def pattern(name): dwg = svgwrite.Drawing(name, size=('20cm', '15cm'), profile='full', debug=True) # set user coordinate space dwg.viewbox(width=200, height=150) pattern = dwg.defs.add( dwg.pattern(size=(20, 20), patternUnits="userSpaceOnUse")) pattern.add(dwg.circle((10, 10), 5)) dwg.add(dwg.circle((100, 100), 50, fill=pattern.get_paint_server())) dwg.save() if __name__ == '__main__': pattern("pattern.svg") svgwrite-1.4.1/examples/radialGradient.py000066400000000000000000000023511400026116000204600ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 08.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite def radialGradient(name): dwg = svgwrite.Drawing(name, size=('20cm', '15cm'), profile='full', debug=True) # set user coordinate space dwg.viewbox(width=200, height=150) # create a new radialGradient element and add it to the defs section of # the drawing gradient1 = dwg.defs.add(dwg.radialGradient()) # define the gradient from red to white gradient1.add_stop_color(0, 'red').add_stop_color(1, 'white') # use gradient for filling the rect dwg.add(dwg.rect((10,10), (50,50), fill=gradient1.get_paint_server())) wave = dwg.defs.add(dwg.radialGradient()) wave.add_colors(['blue', 'lightblue'] * 8) dwg.add(dwg.rect((70,10), (50,50), fill=wave.get_paint_server())) dwg.save() if __name__ == '__main__': radialGradient("radialGradient.svg") svgwrite-1.4.1/examples/runall.bat000066400000000000000000000000461400026116000171600ustar00rootroot00000000000000@echo off for %%e in (*.py) do py %%e svgwrite-1.4.1/examples/runall.sh000066400000000000000000000001041400026116000170170ustar00rootroot00000000000000#!/bin/sh for f in `ls *.py` do echo running $f ... python $f done svgwrite-1.4.1/examples/runall3.bat000066400000000000000000000000511400026116000172370ustar00rootroot00000000000000@echo off for %%e in (*.py) do py -3 %%e svgwrite-1.4.1/examples/simple_text.py000066400000000000000000000030661400026116000201070ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 08.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite def simple_text(name): dwg = svgwrite.Drawing(name, (200, 200), debug=True) paragraph = dwg.add(dwg.g(font_size=14)) paragraph.add(dwg.text("This is a Test!", (10, 20))) # 'x', 'y', 'dx', 'dy' and 'rotate' has to be a or a !!! # 'param'[0] .. first letter, 'param'[1] .. second letter, and so on # if there are more letters than values, the last list-value is used # # different 'y' coordinates does not work with Firefox 3.6 paragraph.add(dwg.text("This is a Test", x=[10], y=[40, 45, 50, 55, 60])) # different formats can be used by the TSpan element # The atext.tspan(...) method is a shortcut for: atext.add(dwg.tspan(...)) atext = dwg.text("A", insert=(10, 80), style="text-shadow: 2px 2px;") # text color is set by the 'fill' property and 'stroke sets the outline color. atext.add(dwg.tspan(' Word', font_size='1.5em', fill='red')) atext.add(dwg.tspan(' is a Word!', dy=['1em'], font_size='0.7em', fill='green')) paragraph.add(dwg.text("Das ist ein Test mit ÖÄÜäüö!", (10, 120))) paragraph.add(atext) dwg.save() if __name__ == '__main__': simple_text("simple_text.svg") svgwrite-1.4.1/examples/solidcolor.py000066400000000000000000000014431400026116000177200ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 26.10.2016 # Copyright (C) 2016, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite def solid_color(name): dwg = svgwrite.Drawing(name, size=('20cm', '15cm'), profile='tiny', debug=True) # set user coordinate space dwg.viewbox(width=200, height=150) my_color = dwg.defs.add(dwg.solidColor(color='red')) dwg.add(dwg.circle((100, 100), 50, fill=my_color.get_paint_server())) dwg.save() if __name__ == '__main__': solid_color("solid_color.svg") svgwrite-1.4.1/examples/use.py000066400000000000000000000027511400026116000163460ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: svg examples # Created: 08.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License try: import svgwrite except ImportError: # if svgwrite is not 'installed' append parent dir of __file__ to sys.path import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import svgwrite from svgwrite import cm, mm, rgb, deg def use(name): # Shows how to use the 'use' element. # w, h = '100%', '100%' dwg = svgwrite.Drawing(filename=name, size=(w, h), debug=True) dwg.add(dwg.rect(insert=(0,0), size=(w, h), fill='lightgray', stroke='black')) # add a group of graphic elements to the defs section of the main drawing g = dwg.defs.add(dwg.g(id='g001')) unit=40 g.add(dwg.rect((0,0), (unit, unit))) for y in range(10): for x in range(5): x1 = 2*unit+2*unit*x y1 = 2*unit+2*unit*y cx = x1 + unit/2 cy = y1 + unit/2 cval = (y*5 + x)*2 # reference the group by the 'use' element, you can overwrite # graphical properties, ... u = dwg.use(g, insert=(x1, y1), fill=rgb(cval, cval, cval)) # ... and you can also transform the the whole reference object. u.rotate(y*5+x, center=(cx, cy)) dwg.add(u) dwg.save() if __name__ == '__main__': use("use.svg") svgwrite-1.4.1/examples/using_bitmap_images.py000066400000000000000000000022501400026116000215520ustar00rootroot00000000000000# example by https://github.com/stevenj to include bitmapgraphic by using the wand and base64 libraries # getting wand at: https://pypi.org/project/Wand/ # requirements and installation: http://docs.wand-py.org/en/0.4.4/# # not tested by myself (mozman) import svgwrite import base64 from wand.image import Image # Load PNG Image dwg = svgwrite.Drawing() img = Image(filename="my.png") # Then get raw PNG data and encode DIRECTLY into the SVG file. image_data = img.make_blob(format='png') encoded = base64.b64encode(image_data).decode() pngdata = 'data:image/png;base64,{}'.format(encoded) image = dwg.add(dwg.image(href=(pngdata))) # Bonus, the wand library lets you use ANY format image and encode it as a PNG # You can also do cropping, transforms, etc on the image before encoding it. # You can also embed an SVG inside an SVG the same way: # Load SVG Image img = Image(filename="my.svg") # Then get raw SVG data and encode DIRECTLY into the SVG file. image_data = img.make_blob() # Don't change its format, just use it as an SVG encoded = base64.b64encode(image_data).decode() svgdata = 'data:image/svg+xml;base64,{}'.format(encoded) image = dwg.add(dwg.image(href=(svgdata))) svgwrite-1.4.1/examples/using_fonts.py000066400000000000000000000050441400026116000201060ustar00rootroot00000000000000import svgwrite def write_html_loader(name, title): open('{name}.html'.format(name=name), 'wt', encoding='utf-8').write(""" title """.format(name=name, title=title)) def font_by_stylsheet(name): dwg = svgwrite.Drawing(name+'.svg', (800, 200), debug=True) # load web font by CSS @import dwg.embed_stylesheet(""" @import url(http://fonts.googleapis.com/css?family=Indie+Flower); .flower14 { font-family: "Indie Flower"; font-size: 14; } """) paragraph = dwg.add(dwg.g(class_="flower14", )) paragraph.add(dwg.text("Font 'Indie Flower' referenced by embedded CSS stylesheet.", insert=(10, 40))) dwg.save(pretty=True) # This seems easy, BUT this only works if the SVG file is opened stand alone, # embedded in a website, this approach does not work! write_html_loader(name, title="Test font for SVG by CSS reference inside of HTML") def font_embedded(name): dwg = svgwrite.Drawing(name+'.svg', (800, 200), debug=True) # font data has to be downloaded to the local file system dwg.embed_font(name="Indie Flower", filename='fonts/IndieFlower.ttf') dwg.embed_stylesheet(""" .flower14 { font-family: "Indie Flower"; font-size: 14; } """) # This should work stand alone and embedded in a website! paragraph = dwg.add(dwg.g(class_="flower14", )) paragraph.add(dwg.text("Font 'Indie Flower' embedded from local file system.", insert=(10, 40))) dwg.save(pretty=True) write_html_loader(name, title="Test SVG with embedded font inside of HTML") def web_font_embedded(name): dwg = svgwrite.Drawing(name+'.svg', (800, 200), debug=True) # font data downloaded from google fonts dwg.embed_google_web_font(name="Indie Flower", uri='http://fonts.googleapis.com/css?family=Indie+Flower') dwg.embed_stylesheet(""" .flower14 { font-family: "Indie Flower"; font-size: 14; } """) # This should work stand alone and embedded in a website! paragraph = dwg.add(dwg.g(class_="flower14", )) paragraph.add(dwg.text("Font 'Indie Flower' embedded from Google fonts.", insert=(10, 40))) dwg.save(pretty=True) write_html_loader(name, title="Test SVG with embedded font inside of HTML") if __name__ == '__main__': font_by_stylsheet("font_by_CSS_reference") font_embedded("font_embedded") web_font_embedded("font_embedded_from_google") svgwrite-1.4.1/examples/using_inkscape_extension.py000066400000000000000000000015061400026116000226450ustar00rootroot00000000000000# Author: mozman # Purpose: testing area for inkscape extension # Created: 06.08.2018 # Copyright (c) 2018 Manfred Moitzi based on ideas of Antonio Ospite # License: MIT License import svgwrite from svgwrite.extensions import Inkscape dwg = svgwrite.Drawing('test-inkscape-extension.svg', profile='full', size=(640, 480)) inkscape = Inkscape(dwg) layer = inkscape.layer(label="top LAYER 1", locked=True) dwg.add(layer) line = dwg.line((100, 100), (300, 100), stroke=svgwrite.rgb(10, 10, 16, '%'), stroke_width=10) layer.add(line) text = dwg.text('Test', insert=(100, 100), font_size=100, fill='red') layer.add(text) nested_layer = inkscape.layer(label="nested LAYER 2", locked=False) layer.add(nested_layer) text = dwg.text('Test2', insert=(100, 200), font_size=100, fill='blue') nested_layer.add(text) dwg.save() svgwrite-1.4.1/examples/using_shapes_extension.py000066400000000000000000000024661400026116000223410ustar00rootroot00000000000000#!/usr/bin/env python # coding:utf-8 # Author: ya-induhvidual # Purpose: svg shapes-extension example # Modified # Copyright (C) 2019, Christof Hanke # License: MIT License import math import svgwrite from svgwrite.extensions.shapes import ngon, rotate, translate, scale, star def main(name): """ Some examples how to use the shapes extension """ dwg = svgwrite.Drawing(name + ".svg", (1000, 1000), debug=True) style = {"fill": "none", "stroke": "black", "stroke-width": "1"} # create a list of points lying on the corners of an octagon octagon = list(ngon(8, edge_length=10, rotation=math.pi/8)) dwg.add(dwg.polygon(octagon, **style)) # translate it octagon_translated = list(translate(octagon, 100, 100)) dwg.add(dwg.polygon(octagon_translated, **style)) # rotate it octagon_rotated = list(rotate(translate(octagon_translated, 10, 10), math.pi / 8)) dwg.add(dwg.polygon(octagon_rotated, **style)) # scale it # make sure first to scale it, then to translate it octagon_scaled = list(translate(scale(octagon, 10, 10), 500, 500)) dwg.add(dwg.polygon(octagon_scaled, **style)) dwg.add(dwg.polygon(translate(star(5, 50, 20, rotation=-math.pi/2), 400, 100))) dwg.save(pretty=True) if __name__ == '__main__': name = "shapes_example" main(name) svgwrite-1.4.1/issues/000077500000000000000000000000001400026116000146705ustar00rootroot00000000000000svgwrite-1.4.1/issues/2017-01-24 issue 1 text-decoration/000077500000000000000000000000001400026116000222465ustar00rootroot00000000000000svgwrite-1.4.1/issues/2017-01-24 issue 1 text-decoration/test_issue_1.py000066400000000000000000000017031400026116000252300ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Copyright (C) 2017, Manfred Moitzi # License: MIT License import unittest from svgwrite.text import Text class TestIssue0001(unittest.TestCase): def test_text_decorator_full_profile(self): text = Text( "test", insert=(0, 0), font_size="30px", fill='black', text_decoration='underline', profile='full', ) self.assertEqual(text.elementname, 'text') def test_text_decorator_tiny_profile(self): with self.assertRaises(ValueError): # text-decoration is not supported in the DVG 1.2 Tiny profile Text( "test", insert=(0, 0), font_size="30px", fill='black', text_decoration='underline', profile='tiny', ) if __name__ == '__main__': unittest.main() svgwrite-1.4.1/issues/2017-02-27 markers/000077500000000000000000000000001400026116000173535ustar00rootroot00000000000000svgwrite-1.4.1/issues/2017-02-27 markers/marker.py000066400000000000000000000127171400026116000212160ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman # Purpose: reproducing marker examples from http://vanseodesign.com/web-design/svg-markers/ # Created: 27.02.2017 # Copyright (C) 2017, Manfred Moitzi # License: MIT License import svgwrite def create_arrow_marker(dwg): # # # # # arrow = dwg.marker(id='arrow', insert=(0, 3), size=(10, 10), orient='auto', markerUnits='strokeWidth') arrow.add(dwg.path(d='M0,0 L0,6 L9,3 z', fill='#f00')) dwg.defs.add(arrow) return arrow def create_arrow_marker_sumner(dwg): # # # # # # your drawing area is 20, 10, the tip of the arrow is at 20, 5 and the end of the arrow is at (3.128, 5) # L x, y uses absolute coords, l dx, dy uses relative coords arrow = dwg.marker(id='arrow', insert=(3.128, 5), size=(20, 10), orient='auto', markerUnits='strokeWidth') arrow.add(dwg.path(d='M0,10 l3.128,-5 l-3.128,-5 l20,5 Z', fill='#f00')) dwg.defs.add(arrow) return arrow def marker01(name): # example http://vanseodesign.com/web-design/svg-markers/ # # # # # # # # # dwg = svgwrite.Drawing(name, size=('600px', '100px'), profile='full', debug=True) arrow = create_arrow_marker_sumner(dwg) # set marker attributes without marker-mixin works line = dwg.line(start=(50, 50), end=(250, 50), stroke='#000', stroke_width=5, marker_end=arrow.get_funciri()) # marker-mixin does not work line.set_markers(('', '', arrow)) # not useful here: line.set_markers(arrow) sets start and mid and end maker at once to the same maker # not useful here: line.set_markers(start_arrow, mid_maker, end_arrow) sets start and mid and end maker at once # NEW in v1.1.11 line.set_markers((None, None, arrow)) works to just set the end marker dwg.add(line) dwg.save(pretty=True) def marker02(name): # example http://vanseodesign.com/web-design/svg-markers/ # # # # # # # # # dwg = svgwrite.Drawing(name, size=('600px', '100px'), profile='full', debug=True) arrow = create_arrow_marker(dwg) line = dwg.line(start=(295, 50), end=(95, 75), stroke='#000', stroke_width=5, marker_end=arrow.get_funciri()) dwg.add(line) dwg.save(pretty=True) def marker03(name): # example http://vanseodesign.com/web-design/svg-markers/ # # # # # # # # # # # # # # # dwg = svgwrite.Drawing(name, size=('600px', '400px'), profile='full', debug=True) arrow = create_arrow_marker(dwg) circle_marker = dwg.marker(id='circle', insert=(2, 2), size=(4, 4)) circle_marker.add(dwg.circle(center=(2, 2), r=2, stroke='none', fill='#f00')) dwg.add(circle_marker) polyline = dwg.polyline(points=[(50, 100), (250, 100), (250, 200), (350, 200)], fill='none', stroke='#000', stroke_width=10) polyline.set_markers((circle_marker, circle_marker, arrow)) # start, mid, end dwg.add(polyline) path = dwg.path(d="M50,100 l0,200 l50,0", stroke="#000", fill="none", stroke_width=10) path.set_markers((circle_marker, circle_marker, arrow)) # start, mid, end dwg.add(path) line = dwg.line(start=(50, 100), end=(220, 270), stroke="#000", stroke_width=10) line.set_markers((circle_marker, circle_marker, arrow)) # start, mid, end dwg.add(line) dwg.save(pretty=True) if __name__ == '__main__': marker01("marker01.svg") marker02("marker02.svg") marker03("marker03.svg") # uses set_markers() svgwrite-1.4.1/makedata/000077500000000000000000000000001400026116000151245ustar00rootroot00000000000000svgwrite-1.4.1/makedata/SVG11Full_propertyTable.html000066400000000000000000001331551400026116000223620ustar00rootroot00000000000000 Property Index – SVG 1.1 (Second Edition)
SVG 1.1 (Second Edition) – 22 June 2010

Appendix N: Property Index

This appendix is informative, not normative.

NameValuesInitial valueApplies toInh.PercentagesMediaAnim.
‘alignment-baseline’auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | inheritsee property description‘tspan’, ‘tref’, ‘altGlyph’, ‘textPath’ elementsnoN/A visualyes
‘baseline-shift’baseline | sub | super | <percentage> | <length> | inheritbaseline‘tspan’, ‘tref’, ‘altGlyph’, ‘textPath’ elementsnorefer to the "line height" of the ‘text’ element, which in the case of SVG is defined to be equal to the font size visualyes
‘clip’ <shape> | auto | inheritautoelements which establish a new viewport, ‘pattern’ elements and ‘marker’ elementsnoN/A visualyes
‘clip-path’<funciri> | none | inheritnonecontainer elements and graphics elementsnoN/A visualyes
‘clip-rule’nonzero | evenodd | inheritnonzerographics elements within a ‘clipPath’ elementyesN/A visualyes
‘color’<color> | inheritdepends on user agentelements to which properties ‘fill’, ‘stroke’, ‘stop-color’, ‘flood-color’, ‘lighting-color’ applyyesN/A visualyes
‘color-interpolation’auto | sRGB | linearRGB | inheritsRGBcontainer elements, graphics elements and ‘animateColor’yesN/A visualyes
‘color-interpolation-filters’auto | sRGB | linearRGB | inheritlinearRGBfilter primitivesyesN/A visualyes
‘color-profile’auto | sRGB | <name> | <funciri> | inheritauto‘image’ elements that refer to raster imagesyesN/A visualyes
‘color-rendering’auto | optimizeSpeed | optimizeQuality | inheritautocontainer elements, graphics elements and ‘animateColor’yesN/A visualyes
‘cursor’[ [<funciri> ,]* [ auto | crosshair | default | pointer | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize| text | wait | help ] ] | inheritautocontainer elements and graphics elementsyesN/A visual, interactiveyes
‘direction’ltr | rtl | inheritltrtext content elementsyesN/A visualno
‘display’inline | block | list-item | run-in | compact | marker | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | none | inheritinline‘svg’, ‘g’, ‘switch’, ‘a’, ‘foreignObject’, graphics elements (including the ‘text’ element) and text sub-elements (i.e., ‘tspan’, ‘tref’, ‘altGlyph’, ‘textPath’)noN/A allyes
‘dominant-baseline’auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge | inheritautotext content elementsnoN/A visualyes
‘enable-background’accumulate | new [ <x> <y> <width> <height> ] | inheritaccumulatecontainer elementsnoN/A visualno
‘fill’<paint> (See Specifying paint)blackshapes and text content elementsyesN/A visualyes
‘fill-opacity’<opacity-value> | inherit1shapes and text content elementsyesN/A visualyes
‘fill-rule’nonzero | evenodd | inheritnonzeroshapes and text content elementsyesN/A visualyes
‘filter’<funciri> | none | inheritnonecontainer elements and graphics elementsnoN/A visualyes
‘flood-color’currentColor |
<color> [<icccolor>] |
inherit
black‘feFlood’ elementsnoN/A visualyes
‘flood-opacity’<opacity-value> | inherit1‘feFlood’ elementsnoN/A visualyes
‘font’[ [ ‘font-style’ || ‘font-variant’ || ‘font-weight’ ]? ‘font-size’ [ / 'line-height' ]? ‘font-family’ ] | caption | icon | menu | message-box | small-caption | status-bar | inheritsee individual propertiestext content elementsyessee individual properties visualyes [1]
‘font-family’[[ <family-name> | <generic-family> ],]* [ <family-name> | <generic-family>] | inheritdepends on user agenttext content elementsyesN/A visualyes
‘font-size’ <absolute-size> | <relative-size> | <length> | <percentage> | inheritmediumtext content elementsyes, the computed value is inheritedrefer to parent element's font size visualyes
‘font-size-adjust’ <number> | none | inheritnonetext content elementsyesN/A visualyes [1]
‘font-stretch’normal | wider | narrower | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | inheritnormaltext content elementsyesN/A visualyes
‘font-style’normal | italic | oblique | inheritnormaltext content elementsyesN/A visualyes
‘font-variant’normal | small-caps | inheritnormaltext content elementsyesN/A visualyes
‘font-weight’normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inheritnormaltext content elementsyesN/A visualyes
‘glyph-orientation-horizontal’<angle> | inherit0degtext content elementsyesN/A visualno
‘glyph-orientation-vertical’auto | <angle> | inheritautotext content elementsyesN/A visualno
‘image-rendering’auto | optimizeSpeed | optimizeQuality | inheritautoimagesyesN/A visualyes
‘kerning’auto | <length> | inheritautotext content elementsyesN/A visualyes
‘letter-spacing’normal | <length> | inheritnormaltext content elementsyesN/A visualyes
‘lighting-color’currentColor |
<color> [<icccolor>] |
inherit
white‘feDiffuseLighting’ and ‘feSpecularLighting’ elementsnoN/A visualyes
‘marker’see individual propertiessee individual properties‘path’, ‘line’, ‘polyline’ and ‘polygon’ elementsyesN/A visualyes
‘marker-end’
‘marker-mid’
‘marker-start’
none |
inherit |
<funciri>
none‘path’, ‘line’, ‘polyline’ and ‘polygon’ elementsyesN/A visualyes
‘mask’<funciri> | none | inheritnonecontainer elements and graphics elementsnoN/A visualyes
‘opacity’<opacity-value> | inherit1container elements and graphics elementsnoN/A visualyes
‘overflow’visible | hidden | scroll | auto | inheritsee proseelements which establish a new viewport, ‘pattern’ elements and ‘marker’ elementsnoN/A visualyes
‘pointer-events’visiblePainted | visibleFill | visibleStroke | visible |
painted | fill | stroke | all | none | inherit
visiblePaintedgraphics elementsyesN/A visualyes
‘shape-rendering’auto | optimizeSpeed | crispEdges |
geometricPrecision | inherit
autoshapesyesN/A visualyes
‘stop-color’currentColor |
<color> [<icccolor>] |
inherit
black‘stop’ elementsnoN/A visualyes
‘stop-opacity’<opacity-value> | inherit1‘stop’ elementsnoN/A visualyes
‘stroke’<paint> (See Specifying paint)noneshapes and text content elementsyesN/A visualyes
‘stroke-dasharray’none | <dasharray> | inheritnoneshapes and text content elementsyesN/A visualyes [1]
‘stroke-dashoffset’<percentage> | <length> | inherit0shapes and text content elementsyessee prose visualyes
‘stroke-linecap’butt | round | square | inheritbuttshapes and text content elementsyesN/A visualyes
‘stroke-linejoin’miter | round | bevel | inheritmitershapes and text content elementsyesN/A visualyes
‘stroke-miterlimit’<miterlimit> | inherit4shapes and text content elementsyesN/A visualyes
‘stroke-opacity’<opacity-value> | inherit1shapes and text content elementsyesN/A visualyes
‘stroke-width’<percentage> | <length> | inherit1shapes and text content elementsyesN/A visualyes
‘text-anchor’start | middle | end | inheritstarttext content elementsyesN/A visualyes
‘text-decoration’none | [ underline || overline || line-through || blink ] | inheritnonetext content elementsno (see prose)N/A visualyes
‘text-rendering’auto | optimizeSpeed | optimizeLegibility |
geometricPrecision | inherit
auto‘text’ elementsyesN/A visualyes
‘unicode-bidi’normal | embed | bidi-override | inheritnormaltext content elementsnoN/A visualno
‘visibility’visible | hidden | collapse | inheritvisiblegraphics elements (including the ‘text’ element) and text sub-elements (i.e., ‘tspan’, ‘tref’, ‘altGlyph’, ‘textPath’ and ‘a’)yesN/A visualyes
‘word-spacing’normal | <length> | inheritnormaltext content elementsyesN/A visualyes
‘writing-mode’lr-tb | rl-tb | tb-rl | lr | rl | tb | inheritlr-tb‘text’ elementsyesN/A visualno
  1. [1] The ‘font’, ‘font-size-adjust’ and ‘stroke-dasharray’ properties are animatable but do not support additive animation.
SVG 1.1 (Second Edition) – 22 June 2010
svgwrite-1.4.1/makedata/SVG12Tiny_attributeTable.html000066400000000000000000005511601400026116000225230ustar00rootroot00000000000000 Attribute and Property Tables – SVG Tiny 1.2
SVG Tiny 1.2 – 20081222

L Attribute and Property Tables

Contents

This appendix is informative.

This appendix lists the attributes and properties defined in this specification. While both attributes and properties are set on elements using the XML attributes syntax, they are conceptually different and therefore listed separately. Attributes are straightforward XML attributes that generally capture information specific to a given element, such as for instance the radius of a circle or the height of a text area. Properties add to that the fact that they capture CSS information, and therefore behave as if the equivalent CSS property had been set on the same element using a style sheet. SVG Tiny 1.2 does not require support for a style sheet language, but should the user agent use one these properties are also usable for use with it.

The following legend details how these two tables should be read.

Property or Attribute
The name of the property or attribute being described.
Value
For each property or attribute, the values that it accepts.
Elements
For each attribute, the elements that it may occur on.
ani.
This column indicates whether or not the given attribute or property may be animated. There are two options:
This attribute or property may be animated.
This attribute or property may not be animated.
inh.
This column indicates whether or not the given attribute or property is inheritable. There are two options:
This attribute or property is inherited by default.
This attribute or property is not be inherited by default.
<text>
Indicates that character data can occur as the value of a given attribute.

L.1 Property table

Property ani. inh. Value
'audio-level' <number> | 'inherit'
'buffered-rendering' 'auto' | 'dynamic' | 'static' | 'inherit'
'color' <color> | 'inherit'
'color-rendering' 'auto' | 'optimizeSpeed' | 'optimizeQuality' | 'inherit'
'direction' 'ltr' | 'rtl' | 'inherit'
'display' 'inline' | 'block' | 'list-item' | 'run-in' | 'compact' | 'marker' | 'table' | 'inline-table' | 'table-row-group' | 'table-header-group' | 'table-footer-group' | 'table-row' | 'table-column-group' | 'table-column' | 'table-cell' | 'table-caption' | 'none' | 'inherit'
'display-align' 'auto' | 'before' | 'center' | 'after' | 'inherit'
'fill' <paint> | 'inherit'
'fill-opacity' <number> | 'inherit'
'fill-rule' 'nonzero' | 'evenodd' | 'inherit'
'font-family' <font-family-value> | 'inherit'
'font-size' <font-size-value> | 'inherit'
'font-style' 'normal' | 'italic' | 'oblique' | 'inherit'
'font-variant' 'normal' | 'small-caps' | 'inherit'
'font-weight' 'normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | 'inherit'
'image-rendering' 'auto' | 'optimizeSpeed' | 'optimizeQuality' | 'inherit'
'line-increment' 'auto' | <number> | 'inherit'
'opacity' <number> | 'inherit'
'pointer-events' 'visiblePainted' | 'visibleFill' | 'visibleStroke' | 'visible' | 'painted' | 'fill' | 'stroke' | 'all' | 'none' | 'inherit'
'shape-rendering' 'auto' | 'optimizeSpeed' | 'crispEdges' | 'geometricPrecision' | 'inherit'
'solid-color' <color> | 'inherit'
'solid-opacity' <number> | 'inherit'
'stop-color' <color> | 'inherit'
'stop-opacity' <number> | 'inherit'
'stroke' <paint> | 'inherit'
'stroke-dasharray' 'none' | <list-of-lengths> | 'inherit'
'stroke-dashoffset' <length> | 'inherit'
'stroke-linecap' 'butt' | 'round' | 'square' | 'inherit'
'stroke-linejoin' 'miter' | 'round' | 'bevel' | 'inherit'
'stroke-miterlimit' <number> | 'inherit'
'stroke-opacity' <number> | 'inherit'
'stroke-width' <length> | 'inherit'
'text-align' 'start' | 'center' | 'end' | 'inherit'
'text-anchor' 'start' | 'middle' | 'end' | 'inherit'
'text-rendering' 'auto' | 'optimizeSpeed' | 'optimizeLegibility' | 'geometricPrecision' | 'inherit'
'unicode-bidi' 'normal' | 'embed' | 'bidi-override' | 'inherit'
'vector-effect' 'none' | 'non-scaling-stroke' | 'inherit'
'viewport-fill' 'none' | <color> | 'inherit'
'viewport-fill-opacity' <number> | 'inherit'
'visibility' 'visible' | 'hidden' | 'inherit'

L.2 Attribute table

Attribute ani. inh. Value Elements
about <list-of-strings> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
accent-height <number> font-face
accumulate 'none' | 'sum' animate, animateColor, animateMotion, animateTransform
additive 'replace' | 'sum' animate, animateColor, animateMotion, animateTransform
alphabetic <number> font-face
arabic-form <text> glyph
ascent <number> font-face
attributeName <QName> animate, animateColor, animateTransform, set
attributeType 'XML' | 'CSS' | 'auto' animate, animateColor, animateTransform, set
bandwidth <number> | 'auto' prefetch
baseProfile 'none' | 'tiny' | 'basic' | 'full' svg
bbox <text> font-face
begin <text> animate, animateColor, animateMotion, animateTransform, animation, audio, discard, set, video
by <text> animate, animateColor, animateMotion, animateTransform
calcMode 'discrete' | 'linear' | 'paced' | 'spline' animate, animateColor, animateMotion, animateTransform
cap-height <number> font-face
class <XML-NMTOKENS> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
content <string> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
contentScriptType <content-type> svg
cx <coordinate> circle, ellipse, radialGradient
cy <coordinate> circle, ellipse, radialGradient
d <path-data> glyph, missing-glyph, path
datatype <string> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
defaultAction 'perform' | 'cancel' listener
descent <number> font-face
dur <text> animate, animateColor, animateMotion, animateTransform, animation, audio, set, video
editable 'none' | 'simple' text, textArea
end <text> animate, animateColor, animateMotion, animateTransform, animation, audio, set, video
ev:event <XML-NMTOKEN> handler
event <XML-NMTOKEN> listener
externalResourcesRequired <boolean> a, animation, audio, font, font-face, font-face-uri, foreignObject, g, handler, image, script, svg, switch, use, video
fill 'remove' | 'freeze' animate, animateColor, animateMotion, animateTransform, animation, audio, set, video
focusHighlight 'auto' | 'none' a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
focusable 'auto' | <boolean> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
font-family <text> font-face
font-stretch <text> font-face
font-style <text> font-face
font-variant <text> font-face
font-weight <text> font-face
from <text> animate, animateColor, animateMotion, animateTransform
g1 <text> hkern
g2 <text> hkern
glyph-name <text> glyph
gradientUnits 'userSpaceOnUse' | 'objectBoundingBox' linearGradient, radialGradient
handler <IRI> listener
hanging <number> font-face
height <length> animation, foreignObject, image, rect, svg, video
height <length> | 'auto' textArea
horiz-adv-x <number> font, glyph, missing-glyph
horiz-origin-x <number> font
id <ID> | <NCName> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
ideographic <number> font-face
initialVisibility 'whenStarted' | 'always' animation, video
k <number> hkern
keyPoints <text> animateMotion
keySplines <text> animate, animateColor, animateMotion, animateTransform
keyTimes <text> animate, animateColor, animateMotion, animateTransform
lang <list-of-language-ids> glyph
mathematical <number> font-face
max <text> animate, animateColor, animateMotion, animateTransform, animation, audio, set, video
mediaCharacterEncoding <text> prefetch
mediaContentEncodings <text> prefetch
mediaSize <number> prefetch
mediaTime <text> prefetch
min <text> animate, animateColor, animateMotion, animateTransform, animation, audio, set, video
nav-down <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
nav-down-left <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
nav-down-right <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
nav-left <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
nav-next <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
nav-prev <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
nav-right <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
nav-up <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
nav-up-left <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
nav-up-right <focus> a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, svg, switch, text, textArea, tspan, use, video
observer <IDREF> listener
offset <number> stop
origin <text> animateMotion
overlay 'none' | 'top' video
overline-position <number> font-face
overline-thickness <number> font-face
panose-1 <text> font-face
path <text> animateMotion
pathLength <number> path
phase 'default' | 'capture' listener
playbackOrder 'all' | 'forwardOnly' svg
points <points-data> polygon, polyline
preserveAspectRatio <text> animation, image, svg, video
propagate 'continue' | 'stop' listener
property <list-of-strings> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
r <length> circle, radialGradient
rel <list-of-strings> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
repeatCount <text> animate, animateColor, animateMotion, animateTransform, animation, audio, set, video
repeatDur <text> animate, animateColor, animateMotion, animateTransform, animation, audio, set, video
requiredExtensions <list-of-IRIs> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, desc, discard, ellipse, foreignObject, g, image, line, metadata, path, polygon, polyline, rect, set, switch, tbreak, text, textArea, title, tspan, use, video
requiredFeatures <list-of-IRIs> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, desc, discard, ellipse, foreignObject, g, image, line, metadata, path, polygon, polyline, rect, set, switch, tbreak, text, textArea, title, tspan, use, video
requiredFonts <list-of-family-names> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, desc, discard, ellipse, foreignObject, g, image, line, metadata, path, polygon, polyline, rect, set, switch, tbreak, text, textArea, title, tspan, use, video
requiredFormats <list-of-content-types> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, desc, discard, ellipse, foreignObject, g, image, line, metadata, path, polygon, polyline, rect, set, switch, tbreak, text, textArea, title, tspan, use, video
resource <string> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
restart 'always' | 'never' | 'whenNotActive' animate, animateColor, animateMotion, animateTransform, animation, audio, set, video
rev <list-of-strings> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
role <list-of-strings> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
rotate <text> animateMotion
rotate <list-of-numbers> text
rx <length> ellipse, rect
ry <length> ellipse, rect
slope <number> font-face
snapshotTime 'none' | <Clock-value> svg
stemh <number> font-face
stemv <number> font-face
strikethrough-position <number> font-face
strikethrough-thickness <number> font-face
syncBehavior 'canSlip' | 'locked' | 'independent' | 'default' animation, audio, video
syncBehaviorDefault 'canSlip' | 'locked' | 'independent' | 'inherit' svg
syncMaster <boolean> animation, audio, video
syncTolerance <Clock-value> | 'default' animation, audio, video
syncToleranceDefault <Clock-value> | 'inherit' svg
systemLanguage <list-of-language-ids> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, desc, discard, ellipse, foreignObject, g, image, line, metadata, path, polygon, polyline, rect, set, switch, tbreak, text, textArea, title, tspan, use, video
target '_replace' | '_self' | '_parent' | '_top' | '_blank' | <XML-Name> a
target <IDREF> listener
timelineBegin 'onLoad' | 'onStart' svg
to <text> animate, animateColor, animateMotion, animateTransform, set
transform <transform> | 'none' a, animation, circle, ellipse, foreignObject, g, image, line, path, polygon, polyline, rect, switch, text, textArea, use, video
transformBehavior 'geometric' | 'pinned' | 'pinned90' | 'pinned180' | 'pinned270' video
type <content-type> handler, script
type <content-type> audio, image, video
type 'translate' | 'scale' | 'rotate' | 'skewX' | 'skewY' animateTransform
typeof <list-of-strings> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
u1 <text> hkern
u2 <text> hkern
underline-position <number> font-face
underline-thickness <number> font-face
unicode <text> glyph
unicode-range <text> font-face
units-per-em <number> font-face
values <text> animate, animateColor, animateMotion, animateTransform
version '1.0' | '1.1' | '1.2' svg
viewBox <text> svg
width <length> animation, foreignObject, image, rect, svg, video
width <length> | 'auto' textArea
widths <text> font-face
x <coordinate> animation, foreignObject, image, rect, textArea, use, video
x-height <number> font-face
x1 <coordinate> line, linearGradient
x2 <coordinate> line, linearGradient
x <list-of-coordinates> text
xml:base <IRI> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
xml:id <NCName> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
xml:lang <language-id> a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, handler, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
xml:space 'default' | 'preserve' a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, font-face-src, font-face-uri, foreignObject, g, glyph, hkern, image, line, linearGradient, listener, metadata, missing-glyph, mpath, path, polygon, polyline, prefetch, radialGradient, rect, set, solidColor, stop, svg, switch, tbreak, text, textArea, title, tspan, use, video
xml:space 'preserve' handler, script
y <coordinate> animation, foreignObject, image, rect, textArea, use, video
y1 <coordinate> line, linearGradient
y2 <coordinate> line, linearGradient
y <list-of-coordinates> text
zoomAndPan 'disable' | 'magnify' svg
svgwrite-1.4.1/makedata/SVG12Tiny_elementTable.html000066400000000000000000005034551400026116000221550ustar00rootroot00000000000000 Element Table – SVG Tiny 1.2
SVG Tiny 1.2 – 20081222

K Element Table

This appendix is informative.

This appendix lists the elements that are defined in this specification. The following legend details how it should be read.

Elements
Column containing the element names. All elements are in the SVG namespace, except for 'listener' which is in the XML Events namespace.
Attributes
For each element, this lists the attributes which may occur on it. Note that these are only the attributes and not the properties.
prop.
This column indicates whether or not the given element may receive properties. There are several options:
All properties defined in this specification can be set as attributes on the given element.
None of the properties defined in this specification can be set as attributes on the given element.
M
Only the properties in the media group can be set on this given element. The media group is a subset of the properties that is meaningful on media elements and does not cause the 'fill' property to clash with the 'fill' SMIL attribute. The media group comprises the following properties: 'audio-level', 'buffered-rendering', 'display', 'image-rendering', 'pointer-events', 'shape-rendering', 'text-rendering', 'viewport-fill', 'viewport-fill-opacity', and 'visibility'.
Possible Children
Lists the elements that can occur as children of the given element. Note that this is not the real content of the element as defined in the RelaxNG schema.
<text>
Indicates that character data can occur as the child of a given element.
Elements Attributes prop. Possible Children
'a' about, class, content, datatype, externalResourcesRequired, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, target, transform, typeof, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space The 'a' element may contain any element that its parent may contain, except itself.
'animate' about, accumulate, additive, attributeName, attributeType, begin, by, calcMode, class, content, datatype, dur, end, fill, from, id, keySplines, keyTimes, max, min, property, rel, repeatCount, repeatDur, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, restart, rev, role, systemLanguage, to, typeof, values, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space desc, handler, metadata, switch, title
'animateColor' about, accumulate, additive, attributeName, attributeType, begin, by, calcMode, class, content, datatype, dur, end, fill, from, id, keySplines, keyTimes, max, min, property, rel, repeatCount, repeatDur, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, restart, rev, role, systemLanguage, to, typeof, values, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space desc, handler, metadata, switch, title
'animateMotion' about, accumulate, additive, begin, by, calcMode, class, content, datatype, dur, end, fill, from, id, keyPoints, keySplines, keyTimes, max, min, origin, path, property, rel, repeatCount, repeatDur, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, restart, rev, role, rotate, systemLanguage, to, typeof, values, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space desc, handler, metadata, mpath, switch, title
'animateTransform' about, accumulate, additive, attributeName, attributeType, begin, by, calcMode, class, content, datatype, dur, end, fill, from, id, keySplines, keyTimes, max, min, property, rel, repeatCount, repeatDur, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, restart, rev, role, systemLanguage, to, type, typeof, values, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space desc, handler, metadata, switch, title
'animation' about, begin, class, content, datatype, dur, end, externalResourcesRequired, fill, focusHighlight, focusable, height, id, initialVisibility, max, min, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, preserveAspectRatio, property, rel, repeatCount, repeatDur, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, restart, rev, role, syncBehavior, syncMaster, syncTolerance, systemLanguage, transform, typeof, width, x, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space, y M animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'audio' about, begin, class, content, datatype, dur, end, externalResourcesRequired, fill, id, max, min, property, rel, repeatCount, repeatDur, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, restart, rev, role, syncBehavior, syncMaster, syncTolerance, systemLanguage, type, typeof, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space M animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'circle' about, class, content, cx, cy, datatype, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, r, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, xml:base, xml:id, xml:lang, xml:space animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'defs' about, class, content, datatype, id, property, rel, resource, rev, role, typeof, xml:base, xml:id, xml:lang, xml:space a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, foreignObject, g, handler, image, line, linearGradient, listener, metadata, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, switch, text, textArea, title, use, video
'desc' about, class, content, datatype, id, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, typeof, xml:base, xml:id, xml:lang, xml:space M <text>
'discard' about, begin, class, content, datatype, id, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, typeof, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space desc, handler, metadata, switch, title
'ellipse' about, class, content, cx, cy, datatype, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, rx, ry, systemLanguage, transform, typeof, xml:base, xml:id, xml:lang, xml:space animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'font' about, class, content, datatype, externalResourcesRequired, horiz-adv-x, horiz-origin-x, id, property, rel, resource, rev, role, typeof, xml:base, xml:id, xml:lang, xml:space desc, font-face, glyph, hkern, metadata, missing-glyph, switch, title
'font-face' about, accent-height, alphabetic, ascent, bbox, cap-height, class, content, datatype, descent, externalResourcesRequired, font-family, font-stretch, font-style, font-variant, font-weight, hanging, id, ideographic, mathematical, overline-position, overline-thickness, panose-1, property, rel, resource, rev, role, slope, stemh, stemv, strikethrough-position, strikethrough-thickness, typeof, underline-position, underline-thickness, unicode-range, units-per-em, widths, x-height, xml:base, xml:id, xml:lang, xml:space desc, font-face-src, metadata, switch, title
'font-face-src' about, class, content, datatype, id, property, rel, resource, rev, role, typeof, xml:base, xml:id, xml:lang, xml:space desc, font-face-uri, metadata, switch, title
'font-face-uri' about, class, content, datatype, externalResourcesRequired, id, property, rel, resource, rev, role, typeof, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space desc, metadata, switch, title
'foreignObject' about, class, content, datatype, externalResourcesRequired, focusHighlight, focusable, height, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, width, x, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space, y desc, metadata, svg, switch, title
'g' about, class, content, datatype, externalResourcesRequired, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, xml:base, xml:id, xml:lang, xml:space a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, foreignObject, g, handler, image, line, linearGradient, listener, metadata, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, switch, text, textArea, title, use, video
'glyph' about, arabic-form, class, content, d, datatype, glyph-name, horiz-adv-x, id, lang, property, rel, resource, rev, role, typeof, unicode, xml:base, xml:id, xml:lang, xml:space desc, metadata, switch, title
'handler' about, class, content, datatype, ev:event, externalResourcesRequired, id, property, rel, resource, rev, role, type, typeof, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space <text>, desc, metadata, switch, title
'hkern' about, class, content, datatype, g1, g2, id, k, property, rel, resource, rev, role, typeof, u1, u2, xml:base, xml:id, xml:lang, xml:space desc, metadata, switch, title
'image' about, class, content, datatype, externalResourcesRequired, focusHighlight, focusable, height, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, opacity, preserveAspectRatio, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, type, typeof, width, x, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space, y M animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'line' about, class, content, datatype, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, x1, x2, xml:base, xml:id, xml:lang, xml:space, y1, y2 animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'linearGradient' about, class, content, datatype, gradientUnits, id, property, rel, resource, rev, role, typeof, x1, x2, xml:base, xml:id, xml:lang, xml:space, y1, y2 animate, animateColor, animateMotion, animateTransform, desc, discard, metadata, set, stop, switch, title
'listener' about, class, content, datatype, defaultAction, event, handler, id, observer, phase, propagate, property, rel, resource, rev, role, target, typeof, xml:base, xml:id, xml:lang, xml:space
'metadata' about, class, content, datatype, id, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, typeof, xml:base, xml:id, xml:lang, xml:space M <text>
'missing-glyph' about, class, content, d, datatype, horiz-adv-x, id, property, rel, resource, rev, role, typeof, xml:base, xml:id, xml:lang, xml:space desc, metadata, switch, title
'mpath' about, class, content, datatype, id, property, rel, resource, rev, role, typeof, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space desc, metadata, switch, title
'path' about, class, content, d, datatype, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, pathLength, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, xml:base, xml:id, xml:lang, xml:space animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'polygon' about, class, content, datatype, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, points, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, xml:base, xml:id, xml:lang, xml:space animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'polyline' about, class, content, datatype, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, points, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, xml:base, xml:id, xml:lang, xml:space animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'prefetch' about, bandwidth, class, content, datatype, id, mediaCharacterEncoding, mediaContentEncodings, mediaSize, mediaTime, property, rel, resource, rev, role, typeof, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space desc, metadata, switch, title
'radialGradient' about, class, content, cx, cy, datatype, gradientUnits, id, property, r, rel, resource, rev, role, typeof, xml:base, xml:id, xml:lang, xml:space animate, animateColor, animateMotion, animateTransform, desc, discard, metadata, set, stop, switch, title
'rect' about, class, content, datatype, focusHighlight, focusable, height, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, rx, ry, systemLanguage, transform, typeof, width, x, xml:base, xml:id, xml:lang, xml:space, y animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'script' about, class, content, datatype, externalResourcesRequired, id, property, rel, resource, rev, role, type, typeof, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space <text>, desc, metadata, switch, title
'set' about, attributeName, attributeType, begin, class, content, datatype, dur, end, fill, id, max, min, property, rel, repeatCount, repeatDur, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, restart, rev, role, systemLanguage, to, typeof, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space desc, handler, metadata, switch, title
'solidColor' about, class, content, datatype, id, property, rel, resource, rev, role, typeof, xml:base, xml:id, xml:lang, xml:space animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'stop' about, class, content, datatype, id, offset, property, rel, resource, rev, role, typeof, xml:base, xml:id, xml:lang, xml:space animate, animateColor, animateMotion, animateTransform, desc, discard, metadata, set, switch, title
'svg' about, baseProfile, class, content, contentScriptType, datatype, externalResourcesRequired, focusHighlight, focusable, height, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, playbackOrder, preserveAspectRatio, property, rel, resource, rev, role, snapshotTime, syncBehaviorDefault, syncToleranceDefault, timelineBegin, typeof, version, viewBox, width, xml:base, xml:id, xml:lang, xml:space, zoomAndPan a, animate, animateColor, animateMotion, animateTransform, animation, audio, circle, defs, desc, discard, ellipse, font, font-face, foreignObject, g, handler, image, line, linearGradient, listener, metadata, path, polygon, polyline, prefetch, radialGradient, rect, script, set, solidColor, switch, text, textArea, title, use, video
'switch' about, class, content, datatype, externalResourcesRequired, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, xml:base, xml:id, xml:lang, xml:space The 'switch' element may contain any element that its parent may contain.
'tbreak' about, class, content, datatype, id, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, typeof, xml:base, xml:id, xml:lang, xml:space
'text' about, class, content, datatype, editable, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, rotate, systemLanguage, transform, typeof, x, xml:base, xml:id, xml:lang, xml:space, y <text>, a, animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title, tspan
'textArea' about, class, content, datatype, editable, focusHighlight, focusable, height, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, width, x, xml:base, xml:id, xml:lang, xml:space, y <text>, a, animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, tbreak, title, tspan
'title' about, class, content, datatype, id, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, typeof, xml:base, xml:id, xml:lang, xml:space M <text>
'tspan' about, class, content, datatype, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, typeof, xml:base, xml:id, xml:lang, xml:space The 'tspan' element may contain any element that its parent may contain.
'use' about, class, content, datatype, externalResourcesRequired, focusHighlight, focusable, id, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, property, rel, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, rev, role, systemLanguage, transform, typeof, x, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space, y animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
'video' about, begin, class, content, datatype, dur, end, externalResourcesRequired, fill, focusHighlight, focusable, height, id, initialVisibility, max, min, nav-down, nav-down-left, nav-down-right, nav-left, nav-next, nav-prev, nav-right, nav-up, nav-up-left, nav-up-right, overlay, preserveAspectRatio, property, rel, repeatCount, repeatDur, requiredExtensions, requiredFeatures, requiredFonts, requiredFormats, resource, restart, rev, role, syncBehavior, syncMaster, syncTolerance, systemLanguage, transform, transformBehavior, type, typeof, width, x, xlink:actuate, xlink:arcrole, xlink:href, xlink:role, xlink:show, xlink:title, xlink:type, xml:base, xml:id, xml:lang, xml:space, y M animate, animateColor, animateMotion, animateTransform, desc, discard, handler, metadata, set, switch, title
svgwrite-1.4.1/makedata/cache.py000066400000000000000000000137711400026116000165520ustar00rootroot00000000000000import sys import time import re import os import urllib2 import httplib import unittest import hashlib import StringIO __version__ = (0,1) __author__ = "Staffan Malmgren " class ThrottlingProcessor(urllib2.BaseHandler): """Prevents overloading the remote web server by delaying requests. Causes subsequent requests to the same web server to be delayed a specific amount of seconds. The first request to the server always gets made immediately""" __shared_state = {} def __init__(self,throttleDelay=5): """The number of seconds to wait between subsequent requests""" # Using the Borg design pattern to achieve shared state # between object instances: self.__dict__ = self.__shared_state self.throttleDelay = throttleDelay if not hasattr(self,'lastRequestTime'): self.lastRequestTime = {} def default_open(self,request): currentTime = time.time() if ((request.host in self.lastRequestTime) and (time.time() - self.lastRequestTime[request.host] < self.throttleDelay)): self.throttleTime = (self.throttleDelay - (currentTime - self.lastRequestTime[request.host])) # print("ThrottlingProcessor: Sleeping for %s seconds" % self.throttleTime) time.sleep(self.throttleTime) self.lastRequestTime[request.host] = currentTime return None def http_response(self,request,response): if hasattr(self,'throttleTime'): response.info().addheader("x-throttling", "%s seconds" % self.throttleTime) del(self.throttleTime) return response class CacheHandler(urllib2.BaseHandler): """Stores responses in a persistant on-disk cache. If a subsequent GET request is made for the same URL, the stored response is returned, saving time, resources and bandwith""" def __init__(self,cacheLocation): """The location of the cache directory""" self.cacheLocation = cacheLocation if not os.path.exists(self.cacheLocation): os.mkdir(self.cacheLocation) def default_open(self,request): if ((request.get_method() == "GET") and (CachedResponse.ExistsInCache(self.cacheLocation, request.get_full_url()))): # print("CacheHandler: Returning CACHED response for %s" % request.get_full_url()) return CachedResponse(self.cacheLocation, request.get_full_url(), setCacheHeader=True) else: return None # let the next handler try to handle the request def http_response(self, request, response): if request.get_method() == "GET": if 'x-cache' not in response.info(): CachedResponse.StoreInCache(self.cacheLocation, request.get_full_url(), response) return CachedResponse(self.cacheLocation, request.get_full_url(), setCacheHeader=False) else: return CachedResponse(self.cacheLocation, request.get_full_url(), setCacheHeader=True) else: return response class CachedResponse(StringIO.StringIO): """An urllib2.response-like object for cached responses. To determine wheter a response is cached or coming directly from the network, check the x-cache header rather than the object type.""" def ExistsInCache(cacheLocation, url): hash = hashlib.md5(url).hexdigest() return (os.path.exists(cacheLocation + "/" + hash + ".headers") and os.path.exists(cacheLocation + "/" + hash + ".body")) ExistsInCache = staticmethod(ExistsInCache) def StoreInCache(cacheLocation, url, response): hash = hashlib.md5(url).hexdigest() f = open(cacheLocation + "/" + hash + ".headers", "w") headers = str(response.info()) f.write(headers) f.close() f = open(cacheLocation + "/" + hash + ".body", "w") f.write(response.read()) f.close() StoreInCache = staticmethod(StoreInCache) def __init__(self, cacheLocation,url,setCacheHeader=True): self.cacheLocation = cacheLocation hash = hashlib.md5(url).hexdigest() StringIO.StringIO.__init__(self, file(self.cacheLocation + "/" + hash+".body").read()) self.url = url self.code = 200 self.msg = "OK" headerbuf = file(self.cacheLocation + "/" + hash+".headers").read() if setCacheHeader: headerbuf += "x-cache: %s/%s\r\n" % (self.cacheLocation,hash) self.headers = httplib.HTTPMessage(StringIO.StringIO(headerbuf)) def info(self): return self.headers def geturl(self): return self.url class Tests(unittest.TestCase): def setUp(self): # Clearing cache if os.path.exists(".urllib2cache"): for f in os.listdir(".urllib2cache"): os.unlink("%s/%s" % (".urllib2cache", f)) # Clearing throttling timeouts t = ThrottlingProcessor() t.lastRequestTime.clear() def testCache(self): opener = urllib2.build_opener(CacheHandler(".urllib2cache")) resp = opener.open("http://www.python.org/") self.assert_('x-cache' not in resp.info()) resp = opener.open("http://www.python.org/") self.assert_('x-cache' in resp.info()) def testThrottle(self): opener = urllib2.build_opener(ThrottlingProcessor(5)) resp = opener.open("http://www.python.org/") self.assert_('x-throttling' not in resp.info()) resp = opener.open("http://www.python.org/") self.assert_('x-throttling' in resp.info()) def testCombined(self): opener = urllib2.build_opener(CacheHandler(".urllib2cache"), ThrottlingProcessor(10)) resp = opener.open("http://www.python.org/") self.assert_('x-cache' not in resp.info()) self.assert_('x-throttling' not in resp.info()) resp = opener.open("http://www.python.org/") self.assert_('x-cache' in resp.info()) self.assert_('x-throttling' not in resp.info()) if __name__ == "__main__": unittest.main() svgwrite-1.4.1/makedata/full11attributes.py000066400000000000000000001066411400026116000207210ustar00rootroot00000000000000#coding:utf-8 # generated by: D:\User\Python\svgwrite\makedata\makefull11data.py from svgwrite.types import SVGAttribute full11_attributes = { 'accent-height': SVGAttribute('accent-height', anim=True, types=frozenset([u'number']), const=frozenset([])), 'accumulate': SVGAttribute('accumulate', anim=True, types=frozenset([]), const=frozenset([u'none', u'sum'])), 'additive': SVGAttribute('additive', anim=True, types=frozenset([]), const=frozenset([u'sum', u'replace'])), 'alignment-baseline': SVGAttribute('alignment-baseline', anim=True, types=frozenset([]), const=frozenset([u'mathematical', u'before-edge', u'central', u'baseline', u'auto', u'hanging', u'ideographic', u'inherit', u'middle', u'alphabetic', u'text-before-edge', u'text-after-edge', u'after-edge'])), 'alphabetic': SVGAttribute('alphabetic', anim=True, types=frozenset([u'number']), const=frozenset([])), 'amplitude': SVGAttribute('amplitude', anim=True, types=frozenset([u'number']), const=frozenset([])), 'arabic-form': SVGAttribute('arabic-form', anim=True, types=frozenset([]), const=frozenset([u'terminal', u'initial', u'isolated', u'medial'])), 'ascent': SVGAttribute('ascent', anim=True, types=frozenset([u'number']), const=frozenset([])), 'attributeName': SVGAttribute('attributeName', anim=True, types=frozenset([u'attributeName']), const=frozenset([])), 'attributeType': SVGAttribute('attributeType', anim=True, types=frozenset([]), const=frozenset([u'XML', u'auto', u'CSS'])), 'azimuth': SVGAttribute('azimuth', anim=True, types=frozenset([u'number']), const=frozenset([])), 'baseFrequency': SVGAttribute('baseFrequency', anim=True, types=frozenset([u'number-optional-number']), const=frozenset([])), 'baseline-shift': SVGAttribute('baseline-shift', anim=True, types=frozenset([u'percentage', u'length']), const=frozenset([u'super', u'baseline', u'inherit', u'sub'])), 'baseProfile': SVGAttribute('baseProfile', anim=True, types=frozenset([u'profile-name']), const=frozenset([])), 'bbox': SVGAttribute('bbox', anim=True, types=frozenset([u'string']), const=frozenset([])), 'begin': SVGAttribute('begin', anim=True, types=frozenset([u'begin-value-list']), const=frozenset([])), 'bias': SVGAttribute('bias', anim=True, types=frozenset([u'number']), const=frozenset([])), 'by': SVGAttribute('by', anim=True, types=frozenset([u'value']), const=frozenset([])), 'calcMode': SVGAttribute('calcMode', anim=True, types=frozenset([]), const=frozenset([u'discrete', u'linear', u'paced', u'spline'])), 'cap-height': SVGAttribute('cap-height', anim=True, types=frozenset([u'number']), const=frozenset([])), 'class': SVGAttribute('class', anim=True, types=frozenset([]), const=frozenset([u'list'])), 'clip': SVGAttribute('clip', anim=True, types=frozenset([u'shape']), const=frozenset([u'auto', u'inherit'])), 'clip-path': SVGAttribute('clip-path', anim=True, types=frozenset([u'uri']), const=frozenset([u'none', u'inherit'])), 'clip-rule': SVGAttribute('clip-rule', anim=True, types=frozenset([]), const=frozenset([u'nonzero', u'evenodd', u'inherit'])), 'clipPathUnits': SVGAttribute('clipPathUnits', anim=True, types=frozenset([]), const=frozenset([u'userSpaceOnUse', u'objectBoundingBox'])), 'color': SVGAttribute('color', anim=True, types=frozenset([u'color']), const=frozenset([u'inherit'])), 'color-interpolation': SVGAttribute('color-interpolation', anim=True, types=frozenset([]), const=frozenset([u'auto', u'sRGB', u'inherit', u'linearRGB'])), 'color-interpolation-filters': SVGAttribute('color-interpolation-filters', anim=True, types=frozenset([]), const=frozenset([u'auto', u'sRGB', u'inherit', u'linearRGB'])), 'color-profile': SVGAttribute('color-profile', anim=True, types=frozenset([u'uri', u'name']), const=frozenset([u'auto', u'sRGB', u'inherit'])), 'color-rendering': SVGAttribute('color-rendering', anim=True, types=frozenset([]), const=frozenset([u'auto', u'optimizeQuality', u'optimizeSpeed', u'inherit'])), 'contentScriptType': SVGAttribute('contentScriptType', anim=True, types=frozenset([u'content-type']), const=frozenset([])), 'contentStyleType': SVGAttribute('contentStyleType', anim=True, types=frozenset([]), const=frozenset([u''])), 'cursor': SVGAttribute('cursor', anim=True, types=frozenset([]), const=frozenset([u'sw-resize', u'n-resize', u'help', u'text', u'move', u' , * auto', u'w-resize', u'pointer', u'wait', u's-resize', u'e-resize', u'default', u'inherit', u'nw-resize', u'ne-resize', u'crosshair', u'se-resize'])), 'cx': SVGAttribute('cx', anim=True, types=frozenset([]), const=frozenset([u''])), 'cy': SVGAttribute('cy', anim=True, types=frozenset([]), const=frozenset([u''])), 'd': SVGAttribute('d', anim=True, types=frozenset([]), const=frozenset([u''])), 'descent': SVGAttribute('descent', anim=True, types=frozenset([u'number']), const=frozenset([])), 'diffuseConstant': SVGAttribute('diffuseConstant', anim=True, types=frozenset([u'number']), const=frozenset([])), 'direction': SVGAttribute('direction', anim=True, types=frozenset([]), const=frozenset([u'ltr', u'inherit', u'rtl'])), 'display': SVGAttribute('display', anim=True, types=frozenset([]), const=frozenset([u'inline-table', u'table-header-group', u'table-footer-group', u'none', u'table-row', u'table-caption', u'table-column', u'marker', u'table', u'compact', u'table-row-group', u'run-in', u'inherit', u'list-item', u'table-cell', u'inline', u'block', u'table-column-group'])), 'divisor': SVGAttribute('divisor', anim=True, types=frozenset([u'number']), const=frozenset([])), 'dominant-baseline': SVGAttribute('dominant-baseline', anim=True, types=frozenset([]), const=frozenset([u'mathematical', u'use-script', u'ideographic', u'central', u'reset-size', u'auto', u'hanging', u'inherit', u'middle', u'alphabetic', u'text-before-edge', u'text-after-edge', u'no-change'])), 'dur': SVGAttribute('dur', anim=True, types=frozenset([u'Clock-value']), const=frozenset([u'media', u'indefinite'])), 'dx': SVGAttribute('dx', anim=True, types=frozenset([]), const=frozenset([u'+++'])), 'dy': SVGAttribute('dy', anim=True, types=frozenset([]), const=frozenset([u'+++'])), 'edgeMode': SVGAttribute('edgeMode', anim=True, types=frozenset([]), const=frozenset([u'wrap', u'duplicate', u'none'])), 'elevation': SVGAttribute('elevation', anim=True, types=frozenset([u'number']), const=frozenset([])), 'end': SVGAttribute('end', anim=True, types=frozenset([u'end-value-list']), const=frozenset([])), 'exponent': SVGAttribute('exponent', anim=True, types=frozenset([u'number']), const=frozenset([])), 'externalResourcesRequired': SVGAttribute('externalResourcesRequired', anim=True, types=frozenset([]), const=frozenset([u'true', u'false'])), 'fill': SVGAttribute('fill', anim=True, types=frozenset([]), const=frozenset([u'currentColor', u'removepresentation elements:none', u' icc-color( , *)', u' none', u'animation elements:freeze', u'inherit'])), 'fill-opacity': SVGAttribute('fill-opacity', anim=True, types=frozenset([u'opacity-value']), const=frozenset([u'inherit'])), 'fill-rule': SVGAttribute('fill-rule', anim=True, types=frozenset([]), const=frozenset([u'nonzero', u'evenodd', u'inherit'])), 'filter': SVGAttribute('filter', anim=True, types=frozenset([u'uri']), const=frozenset([u'none', u'inherit'])), 'filterRes': SVGAttribute('filterRes', anim=True, types=frozenset([u'number-optional-number']), const=frozenset([])), 'filterUnits': SVGAttribute('filterUnits', anim=True, types=frozenset([]), const=frozenset([u'userSpaceOnUse', u'objectBoundingBox'])), 'flood-color': SVGAttribute('flood-color', anim=True, types=frozenset([]), const=frozenset([u' icc-color( , *)', u'currentColor', u'inherit'])), 'flood-opacity': SVGAttribute('flood-opacity', anim=True, types=frozenset([u'opacity-value']), const=frozenset([u'inherit'])), 'font-family': SVGAttribute('font-family', anim=True, types=frozenset([u'string']), const=frozenset([])), 'font-size': SVGAttribute('font-size', anim=True, types=frozenset([u'string']), const=frozenset([])), 'font-size-adjust': SVGAttribute('font-size-adjust', anim=True, types=frozenset([u'number']), const=frozenset([u'none', u'inherit'])), 'font-stretch': SVGAttribute('font-stretch', anim=True, types=frozenset([]), const=frozenset([u'condensed', u'normal', u'ultra-condensed', u'expanded', u'narrower', u'inherit', u'semi-condensed', u'extra-condensed', u'ultra-expanded', u'wider', u'semi-expanded', u'extra-expanded'])), 'font-style': SVGAttribute('font-style', anim=True, types=frozenset([]), const=frozenset([u'oblique', u'inherit', u'italic', u'normal'])), 'font-variant': SVGAttribute('font-variant', anim=True, types=frozenset([]), const=frozenset([u'small-caps', u'inherit', u'normal'])), 'font-weight': SVGAttribute('font-weight', anim=True, types=frozenset([]), const=frozenset([u'200', u'900', u'bold', u'bolder', u'normal', u'300', u'700', u'inherit', u'lighter', u'400', u'100', u'800', u'500', u'600'])), 'format': SVGAttribute('format', anim=True, types=frozenset([]), const=frozenset([u''])), 'from': SVGAttribute('from', anim=True, types=frozenset([u'value']), const=frozenset([])), 'fx': SVGAttribute('fx', anim=True, types=frozenset([u'coordinate']), const=frozenset([])), 'fy': SVGAttribute('fy', anim=True, types=frozenset([u'coordinate']), const=frozenset([])), 'g1': SVGAttribute('g1', anim=True, types=frozenset([]), const=frozenset([u' , *'])), 'g2': SVGAttribute('g2', anim=True, types=frozenset([]), const=frozenset([u' , *'])), 'glyph-name': SVGAttribute('glyph-name', anim=True, types=frozenset([]), const=frozenset([u' , *'])), 'glyph-orientation-horizontal': SVGAttribute('glyph-orientation-horizontal', anim=True, types=frozenset([u'angle']), const=frozenset([u'inherit'])), 'glyph-orientation-vertical': SVGAttribute('glyph-orientation-vertical', anim=True, types=frozenset([u'angle']), const=frozenset([u'auto', u'inherit'])), 'glyphRef': SVGAttribute('glyphRef', anim=True, types=frozenset([]), const=frozenset([u''])), 'gradientTransform': SVGAttribute('gradientTransform', anim=True, types=frozenset([]), const=frozenset([u''])), 'gradientUnits': SVGAttribute('gradientUnits', anim=True, types=frozenset([]), const=frozenset([u'userSpaceOnUse', u'objectBoundingBox'])), 'hanging': SVGAttribute('hanging', anim=True, types=frozenset([u'number']), const=frozenset([])), 'height': SVGAttribute('height', anim=True, types=frozenset([]), const=frozenset([u''])), 'horiz-adv-x': SVGAttribute('horiz-adv-x', anim=True, types=frozenset([]), const=frozenset([u''])), 'horiz-origin-x': SVGAttribute('horiz-origin-x', anim=True, types=frozenset([u'number']), const=frozenset([])), 'horiz-origin-y': SVGAttribute('horiz-origin-y', anim=True, types=frozenset([u'number']), const=frozenset([])), 'id': SVGAttribute('id', anim=True, types=frozenset([]), const=frozenset([u''])), 'ideographic': SVGAttribute('ideographic', anim=True, types=frozenset([u'number']), const=frozenset([])), 'image-rendering': SVGAttribute('image-rendering', anim=True, types=frozenset([]), const=frozenset([u'auto', u'optimizeQuality', u'optimizeSpeed', u'inherit'])), 'in': SVGAttribute('in', anim=True, types=frozenset([u'filter-primitive-reference']), const=frozenset([u'SourceAlpha', u'SourceGraphic', u'BackgroundAlpha', u'BackgroundImage', u'StrokePaint', u'FillPaint'])), 'in2': SVGAttribute('in2', anim=True, types=frozenset([]), const=frozenset([u'(see in attribute)(see in attribute)(see in attribute)'])), 'intercept': SVGAttribute('intercept', anim=True, types=frozenset([u'number']), const=frozenset([])), 'k': SVGAttribute('k', anim=True, types=frozenset([u'number']), const=frozenset([])), 'k1': SVGAttribute('k1', anim=True, types=frozenset([u'number']), const=frozenset([])), 'k2': SVGAttribute('k2', anim=True, types=frozenset([u'number']), const=frozenset([])), 'k3': SVGAttribute('k3', anim=True, types=frozenset([u'number']), const=frozenset([])), 'k4': SVGAttribute('k4', anim=True, types=frozenset([u'number']), const=frozenset([])), 'kernelMatrix': SVGAttribute('kernelMatrix', anim=True, types=frozenset([u'list of numbers']), const=frozenset([])), 'kernelUnitLength': SVGAttribute('kernelUnitLength', anim=True, types=frozenset([]), const=frozenset([u''])), 'kerning': SVGAttribute('kerning', anim=True, types=frozenset([u'length']), const=frozenset([u'auto', u'inherit'])), 'keyPoints': SVGAttribute('keyPoints', anim=True, types=frozenset([]), const=frozenset([u''])), 'keySplines': SVGAttribute('keySplines', anim=True, types=frozenset([]), const=frozenset([u''])), 'keyTimes': SVGAttribute('keyTimes', anim=True, types=frozenset([]), const=frozenset([u''])), 'lang': SVGAttribute('lang', anim=True, types=frozenset([u'LanguageCodes']), const=frozenset([])), 'lengthAdjust': SVGAttribute('lengthAdjust', anim=True, types=frozenset([]), const=frozenset([u'spacingAndGlyphs', u'spacing'])), 'letter-spacing': SVGAttribute('letter-spacing', anim=True, types=frozenset([u'length']), const=frozenset([u'inherit', u'normal'])), 'lighting-color': SVGAttribute('lighting-color', anim=True, types=frozenset([]), const=frozenset([u' icc-color( , *)', u'currentColor', u'inherit'])), 'limitingConeAngle': SVGAttribute('limitingConeAngle', anim=True, types=frozenset([u'number']), const=frozenset([])), 'local': SVGAttribute('local', anim=True, types=frozenset([u'string']), const=frozenset([])), 'marker-end': SVGAttribute('marker-end', anim=True, types=frozenset([u'uri']), const=frozenset([u'none', u'inherit'])), 'marker-mid': SVGAttribute('marker-mid', anim=True, types=frozenset([u'uri']), const=frozenset([u'none', u'inherit'])), 'marker-start': SVGAttribute('marker-start', anim=True, types=frozenset([u'uri']), const=frozenset([u'none', u'inherit'])), 'markerHeight': SVGAttribute('markerHeight', anim=True, types=frozenset([u'length']), const=frozenset([])), 'markerUnits': SVGAttribute('markerUnits', anim=True, types=frozenset([]), const=frozenset([u'userSpaceOnUse', u'strokeWidth'])), 'markerWidth': SVGAttribute('markerWidth', anim=True, types=frozenset([u'length']), const=frozenset([])), 'mask': SVGAttribute('mask', anim=True, types=frozenset([u'uri']), const=frozenset([u'none', u'inherit'])), 'maskContentUnits': SVGAttribute('maskContentUnits', anim=True, types=frozenset([]), const=frozenset([u'userSpaceOnUse', u'objectBoundingBox'])), 'maskUnits': SVGAttribute('maskUnits', anim=True, types=frozenset([]), const=frozenset([u'userSpaceOnUse', u'objectBoundingBox'])), 'mathematical': SVGAttribute('mathematical', anim=True, types=frozenset([u'number']), const=frozenset([])), 'max': SVGAttribute('max', anim=True, types=frozenset([u'Clock-value']), const=frozenset([u'media'])), 'media': SVGAttribute('media', anim=True, types=frozenset([]), const=frozenset([u'media-descriptors'])), 'method': SVGAttribute('method', anim=True, types=frozenset([]), const=frozenset([u'stretch', u'align'])), 'min': SVGAttribute('min', anim=True, types=frozenset([u'Clock-value']), const=frozenset([u'media'])), 'mode': SVGAttribute('mode', anim=True, types=frozenset([]), const=frozenset([u'multiply', u'screen', u'darken', u'lighten', u'normal'])), 'name': SVGAttribute('name', anim=True, types=frozenset([u'name']), const=frozenset([])), 'numOctaves': SVGAttribute('numOctaves', anim=True, types=frozenset([u'integer']), const=frozenset([])), 'offset': SVGAttribute('offset', anim=True, types=frozenset([u'percentage']), const=frozenset([u''])), 'onabort': SVGAttribute('onabort', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onactivate': SVGAttribute('onactivate', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onbegin': SVGAttribute('onbegin', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onclick': SVGAttribute('onclick', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onend': SVGAttribute('onend', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onerror': SVGAttribute('onerror', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onfocusin': SVGAttribute('onfocusin', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onfocusout': SVGAttribute('onfocusout', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onload': SVGAttribute('onload', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onmousedown': SVGAttribute('onmousedown', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onmousemove': SVGAttribute('onmousemove', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onmouseout': SVGAttribute('onmouseout', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onmouseover': SVGAttribute('onmouseover', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onmouseup': SVGAttribute('onmouseup', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onrepeat': SVGAttribute('onrepeat', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onresize': SVGAttribute('onresize', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onscroll': SVGAttribute('onscroll', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onunload': SVGAttribute('onunload', anim=True, types=frozenset([u'script']), const=frozenset([])), 'onzoom': SVGAttribute('onzoom', anim=True, types=frozenset([u'script']), const=frozenset([])), 'opacity': SVGAttribute('opacity', anim=True, types=frozenset([u'opacity-value']), const=frozenset([u'inherit'])), 'operator': SVGAttribute('operator', anim=True, types=frozenset([]), const=frozenset([u'xor', u'in', u'over', u'atop', u'arithmetic', u'out'])), 'order': SVGAttribute('order', anim=True, types=frozenset([u'number-optional-number']), const=frozenset([])), 'orient': SVGAttribute('orient', anim=True, types=frozenset([u'angle']), const=frozenset([u'auto'])), 'orientation': SVGAttribute('orientation', anim=True, types=frozenset([]), const=frozenset([u'h', u'v'])), 'origin': SVGAttribute('origin', anim=True, types=frozenset([]), const=frozenset([u'default'])), 'overflow': SVGAttribute('overflow', anim=True, types=frozenset([]), const=frozenset([u'visible', u'hidden', u'scroll', u'inherit', u'auto'])), 'overline-position': SVGAttribute('overline-position', anim=True, types=frozenset([u'number']), const=frozenset([])), 'overline-thickness': SVGAttribute('overline-thickness', anim=True, types=frozenset([u'number']), const=frozenset([])), 'panose-1': SVGAttribute('panose-1', anim=True, types=frozenset([]), const=frozenset([u' {10}'])), 'path': SVGAttribute('path', anim=True, types=frozenset([u'path-data']), const=frozenset([])), 'pathLength': SVGAttribute('pathLength', anim=True, types=frozenset([u'number']), const=frozenset([])), 'patternContentUnits': SVGAttribute('patternContentUnits', anim=True, types=frozenset([]), const=frozenset([u'userSpaceOnUse', u'objectBoundingBox'])), 'patternTransform': SVGAttribute('patternTransform', anim=True, types=frozenset([u'transform-list']), const=frozenset([])), 'patternUnits': SVGAttribute('patternUnits', anim=True, types=frozenset([]), const=frozenset([u'userSpaceOnUse', u'objectBoundingBox'])), 'pointer-events': SVGAttribute('pointer-events', anim=True, types=frozenset([]), const=frozenset([u'all', u'visibleStroke', u'painted', u'none', u'visibleFill', u'visible', u'stroke', u'inherit', u'visiblePainted', u'fill'])), 'points': SVGAttribute('points', anim=True, types=frozenset([]), const=frozenset([u''])), 'pointsAtX': SVGAttribute('pointsAtX', anim=True, types=frozenset([u'number']), const=frozenset([])), 'pointsAtY': SVGAttribute('pointsAtY', anim=True, types=frozenset([u'number']), const=frozenset([])), 'pointsAtZ': SVGAttribute('pointsAtZ', anim=True, types=frozenset([u'number']), const=frozenset([])), 'preserveAlpha': SVGAttribute('preserveAlpha', anim=True, types=frozenset([]), const=frozenset([u'true', u'false'])), 'preserveAspectRatio': SVGAttribute('preserveAspectRatio', anim=True, types=frozenset([]), const=frozenset([u'defer '])), 'primitiveUnits': SVGAttribute('primitiveUnits', anim=True, types=frozenset([]), const=frozenset([u'userSpaceOnUse', u'objectBoundingBox'])), 'r': SVGAttribute('r', anim=True, types=frozenset([]), const=frozenset([u''])), 'radius': SVGAttribute('radius', anim=True, types=frozenset([u'number-optional-number']), const=frozenset([])), 'refX': SVGAttribute('refX', anim=True, types=frozenset([u'coordinate']), const=frozenset([])), 'refY': SVGAttribute('refY', anim=True, types=frozenset([u'coordinate']), const=frozenset([])), 'rendering-intent': SVGAttribute('rendering-intent', anim=True, types=frozenset([]), const=frozenset([u'auto', u'saturation', u'perceptual', u'relative-colorimetric', u'absolute-colorimetric'])), 'repeatCount': SVGAttribute('repeatCount', anim=True, types=frozenset([]), const=frozenset([u'indefinite', u''])), 'repeatDur': SVGAttribute('repeatDur', anim=True, types=frozenset([u'Clock-value']), const=frozenset([u'indefinite'])), 'requiredExtensions': SVGAttribute('requiredExtensions', anim=True, types=frozenset([]), const=frozenset([u''])), 'requiredFeatures': SVGAttribute('requiredFeatures', anim=True, types=frozenset([]), const=frozenset([u''])), 'restart': SVGAttribute('restart', anim=True, types=frozenset([]), const=frozenset([u'always', u'never', u'whenNotActive'])), 'result': SVGAttribute('result', anim=True, types=frozenset([u'filter-primitive-reference']), const=frozenset([])), 'rotate': SVGAttribute('rotate', anim=True, types=frozenset([u'angle']), const=frozenset([u'auto', u'auto-reverse+++'])), 'rx': SVGAttribute('rx', anim=True, types=frozenset([]), const=frozenset([u''])), 'ry': SVGAttribute('ry', anim=True, types=frozenset([]), const=frozenset([u''])), 'scale': SVGAttribute('scale', anim=True, types=frozenset([u'number']), const=frozenset([])), 'seed': SVGAttribute('seed', anim=True, types=frozenset([u'number']), const=frozenset([])), 'shape-rendering': SVGAttribute('shape-rendering', anim=True, types=frozenset([]), const=frozenset([u'auto', u'optimizeSpeed', u'inherit', u'geometricPrecision', u'crispEdges'])), 'slope': SVGAttribute('slope', anim=True, types=frozenset([]), const=frozenset([u''])), 'spacing': SVGAttribute('spacing', anim=True, types=frozenset([]), const=frozenset([u'auto', u'exact'])), 'specularConstant': SVGAttribute('specularConstant', anim=True, types=frozenset([u'number']), const=frozenset([])), 'specularExponent': SVGAttribute('specularExponent', anim=True, types=frozenset([]), const=frozenset([u''])), 'spreadMethod': SVGAttribute('spreadMethod', anim=True, types=frozenset([]), const=frozenset([u'reflect', u'repeat', u'pad'])), 'startOffset': SVGAttribute('startOffset', anim=True, types=frozenset([u'length']), const=frozenset([])), 'stdDeviation': SVGAttribute('stdDeviation', anim=True, types=frozenset([u'number-optional-number']), const=frozenset([])), 'stemh': SVGAttribute('stemh', anim=True, types=frozenset([u'number']), const=frozenset([])), 'stemv': SVGAttribute('stemv', anim=True, types=frozenset([u'number']), const=frozenset([])), 'stitchTiles': SVGAttribute('stitchTiles', anim=True, types=frozenset([]), const=frozenset([u'noStitch', u'stitch'])), 'stop-color': SVGAttribute('stop-color', anim=True, types=frozenset([]), const=frozenset([u' icc-color( , *)', u'currentColor', u'inherit'])), 'stop-opacity': SVGAttribute('stop-opacity', anim=True, types=frozenset([u'opacity-value']), const=frozenset([u'inherit'])), 'strikethrough-position': SVGAttribute('strikethrough-position', anim=True, types=frozenset([u'number']), const=frozenset([])), 'strikethrough-thickness': SVGAttribute('strikethrough-thickness', anim=True, types=frozenset([u'number']), const=frozenset([])), 'string': SVGAttribute('string', anim=True, types=frozenset([]), const=frozenset([u''])), 'stroke': SVGAttribute('stroke', anim=True, types=frozenset([]), const=frozenset([u' icc-color( , *)', u'none', u'currentColor', u' none', u'inherit'])), 'stroke-dasharray': SVGAttribute('stroke-dasharray', anim=True, types=frozenset([]), const=frozenset([u'', u'none', u'inherit'])), 'stroke-dashoffset': SVGAttribute('stroke-dashoffset', anim=True, types=frozenset([u'length']), const=frozenset([u'inherit'])), 'stroke-linecap': SVGAttribute('stroke-linecap', anim=True, types=frozenset([]), const=frozenset([u'square', u'round', u'inherit', u'butt'])), 'stroke-linejoin': SVGAttribute('stroke-linejoin', anim=True, types=frozenset([]), const=frozenset([u'bevel', u'miter', u'round', u'inherit'])), 'stroke-miterlimit': SVGAttribute('stroke-miterlimit', anim=True, types=frozenset([u'miterlimit']), const=frozenset([u'inherit'])), 'stroke-opacity': SVGAttribute('stroke-opacity', anim=True, types=frozenset([u'opacity-value']), const=frozenset([u'inherit'])), 'stroke-width': SVGAttribute('stroke-width', anim=True, types=frozenset([u'length']), const=frozenset([u'inherit'])), 'style': SVGAttribute('style', anim=True, types=frozenset([]), const=frozenset([u'style'])), 'surfaceScale': SVGAttribute('surfaceScale', anim=True, types=frozenset([]), const=frozenset([u''])), 'systemLanguage': SVGAttribute('systemLanguage', anim=True, types=frozenset([u'LanguageCodes']), const=frozenset([])), 'tableValues': SVGAttribute('tableValues', anim=True, types=frozenset([]), const=frozenset([u'(list of s)'])), 'target': SVGAttribute('target', anim=True, types=frozenset([u'NMTOKEN']), const=frozenset([])), 'targetX': SVGAttribute('targetX', anim=True, types=frozenset([u'integer']), const=frozenset([])), 'targetY': SVGAttribute('targetY', anim=True, types=frozenset([u'integer']), const=frozenset([])), 'text-anchor': SVGAttribute('text-anchor', anim=True, types=frozenset([]), const=frozenset([u'start', u'end', u'inherit', u'middle'])), 'text-decoration': SVGAttribute('text-decoration', anim=True, types=frozenset([]), const=frozenset([u'', u'overline', u'none', u'underline', u'line-through', u'inherit', u'blink'])), 'text-rendering': SVGAttribute('text-rendering', anim=True, types=frozenset([]), const=frozenset([u'auto', u'optimizeSpeed', u'optimizeLegibility', u'geometricPrecision', u'inherit'])), 'textLength': SVGAttribute('textLength', anim=True, types=frozenset([]), const=frozenset([u''])), 'title': SVGAttribute('title', anim=True, types=frozenset([]), const=frozenset([u'advisory-title'])), 'to': SVGAttribute('to', anim=True, types=frozenset([u'value']), const=frozenset([])), 'transform': SVGAttribute('transform', anim=True, types=frozenset([]), const=frozenset([u'Available transformations:matrix( )translate( )scale( ),rotate( )skewX()skewY()'])), 'type': SVGAttribute('type', anim=True, types=frozenset([u'content-type']), const=frozenset([])), 'u1': SVGAttribute('u1', anim=True, types=frozenset([]), const=frozenset([u' *', u' , ', u''])), 'u2': SVGAttribute('u2', anim=True, types=frozenset([u'number']), const=frozenset([u' *', u' , '])), 'underline-position': SVGAttribute('underline-position', anim=True, types=frozenset([u'number']), const=frozenset([])), 'underline-thickness': SVGAttribute('underline-thickness', anim=True, types=frozenset([u'number']), const=frozenset([])), 'unicode': SVGAttribute('unicode', anim=True, types=frozenset([u'string']), const=frozenset([])), 'unicode-bidi': SVGAttribute('unicode-bidi', anim=True, types=frozenset([]), const=frozenset([u'embed', u'inherit', u'bidi-override', u'normal'])), 'unicode-range': SVGAttribute('unicode-range', anim=True, types=frozenset([]), const=frozenset([u' , *'])), 'units-per-em': SVGAttribute('units-per-em', anim=True, types=frozenset([u'number']), const=frozenset([])), 'v-alphabetic': SVGAttribute('v-alphabetic', anim=True, types=frozenset([u'number']), const=frozenset([])), 'v-hanging': SVGAttribute('v-hanging', anim=True, types=frozenset([u'number']), const=frozenset([])), 'v-ideographic': SVGAttribute('v-ideographic', anim=True, types=frozenset([u'number']), const=frozenset([])), 'v-mathematical': SVGAttribute('v-mathematical', anim=True, types=frozenset([u'number']), const=frozenset([])), 'values': SVGAttribute('values', anim=True, types=frozenset([]), const=frozenset([u'list of s'])), 'version': SVGAttribute('version', anim=True, types=frozenset([]), const=frozenset([u'1.1'])), 'vert-adv-y': SVGAttribute('vert-adv-y', anim=True, types=frozenset([]), const=frozenset([u''])), 'vert-origin-x': SVGAttribute('vert-origin-x', anim=True, types=frozenset([]), const=frozenset([u''])), 'vert-origin-y': SVGAttribute('vert-origin-y', anim=True, types=frozenset([]), const=frozenset([u''])), 'viewBox': SVGAttribute('viewBox', anim=True, types=frozenset([]), const=frozenset([u' , , , '])), 'viewTarget': SVGAttribute('viewTarget', anim=True, types=frozenset([]), const=frozenset([u' *'])), 'visibility': SVGAttribute('visibility', anim=True, types=frozenset([]), const=frozenset([u'visible', u'hidden', u'inherit'])), 'width': SVGAttribute('width', anim=True, types=frozenset([]), const=frozenset([u''])), 'widths': SVGAttribute('widths', anim=True, types=frozenset([u'string']), const=frozenset([])), 'word-spacing': SVGAttribute('word-spacing', anim=True, types=frozenset([u'length']), const=frozenset([u'inherit', u'normal'])), 'writing-mode': SVGAttribute('writing-mode', anim=True, types=frozenset([]), const=frozenset([u'rl-tb', u'lr', u'rl', u'tb-rl', u'lr-tb', u'inherit', u'tb'])), 'x': SVGAttribute('x', anim=True, types=frozenset([]), const=frozenset([u'+++'])), 'x-height': SVGAttribute('x-height', anim=True, types=frozenset([u'number']), const=frozenset([])), 'x1': SVGAttribute('x1', anim=True, types=frozenset([]), const=frozenset([u''])), 'x2': SVGAttribute('x2', anim=True, types=frozenset([]), const=frozenset([u''])), 'xChannelSelector': SVGAttribute('xChannelSelector', anim=True, types=frozenset([]), const=frozenset([u'A', u'B', u'R', u'G'])), 'xlink:actuate': SVGAttribute('xlink:actuate', anim=True, types=frozenset([]), const=frozenset([u'onLoad'])), 'xlink:arcrole': SVGAttribute('xlink:arcrole', anim=True, types=frozenset([]), const=frozenset([u"''''"])), 'xlink:href': SVGAttribute('xlink:href', anim=True, types=frozenset([]), const=frozenset([u''])), 'xlink:role': SVGAttribute('xlink:role', anim=True, types=frozenset([]), const=frozenset([u"''''"])), 'xlink:show': SVGAttribute('xlink:show', anim=True, types=frozenset([]), const=frozenset([u'other'])), 'xlink:title': SVGAttribute('xlink:title', anim=True, types=frozenset([]), const=frozenset([u"''''"])), 'xlink:type': SVGAttribute('xlink:type', anim=True, types=frozenset([]), const=frozenset([u'simple'])), 'xml:base': SVGAttribute('xml:base', anim=True, types=frozenset([u'uri']), const=frozenset([])), 'xml:lang': SVGAttribute('xml:lang', anim=True, types=frozenset([u'NMTOKEN']), const=frozenset([])), 'xml:space': SVGAttribute('xml:space', anim=True, types=frozenset([]), const=frozenset([u'default', u'preserve'])), 'y': SVGAttribute('y', anim=True, types=frozenset([]), const=frozenset([u'+++'])), 'y1': SVGAttribute('y1', anim=True, types=frozenset([]), const=frozenset([u''])), 'y2': SVGAttribute('y2', anim=True, types=frozenset([]), const=frozenset([u''])), 'yChannelSelector': SVGAttribute('yChannelSelector', anim=True, types=frozenset([]), const=frozenset([u'A', u'B', u'R', u'G'])), 'z': SVGAttribute('z', anim=True, types=frozenset([]), const=frozenset([u''])), 'zoomAndPan': SVGAttribute('zoomAndPan', anim=True, types=frozenset([]), const=frozenset([u'disable', u'magnify'])), } svgwrite-1.4.1/makedata/full11elements.py000066400000000000000000001077201400026116000203460ustar00rootroot00000000000000#coding:utf-8 # generated by: D:\User\Python\svgwrite\makedata\makefull11data.py from svgwrite.types import SVGElement presentation_attributes = frozenset([ "alignment-baseline", "baseline-shift", "clip", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cursor", "direction", "display", "dominant-baseline", "enable-background", "fill", "fill-opacity", "fill-rule", "filter", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "glyph-orientation-horizontal", "glyph-orientation-vertical", "image-rendering", "kerning", "letter-spacing", "lighting-color", "marker-end", "marker-mid", "marker-start", "mask", "opacity", "overflow", "pointer-events", "shape-rendering", "stop-color", "stop-opacity", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-anchor", "text-decoration", "text-rendering", "unicode-bidi", "visibility", "word-spacing", "writing-mode"]) full11_elements = { 'a': SVGElement('a', attributes=frozenset(['xlink:title', 'xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'systemLanguage', 'onmouseover', 'xlink:type', 'externalResourcesRequired', 'id', 'xlink:actuate', 'onload', 'style', 'xlink:show', 'target', 'onactivate', 'nmousedown', 'transform', 'class', 'xlink:role', 'requiredFeatures', 'xml:lang', 'onmousemove', 'xmlns:xlink', 'onclick', 'xlink:arcrole', 'onfocusin']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'altGlyph': SVGElement('altGlyph', attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'id', 'onload', 'style', 'nmousedown', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'format', 'xlink:title', 'systemLanguage', 'onmouseover', 'dx', 'dy', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'glyphRef', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x', 'rotate']), properties=presentation_attributes, children=[]), 'altGlyphDef': SVGElement('altGlyphDef', attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id']), properties=[], children=frozenset(['*'])), 'altGlyphItem': SVGElement('altGlyphItem', attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id']), properties=[], children=frozenset(['*'])), 'animate': SVGElement('animate', attributes=frozenset(['requiredExtensions', 'from', 'repeatCount', 'xml:space', 'xlink:href', 'xlink:type', 'attributeType', 'repeatDur', 'id', 'fill', 'onload', 'additive', 'calcMode', 'min', 'keySplines', 'to', 'dur', 'xlink:arcrole', 'onend', 'begin', 'xml:base', 'max', 'xlink:title', 'attributeName', 'onbegin', 'systemLanguage', 'accumulate', 'end', 'externalResourcesRequired', 'by', 'restart', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'values', 'keyTimes', 'onrepeat']), properties=[], children=frozenset(['desc', 'metadata', 'title'])), 'animateColor': SVGElement('animateColor', attributes=frozenset(['requiredExtensions', 'from', 'repeatCount', 'xml:space', 'xlink:href', 'xlink:type', 'attributeType', 'repeatDur', 'id', 'fill', 'onload', 'additive', 'calcMode', 'min', 'keySplines', 'to', 'dur', 'xlink:arcrole', 'onend', 'begin', 'xml:base', 'max', 'xlink:title', 'attributeName', 'onbegin', 'systemLanguage', 'accumulate', 'end', 'externalResourcesRequired', 'by', 'restart', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'values', 'keyTimes', 'onrepeat']), properties=[], children=frozenset(['desc', 'metadata', 'title'])), 'animateMotion': SVGElement('animateMotion', attributes=frozenset(['origin', 'requiredExtensions', 'from', 'repeatCount', 'xml:space', 'xlink:href', 'xlink:type', 'repeatDur', 'id', 'fill', 'onload', 'additive', 'calcMode', 'min', 'keySplines', 'to', 'dur', 'xlink:arcrole', 'onend', 'begin', 'xlink:title', 'xml:base', 'max', 'end', 'keyPoints', 'onbegin', 'systemLanguage', 'accumulate', 'path', 'externalResourcesRequired', 'by', 'restart', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'values', 'keyTimes', 'onrepeat', 'rotate']), properties=[], children=frozenset(['desc', 'metadata', 'mpath', 'title'])), 'animateTransform': SVGElement('animateTransform', attributes=frozenset(['requiredExtensions', 'from', 'repeatCount', 'xml:space', 'xlink:href', 'xlink:type', 'attributeType', 'repeatDur', 'id', 'fill', 'onload', 'additive', 'calcMode', 'min', 'keySplines', 'to', 'dur', 'xlink:arcrole', 'type', 'onend', 'begin', 'xml:base', 'max', 'xlink:title', 'attributeName', 'onbegin', 'systemLanguage', 'accumulate', 'end', 'externalResourcesRequired', 'by', 'restart', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'values', 'keyTimes', 'onrepeat']), properties=[], children=frozenset(['desc', 'metadata', 'title'])), 'circle': SVGElement('circle', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'cy', 'cx', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'nmousedown', 'transform', 'class', 'requiredFeatures', 'r', 'onmousemove', 'onclick', 'xml:lang', 'onfocusin', 'systemLanguage']), properties=presentation_attributes, children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'metadata', 'desc'])), 'clipPath': SVGElement('clipPath', attributes=frozenset(['clipPathUnits', 'style', 'xml:base', 'requiredExtensions', 'xml:space', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'externalResourcesRequired', 'class', 'systemLanguage']), properties=presentation_attributes, children=frozenset(['set', 'animate', 'text', 'use', 'animateColor', 'polyline', 'path', 'line', 'ellipse', 'rect', 'desc', 'animateMotion', 'polygon', 'title', 'animateTransform', 'circle', 'metadata'])), 'color-profile': SVGElement('color-profile', attributes=frozenset(['xlink:actuate', 'xlink:show', 'xml:base', 'name', 'rendering-intent', 'xml:space', 'xlink:href', 'xlink:role', 'xml:lang', 'xlink:type', 'xlink:title', 'xlink:arcrole', 'local', 'id']), properties=[], children=frozenset(['desc', 'metadata', 'title'])), 'cursor': SVGElement('cursor', attributes=frozenset(['xlink:title', 'xml:base', 'requiredExtensions', 'xml:space', 'xlink:href', 'systemLanguage', 'xlink:type', 'externalResourcesRequired', 'id', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x', 'xlink:arcrole']), properties=[], children=frozenset(['desc', 'metadata', 'title'])), 'defs': SVGElement('defs', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'class', 'onload', 'style', 'onactivate', 'nmousedown', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'desc': SVGElement('desc', attributes=frozenset(['style', 'xml:lang', 'xml:base', 'xml:space', 'class', 'id']), properties=[], children=frozenset(['*'])), 'ellipse': SVGElement('ellipse', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'ry', 'cy', 'cx', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'nmousedown', 'rx', 'transform', 'class', 'requiredFeatures', 'systemLanguage', 'onmousemove', 'onclick', 'xml:lang', 'onfocusin']), properties=presentation_attributes, children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])), 'feBlend': SVGElement('feBlend', attributes=frozenset(['style', 'xml:base', 'xml:space', 'in2', 'height', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'class', 'mode']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'feColorMatrix': SVGElement('feColorMatrix', attributes=frozenset(['style', 'xml:base', 'xml:space', 'id', 'height', 'width', 'xml:lang', 'values', 'result', 'in', 'y', 'x', 'type', 'class']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'feComponentTransfer': SVGElement('feComponentTransfer', attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'class']), properties=presentation_attributes, children=frozenset(['feFuncA', 'feFuncR', 'feFuncB', 'feFuncG'])), 'feComposite': SVGElement('feComposite', attributes=frozenset(['xml:base', 'xml:space', 'in2', 'height', 'result', 'in', 'operator', 'class', 'style', 'width', 'id', 'k3', 'k2', 'k1', 'xml:lang', 'k4', 'y', 'x']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'feConvolveMatrix': SVGElement('feConvolveMatrix', attributes=frozenset(['xml:base', 'xml:space', 'kernelUnitLength', 'edgeMode', 'height', 'bias', 'result', 'in', 'preserveAlpha', 'id', 'style', 'divisor', 'kernelMatrix', 'width', 'xml:lang', 'targetX', 'targetY', 'y', 'x', 'class2', 'order']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'feDiffuseLighting': SVGElement('feDiffuseLighting', attributes=frozenset(['style', 'xml:base', 'xml:space', 'diffuseConstant', 'height', 'kernelUnitLength', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'class', 'surfaceScale']), properties=presentation_attributes, children=frozenset(['fePointLight', 'feSpotLight', 'title', 'metadata', 'feDistantLight', 'desc'])), 'feDisplacementMap': SVGElement('feDisplacementMap', attributes=frozenset(['xml:base', 'xml:space', 'yChannelSelector', 'in2', 'height', 'result', 'in', 'class', 'style', 'scale', 'id', 'width', 'xml:lang', 'xChannelSelector', 'y', 'x']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'feDistantLight': SVGElement('feDistantLight', attributes=frozenset(['xml:lang', 'elevation', 'azimuth', 'xml:base', 'xml:space', 'id']), properties=[], children=frozenset(['animate', 'set'])), 'feFlood': SVGElement('feFlood', attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'y', 'x', 'class']), properties=presentation_attributes, children=frozenset(['animate', 'set', 'animateColor'])), 'feFuncA': SVGElement('feFuncA', attributes=frozenset(['slope', 'xml:base', 'tableValues', 'xml:space', 'xml:lang', 'intercept', 'amplitude', 'offset', 'type', 'id', 'exponent']), properties=[], children=frozenset(['animate', 'set'])), 'feFuncB': SVGElement('feFuncB', attributes=frozenset(['slope', 'xml:base', 'tableValues', 'xml:space', 'xml:lang', 'intercept', 'amplitude', 'offset', 'type', 'id', 'exponent']), properties=[], children=frozenset(['animate', 'set'])), 'feFuncG': SVGElement('feFuncG', attributes=frozenset(['slope', 'xml:base', 'tableValues', 'xml:space', 'xml:lang', 'intercept', 'amplitude', 'offset', 'type', 'id', 'exponent']), properties=[], children=frozenset(['animate', 'set'])), 'feFuncR': SVGElement('feFuncR', attributes=frozenset(['slope', 'xml:base', 'tableValues', 'xml:space', 'xml:lang', 'intercept', 'amplitude', 'offset', 'type', 'id', 'exponent']), properties=[], children=frozenset(['animate', 'set'])), 'feGaussianBlur': SVGElement('feGaussianBlur', attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'stdDeviation', 'class']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'feImage': SVGElement('feImage', attributes=frozenset(['xlink:title', 'xml:base', 'xml:space', 'xlink:href', 'height', 'result', 'xlink:type', 'externalResourcesRequired', 'preserveAsectRatio', 'class', 'xlink:actuate', 'style', 'xlink:show', 'id', 'xlink:role', 'width', 'xml:lang', 'y', 'x', 'xlink:arcrole']), properties=presentation_attributes, children=frozenset(['animate', 'set', 'animateColor'])), 'feMerge': SVGElement('feMerge', attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'y', 'x', 'class']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'feMergeNode': SVGElement('feMergeNode', attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id', 'in']), properties=[], children=frozenset(['animate', 'set'])), 'feMorphology': SVGElement('feMorphology', attributes=frozenset(['style', 'xml:base', 'y', 'xml:space', 'id', 'height', 'width', 'xml:lang', 'radius', 'result', 'in', 'operator', 'x', 'class']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'feOffset': SVGElement('feOffset', attributes=frozenset(['style', 'xml:base', 'xml:space', 'in', 'height', 'width', 'xml:lang', 'id', 'result', 'dx', 'dy', 'y', 'x', 'class']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'fePointLight': SVGElement('fePointLight', attributes=frozenset(['xml:lang', 'xml:base', 'y', 'x', 'xml:space', 'z', 'id']), properties=[], children=frozenset(['animate', 'set'])), 'feSpecularLighting': SVGElement('feSpecularLighting', attributes=frozenset(['specularConstant', 'xml:base', 'xml:space', 'kernelUnitLength', 'height', 'result', 'in', 'class', 'style', 'id', 'width', 'xml:lang', 'specularExponent', 'y', 'x', 'surfaceScale']), properties=presentation_attributes, children=frozenset(['fePointLight', 'feSpotLight', 'title', 'metadata', 'feDistantLight', 'desc'])), 'feSpotLight': SVGElement('feSpotLight', attributes=frozenset(['pointsAtX', 'xml:base', 'xml:space', 'limitingConeAngle', 'xml:lang', 'specularExponent', 'pointsAtZ', 'y', 'x', 'pointsAtY', 'z', 'id']), properties=[], children=frozenset(['animate', 'set'])), 'feTile': SVGElement('feTile', attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'class']), properties=presentation_attributes, children=frozenset(['animate', 'set'])), 'feTurbulence': SVGElement('feTurbulence', attributes=frozenset(['xml:base', 'baseFrequency', 'xml:space', 'stitchTiles', 'height', 'width', 'xml:lang', 'id', 'result', 'x', 'y', 'numOctaves', 'type', 'seed']), properties=presentation_attributes, children=[]), 'filter': SVGElement('filter', attributes=frozenset(['xlink:title', 'xml:base', 'xml:space', 'xlink:href', 'height', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'style', 'xlink:show', 'filterRes', 'primitiveUnits', 'id', 'xlink:role', 'width', 'xml:lang', 'y', 'x', 'xlink:arcrole', 'filterUnits']), properties=presentation_attributes, children=frozenset(['set', 'title', 'height', 'width', 'result', 'y', 'x', 'animate', 'metadata', 'desc'])), 'font': SVGElement('font', attributes=frozenset(['xml:base', 'xml:space', 'R', 'id', 'a', 'c', 'e', 'd', 'g', 'i', 'h', '-', 'l', 'o', 'n', 'q', 's', 'r', 'u', 't', 'v', 'y', 'x', 'z', 'xml:lang']), properties=presentation_attributes, children=frozenset(['title', 'metadata', 'missing-glyph', 'font-face', 'vkern', 'hkern', 'glyph', 'desc'])), 'font-face': SVGElement('font-face', attributes=frozenset(['mathematical', 'slope', 'font-size', 'xml:space', 'v-hanging', 'hanging', 'overline-thickness', 'ascent', 'id', 'strikethrough-position', 'underline-position', 'descent', 'cap-height', 'units-per-em', 'font-style', 'unicode-range', 'font-stretch', 'font-variant', 'x-height', 'font-weight', 'xml:base', 'panose-1', 'strikethrough-thickness', 'stemh', 'v-alphabetic', 'stemv', 'bbox', 'underline-thickness', 'font-family', 'v-mathematical', 'v-ideographic', 'ideographic', 'overline-position', 'widths', 'xml:lang', 'accent-height', 'alphabetic']), properties=[], children=frozenset(['desc', 'metadata', 'font-face-src', 'title'])), 'font-face-format': SVGElement('font-face-format', attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id']), properties=[], children=frozenset([])), 'font-face-name': SVGElement('font-face-name', attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id', 'name']), properties=[], children=frozenset([])), 'font-face-uri': SVGElement('font-face-uri', attributes=frozenset(['xlink:actuate', 'xlink:show', 'xml:base', 'xml:space', 'xlink:href', 'xlink:role', 'xml:lang', 'xlink:type', 'xlink:title', 'xlink:arcrole', 'id']), properties=[], children=frozenset(['font-face-format'])), 'foreignObject': SVGElement('foreignObject', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'height', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'nmousedown', 'transform', 'class', 'width', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'y', 'x', 'onfocusin']), properties=presentation_attributes, children=frozenset(['*'])), 'g': SVGElement('g', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'class', 'onload', 'style', 'onactivate', 'nmousedown', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'glyph': SVGElement('glyph', attributes=frozenset(['xml:base', 'm', 'xml:space', 'id', 'a', 'c', 'b', 'e', 'd', 'g', 'f', 'i', 'h', '-', 'l', 'o', 'n', 'p', 's', 'r', 'u', 't', 'v', 'y', 'x', 'z', 'xml:lang']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'glyphRef': SVGElement('glyphRef', attributes=frozenset(['xlink:title', 'xml:base', 'format', 'xml:space', 'xlink:href', 'dx', 'dy', 'xlink:type', 'class', 'xlink:actuate', 'style', 'xlink:show', 'id', 'xlink:role', 'xml:lang', 'y', 'x', 'xlink:arcrole', 'glyphRef']), properties=presentation_attributes, children=frozenset([])), 'hkern': SVGElement('hkern', attributes=frozenset(['xml:base', 'g2', 'g1', 'xml:space', 'u1', 'u2', 'xml:lang', 'id', 'k']), properties=[], children=frozenset([])), 'image': SVGElement('image', attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'height', 'id', 'onload', 'style', 'nmousedown', 'transform', 'width', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'xlink:title', 'systemLanguage', 'onmouseover', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x', 'preserveAspectRatio']), properties=presentation_attributes, children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])), 'line': SVGElement('line', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'x2', 'systemLanguage', 'onmouseover', 'y1', 'externalResourcesRequired', 'y2', 'id', 'onload', 'style', 'x1', 'onactivate', 'nmousedown', 'transform', 'class', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']), properties=presentation_attributes, children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])), 'linearGradient': SVGElement('linearGradient', attributes=frozenset(['xlink:title', 'xml:base', 'xml:space', 'xlink:href', 'x2', 'y1', 'externalResourcesRequired', 'y2', 'class', 'xlink:actuate', 'xlink:role', 'style', 'xlink:show', 'spreadMethod', 'id', 'gradientUnits', 'xml:lang', 'gradientTransform', 'xlink:type', 'xlink:arcrole', 'x1']), properties=presentation_attributes, children=frozenset(['set', 'title', 'animate', 'animateTransform', 'stop', 'metadata', 'desc'])), 'marker': SVGElement('marker', attributes=frozenset(['xml:space', 'id', 'xml:lang', 'A', 'B', 'xml:base', 'H', 'R', 'U', 'W', 'Y', 'X', 'a', 'c', 'e', 'd', 'g', 'f', 'i', 'h', 'k', 'm', 'l', 'o', 'n', 'q', 'p', 's', 'r', 'u', 't', 'w', 'v', 'y', 'x']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'mask': SVGElement('mask', attributes=frozenset(['xml:base', 'requiredExtensions', 'xml:space', 'height', 'systemLanguage', 'externalResourcesRequired', 'maskContentUnits', 'class', 'style', 'id', 'width', 'requiredFeatures', 'xml:lang', 'y', 'x', 'maskUnits']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'metadata': SVGElement('metadata', attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id']), properties=[], children=frozenset(['*'])), 'missing-glyph': SVGElement('missing-glyph', attributes=frozenset(['xml:base', 'xml:space', 'id', 'a', 'c', 'e', 'd', 'g', 'i', 'h', '-', 'l', 'o', 'n', 's', 'r', 't', 'v', 'y', 'x', 'z', 'xml:lang']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'mpath': SVGElement('mpath', attributes=frozenset(['xlink:actuate', 'xlink:show', 'xml:base', 'xml:space', 'xlink:href', 'id', 'xlink:role', 'xml:lang', 'xlink:type', 'xlink:title', 'xlink:arcrole', 'externalResourcesRequired']), properties=[], children=frozenset(['desc', 'metadata', 'title'])), 'path': SVGElement('path', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'pathLength', 'externalResourcesRequired', 'id', 'onload', 'style', 'd', 'onactivate', 'nmousedown', 'transform', 'class', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']), properties=presentation_attributes, children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])), 'pattern': SVGElement('pattern', attributes=frozenset(['xlink:title', 'xml:base', 'requiredExtensions', 'xml:space', 'xlink:href', 'height', 'class', 'systemLanguage', 'patternContentUnits', 'xlink:type', 'externalResourcesRequired', 'id', 'xlink:actuate', 'style', 'xlink:show', 'viewBox', 'xlink:role', 'width', 'requiredFeatures', 'patternUnits', 'patternTransform', 'y', 'x', 'preserveAspectRatio', 'xlink:arcrole', 'xml:lang']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'polygon': SVGElement('polygon', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'nmousedown', 'transform', 'class', 'requiredFeatures', 'points', 'onmousemove', 'onclick', 'xml:lang', 'onfocusin']), properties=presentation_attributes, children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])), 'polyline': SVGElement('polyline', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'nmousedown', 'transform', 'class', 'requiredFeatures', 'points', 'onmousemove', 'onclick', 'xml:lang', 'onfocusin']), properties=presentation_attributes, children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])), 'radialGradient': SVGElement('radialGradient', attributes=frozenset(['xlink:title', 'xml:base', 'fx', 'fy', 'xml:space', 'xlink:href', 'cy', 'cx', 'xlink:type', 'externalResourcesRequired', 'r', 'id', 'xlink:actuate', 'gradientUnits', 'style', 'xlink:show', 'spreadMethod', 'class', 'xlink:role', 'xml:lang', 'gradientTransform', 'xlink:arcrole']), properties=presentation_attributes, children=frozenset(['set', 'title', 'animate', 'animateTransform', 'stop', 'metadata', 'desc'])), 'rect': SVGElement('rect', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'height', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'ry', 'onactivate', 'nmousedown', 'rx', 'transform', 'class', 'width', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'y', 'x', 'onfocusin']), properties=presentation_attributes, children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'metadata', 'desc'])), 'script': SVGElement('script', attributes=frozenset(['xlink:actuate', 'xlink:show', 'xml:base', 'xml:space', 'xlink:href', 'id', 'xlink:role', 'xml:lang', 'xlink:type', 'xlink:title', 'xlink:arcrole', 'type', 'externalResourcesRequired']), properties=[], children=[]), 'set': SVGElement('set', attributes=frozenset(['begin', 'xlink:title', 'xml:base', 'requiredExtensions', 'repeatCount', 'xml:space', 'xlink:href', 'attributeName', 'onbegin', 'systemLanguage', 'attributeType', 'xlink:type', 'externalResourcesRequired', 'id', 'restart', 'fill', 'xlink:actuate', 'onload', 'xlink:show', 'end', 'min', 'repeatDur', 'xlink:role', 'to', 'requiredFeatures', 'xml:lang', 'max', 'dur', 'xlink:arcrole', 'onrepeat', 'onend']), properties=[], children=frozenset(['desc', 'metadata', 'title'])), 'stop': SVGElement('stop', attributes=frozenset(['a', 'c', 'xml:base', 'f', 'xml:space', 'l', 'o', 's', 'xml:lang', 't', 'y', 'e', 'id']), properties=presentation_attributes, children=frozenset(['animate', 'set', 'animateColor'])), 'style': SVGElement('style', attributes=frozenset(['xml:lang', 'xml:base', 'title', 'media', 'xml:space', 'type', 'id']), properties=[], children=frozenset(['*'])), 'svg': SVGElement('svg', attributes=frozenset(['requiredExtensions', 'onerror', 'onfocusout', 'xml:space', 'height', 'onscroll', 'baseProfile', 'contentStyleType', 'id', 'onabort', 'onload', 'style', 'nmousedown', 'onzoom', 'onresize', 'width', 'version', 'onmousemove', 'onmouseup', 'xmlns:xlink', 'onfocusin', 'xml:base', 'onclick', 'onmouseout', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'zoomAndPan', 'class', 'onunload', 'xmlns', 'onactivate', 'viewBox', 'requiredFeatures', 'xml:lang', 'y', 'x', 'preserveAspectRatio', 'contentScriptType']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'switch': SVGElement('switch', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'class', 'onload', 'style', 'onactivate', 'nmousedown', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'line', 'use', 'animateColor', 'polyline', 'path', 'animate', 'ellipse', 'rect', 'desc', 'a', 'animateMotion', 'polygon', 'g', 'title', 'svg', 'switch', 'animateTransform', 'foreignObject', 'circle', 'metadata'])), 'symbol': SVGElement('symbol', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'onfocusout', 'xml:space', 'onmouseover', 'id', 'externalResourcesRequired', 'viewBox', 'onload', 'style', 'onactivate', 'nmousedown', 'class', 'xml:lang', 'onmousemove', 'onclick', 'preserveAspectRatio', 'onfocusin']), properties=presentation_attributes, children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])), 'text': SVGElement('text', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'class', 'systemLanguage', 'onmouseover', 'dx', 'dy', 'externalResourcesRequired', 'lengthAdjust', 'onload', 'style', 'rotate', 'onactivate', 'nmousedown', 'textLength', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'y', 'x', 'onfocusin']), properties=presentation_attributes, children=frozenset(['a', 'animateMotion', 'set', 'title', 'textPath', 'tspan', 'animateColor', 'tref', 'animateTransform', 'altGlyph', 'animate', 'desc', 'metadata'])), 'textPath': SVGElement('textPath', attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'startOffset', 'id', 'onload', 'style', 'nmousedown', 'lengthAdjust', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'xlink:title', 'spacing', 'systemLanguage', 'onmouseover', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'textLength', 'method', 'xlink:role', 'requiredFeatures', 'xml:lang']), properties=presentation_attributes, children=frozenset(['a', 'set', 'title', 'tspan', 'animateColor', 'tref', 'altGlyph', 'animate', 'metadata', 'desc'])), 'title': SVGElement('title', attributes=frozenset(['style', 'xml:lang', 'xml:base', 'xml:space', 'class', 'id']), properties=[], children=frozenset(['*'])), 'tref': SVGElement('tref', attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'id', 'onload', 'style', 'nmousedown', 'lengthAdjust', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'xlink:title', 'systemLanguage', 'onmouseover', 'dx', 'dy', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'textLength', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x', 'rotate']), properties=presentation_attributes, children=frozenset(['set', 'title', 'animate', 'metadata', 'animateColor', 'desc'])), 'tspan': SVGElement('tspan', attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'class', 'systemLanguage', 'onmouseover', 'dx', 'dy', 'externalResourcesRequired', 'lengthAdjust', 'onload', 'style', 'rotate', 'onactivate', 'nmousedown', 'textLength', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'y', 'x', 'onfocusin']), properties=presentation_attributes, children=frozenset(['a', 'set', 'title', 'tspan', 'animateColor', 'tref', 'altGlyph', 'animate', 'metadata', 'desc'])), 'use': SVGElement('use', attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'height', 'id', 'onload', 'style', 'nmousedown', 'transform', 'width', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'xlink:title', 'systemLanguage', 'onmouseover', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x']), properties=presentation_attributes, children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])), 'view': SVGElement('view', attributes=frozenset(['xml:base', 'viewTarget', 'xml:space', 'viewBox', 'xml:lang', 'preserveAspectRatio', 'externalResourcesRequired', 'zoomAndPan', 'id']), properties=[], children=frozenset(['desc', 'metadata', 'title'])), 'vkern': SVGElement('vkern', attributes=frozenset(['xml:base', 'g2', 'g1', 'xml:space', 'u1', 'u2', 'xml:lang', 'id', 'k']), properties=[], children=frozenset([])), } svgwrite-1.4.1/makedata/makefull11data.py000066400000000000000000000157531400026116000203050ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: create tiny data # Created: 02.10.2010 # Copyright (C) 2010, Manfred Moitzi # License: GPLv3 import sys import urllib2 import urlparse import cache from BeautifulSoup import BeautifulSoup from itertools import chain # cache W3C html pages - they do not change often ;-) urlopener = urllib2.build_opener(cache.CacheHandler(".cache")) W3CURL = "http://www.w3.org/TR/SVG11/" ZVONURL = "http://www.zvon.org/xxl/svgReference/Output/" ZVON_ATTRS = "http://www.zvon.org/xxl/svgReference/Output/attrs.html" ELEMENT_INDEX = "http://www.w3.org/TR/SVG11/eltindex.html" ELEMENTS_WITH_PROPERTIES = ['a', 'altGlyph', 'circle', 'clipPath', 'defs', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feFlood', 'feGaussianBlur', 'feImage', 'feMerge', 'feMorphology', 'feOffset', 'feSpecularLighting', 'feTile', 'feTurbulence', 'filter', 'font', 'foreignObject', 'g', 'glyph', 'glyphRef', 'image', 'line', 'linearGradient', 'marker', 'mask', 'missing-glyph', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'switch', 'symbol', 'text', 'textPath', 'tref', 'tspan', 'use'] PREFACE_ELEMENTS = """#coding:utf-8 # generated by: %s from svgwrite.types import SVGElement presentation_attributes = frozenset([ "alignment-baseline", "baseline-shift", "clip", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cursor", "direction", "display", "dominant-baseline", "enable-background", "fill", "fill-opacity", "fill-rule", "filter", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "glyph-orientation-horizontal", "glyph-orientation-vertical", "image-rendering", "kerning", "letter-spacing", "lighting-color", "marker-end", "marker-mid", "marker-start", "mask", "opacity", "overflow", "pointer-events", "shape-rendering", "stop-color", "stop-opacity", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-anchor", "text-decoration", "text-rendering", "unicode-bidi", "visibility", "word-spacing", "writing-mode"]) """ % __file__ PREFACE_ATTRIBUTES = """#coding:utf-8 # generated by: %s from svgwrite.types import SVGAttribute """ % __file__ class SVGElement(object): def __init__(self, name, attribute_names, possible_children): self.name = name self.attribute_names = attribute_names self.possible_children = possible_children def __str__(self): return self.name def tostring(self): if self.name in ELEMENTS_WITH_PROPERTIES: properties = 'presentation_attributes' else: properties = '[]' return "SVGElement('%s',\n attributes=%s,\n properties=%s,\n children=%s)" % ( self.name, self.attribute_names, properties, self.possible_children) class SVGProp(object): valid_types = frozenset(['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '') if __name__=='__main__': unittest.main() svgwrite-1.4.1/tests/test_shapes_extension.py000066400000000000000000000036101400026116000215070ustar00rootroot00000000000000# Copyright (c) 2019 Manfred Moitzi # Copyright (c) 2019 Christof Hanke # License: MIT License import math from svgwrite.extensions.shapes import ngon, translate, scale, rotate, centroid def are_close_points(p1, p2, abs_tol=1e-9): return math.isclose(p1[0], p2[0], abs_tol=abs_tol) and math.isclose(p1[1], p2[1], abs_tol=abs_tol) def test_square_by_radius(): corners = list(ngon(4, radius=1)) assert len(corners) == 4 assert are_close_points(corners[0], (1, 0)) assert are_close_points(corners[1], (0, 1)) assert are_close_points(corners[2], (-1, 0)) assert are_close_points(corners[3], (0, -1)) def test_heptagon_by_edge_length(): corners = list(ngon(7, edge_length=10)) assert len(corners) == 7 assert are_close_points(corners[0], (11.523824354812433, 0.0)) assert are_close_points(corners[1], (7.184986963636852, 9.009688679024192)) assert are_close_points(corners[2], (-2.564292158181384, 11.234898018587335)) assert are_close_points(corners[3], (-10.382606982861683, 5.0)) assert are_close_points(corners[4], (-10.382606982861683, -5)) assert are_close_points(corners[5], (-2.564292158181387, -11.234898018587335)) assert are_close_points(corners[6], (7.18498696363685, -9.009688679024192)) def test_rotate(): points = [(1, 0), (0, 1)] result = list(rotate(points, math.pi / 2)) assert are_close_points(result[0], (0, 1)) assert are_close_points(result[1], (-1, 0)) def test_scale(): points = [(1, 0), (0, 1)] result = list(scale(points, 2, 3)) assert are_close_points(result[0], (2, 0)) assert are_close_points(result[1], (0, 3)) def test_translate(): points = [(1, 0), (0, 1)] result = list(translate(points, 2, 3)) assert are_close_points(result[0], (3, 3)) assert are_close_points(result[1], (2, 4)) def test_centroid(): assert are_close_points(centroid(ngon(7, edge_length=10)), (0, 0)) svgwrite-1.4.1/tests/test_solid_color.py000066400000000000000000000020721400026116000204410ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test solidcolor module # Created: 26.10.2016 # Copyright (C) 2016, Manfred Moitzi # License: MIT License import unittest from svgwrite.solidcolor import SolidColor class TestPattern(unittest.TestCase): def test_constructor(self): color = SolidColor(debug=True, profile='tiny') self.assertEqual( color.tostring(), '') def test_parameters(self): color = SolidColor(color='red', opacity=0.5, debug=True, profile='tiny') self.assertEqual( color.tostring(), '') def test_valid_profile(self): with self.assertRaises(TypeError): SolidColor(profile='full') def test_get_paint_server(self): color = SolidColor(id="mysolidcolor", debug=True, profile='tiny') self.assertEqual(color.get_paint_server(), "url(#mysolidcolor) none") if __name__ == '__main__': unittest.main() svgwrite-1.4.1/tests/test_style.py000066400000000000000000000051461400026116000172760ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test style element # Created: 27.05.2012 # Copyright (C) 2012, Manfred Moitzi # License: MIT License import unittest from svgwrite.container import Style, find_first_url from svgwrite.drawing import Drawing TEST_URL_1 = """/* latin */ @font-face { font-family: 'Indie Flower'; font-style: normal; font-weight: 400; src: local('Indie Flower'), local('IndieFlower'), url(https://fonts.gstatic.com/s/indieflower/v9/m8JVjfNVeKWVnh3QMuKkFcZVaUuH.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }""" TEST_URL_2 = """/* latin */ @font-face { font-family: 'Indie Flower'; font-style: normal; font-weight: 400; src: local('Indie Flower'), local('IndieFlower'), url(https://fonts.gstatic.com/s/indieflower/v9/m8JVjfNVeKWVnh3QMuKkFcZVaUuH.woff2) format('woff2'); url(https://fonts.gstatic.com/s/indieflower/v9/m8JVjfNVeKWVnh3QMuKkFcZVaUuH.woff) format('woff'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }""" class TestScript(unittest.TestCase): def test_content(self): style = Style(content='.red {fill: red};') result = style.tostring() self.assertEqual(result, '') def test_embed_stylesheet(self): dwg = Drawing() dwg.embed_stylesheet(content='.red {fill: red};') # stylesheet stored as ') def test_find_first_url_1(self): result = find_first_url(TEST_URL_1) self.assertEqual(result, "https://fonts.gstatic.com/s/indieflower/v9/m8JVjfNVeKWVnh3QMuKkFcZVaUuH.woff2") def test_find_first_url_2(self): result = find_first_url(TEST_URL_2) self.assertEqual(result, "https://fonts.gstatic.com/s/indieflower/v9/m8JVjfNVeKWVnh3QMuKkFcZVaUuH.woff2") def test_embed_google_web_font(self): dwg = Drawing() dwg.embed_google_web_font(name="Indie Flower", uri="http://fonts.googleapis.com/css?family=Indie+Flower") style = dwg.defs.elements[0] self.assertEqual(style.elementname, 'style') svgwrite-1.4.1/tests/test_svg.py000066400000000000000000000014751400026116000167360ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test svg element # Created: 25.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest from svgwrite.container import SVG, Symbol class TestSVG(unittest.TestCase): def test_constructor(self): svg = SVG(insert=(10,20), size=(100,200)) self.assertTrue(isinstance(svg, Symbol)) self.assertEqual(svg.tostring(), '') def test_add_svg_as_subelement(self): svg = SVG(id='svg') subsvg = SVG(id='subsvg') svg.add(subsvg) self.assertEqual(svg.tostring(), '') if __name__=='__main__': unittest.main() svgwrite-1.4.1/tests/test_svgattributes.py000066400000000000000000000057721400026116000210510ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test SVGAttribute # Created: 12.10.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest from svgwrite.data.types import SVGAttribute, SVGMultiAttribute class TestSVGMultiAttribute(unittest.TestCase): def setUp(self): self.ma = SVGMultiAttribute({ '*': SVGAttribute('x', anim=True, types=frozenset(['coordinate']), const=frozenset(['star'])), 'text tref tspan': SVGAttribute('x', anim=False, types=frozenset(['list-of-coordinate']), const=frozenset(['text'])) } ) def test_no_default(self): ma = SVGMultiAttribute({ 'a': SVGAttribute('x', anim=True, types=frozenset(['coordinate']), const=frozenset(['star'])), 'b': SVGAttribute('x', anim=False, types=frozenset(['list-of-coordinate']), const=frozenset(['text'])) } ) self.assertTrue('coordinate' in ma.get_types('c')) def test_get_types(self): coordinate = frozenset(['coordinate']) list_of_coordinates = frozenset(['list-of-coordinate']) self.assertEqual(coordinate, self.ma.get_types('line')) # default attribute self.assertEqual(coordinate, self.ma.get_types()) # default attribute self.assertEqual(list_of_coordinates, self.ma.get_types('text')) self.assertEqual(list_of_coordinates, self.ma.get_types('tref')) self.assertEqual(list_of_coordinates, self.ma.get_types('tspan')) def test_get_anim(self): self.assertTrue(self.ma.get_anim('line')) # default attribute self.assertTrue(self.ma.get_anim()) # default attribute self.assertFalse(self.ma.get_anim('text')) self.assertFalse(self.ma.get_anim('tref')) self.assertFalse(self.ma.get_anim('tspan')) def test_get_const(self): star = frozenset(['star']) text = frozenset(['text']) self.assertEqual(star, self.ma.get_const('line')) # default attribute self.assertEqual(star, self.ma.get_const()) # default attribute self.assertEqual(text, self.ma.get_const('text')) self.assertEqual(text, self.ma.get_const('tref')) self.assertEqual(text, self.ma.get_const('tspan')) def test_init_error(self): # different attribute names ma = { '*' : SVGAttribute('x', True, [], []), 'text' : SVGAttribute('y', False, [], []) } self.assertRaises(ValueError, SVGMultiAttribute, ma) if __name__=='__main__': unittest.main() svgwrite-1.4.1/tests/test_symbol.py000066400000000000000000000016621400026116000174420ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test symbol element # Created: 25.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest from svgwrite.container import Symbol, Group class TestSymbol(unittest.TestCase): def test_constructor(self): symbol = Symbol() self.assertEqual(symbol.tostring(), "") def test_add_subelement(self): symbol = Symbol(id='symbol') group = Group(id='group') symbol.add(group) self.assertEqual(symbol.tostring(), '') def test_add_group(self): symbol = Symbol(id='symbol') group = symbol.add(Group(id='group')) # implicit call of add self.assertEqual(symbol.tostring(), '') if __name__=='__main__': unittest.main() svgwrite-1.4.1/tests/test_text.py000066400000000000000000000106241400026116000171170ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test text module # Created: 25.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import unittest from svgwrite.text import TSpan, TRef, TextPath class TestTSpan(unittest.TestCase): def test_constructor(self): txt = TSpan('testtext') self.assertEqual(txt.tostring(), 'testtext') def test_insert(self): txt = TSpan('testtext', insert=(1,1)) self.assertEqual(txt.tostring(), 'testtext') def test_subelement(self): txt = TSpan('testtext') txt.add(TSpan('subtext1')) txt.add(TSpan('subtext2')) self.assertEqual(txt.tostring(), 'testtextsubtext1subtext2') def test_x_values(self): txt = TSpan('text', x=[1, 2, 3, 4]) self.assertEqual(txt.tostring(), 'text') def test_y_values(self): txt = TSpan('text', y=[1, 2, 3, 4]) self.assertEqual(txt.tostring(), 'text') def test_dx_values(self): txt = TSpan('text', dx=[1, 2, 3, 4]) self.assertEqual(txt.tostring(), 'text') def test_dy_values(self): txt = TSpan('text', dy=[1, 2, 3, 4]) self.assertEqual(txt.tostring(), 'text') def test_rotate_values(self): txt = TSpan('text', rotate=[1, 2, 3, 4]) self.assertEqual(txt.tostring(), 'text') def test_subelement_tspan(self): txt = TSpan('text') txt.add(TSpan('subtext')) self.assertEqual(txt.tostring(), 'textsubtext') def test_non_us_ascii_chars(self): txt = TSpan('öäü') self.assertEqual(txt.tostring(), 'öäü') def test_errors(self): # None for x, y, dx, dy, rotate is valid - willl be ignored self.assertRaises(TypeError, TSpan,"txt", x=1) self.assertRaises(TypeError, TSpan,"txt", y=1) self.assertRaises(TypeError, TSpan,"txt", dx=1) self.assertRaises(TypeError, TSpan,"txt", dy=1) self.assertRaises(TypeError, TSpan,"txt", rotate=1) def test_insert_errors(self): self.assertRaises(TypeError, TSpan, "txt", insert=1) self.assertRaises(TypeError, TSpan, "txt", insert='1') # do not use 'insert' and 'x' or 'y' at the same time self.assertRaises(ValueError, TSpan, "txt", insert=(1,1), x=[1]) self.assertRaises(ValueError, TSpan, "txt", insert=(1,1), y=[1]) def test_text_decoration(self): with self.assertRaises(TypeError): TSpan('text', text_decoration='xxx') self.assertTrue(TSpan('text', text_decoration='none')) self.assertTrue(TSpan('text', text_decoration='inherit')) self.assertTrue(TSpan('text', text_decoration='underline')) self.assertTrue(TSpan('text', text_decoration='overline')) self.assertTrue(TSpan('text', text_decoration='line-through')) self.assertTrue(TSpan('text', text_decoration='blink')) # multiple decoration are allowed self.assertTrue(TSpan('text', text_decoration='underline blink overline')) with self.assertRaises(TypeError): # can not mix none with decoration styles TSpan('text', text_decoration='none underline') with self.assertRaises(TypeError): # can not mix inherit with decoration styles TSpan('text', text_decoration='inherit underline') class TestTRef(unittest.TestCase): def test_constructor(self): tref = TRef('#test') self.assertEqual(tref.tostring(), '') class TestTextPath(unittest.TestCase): def test_constructor(self): tref = TextPath('#test', 'The Text', startOffset=10, spacing='auto', method='stretch') self.assertEqual(tref.tostring(), 'The Text') def test_subelement_tspan(self): txt = TextPath('#test', 'text') txt.add(TSpan('subtext')) self.assertEqual(txt.tostring(), 'textsubtext') if __name__=='__main__': unittest.main() svgwrite-1.4.1/tests/test_textarea.py000066400000000000000000000072701400026116000177530ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test TextArea class # Created: 14.10.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest from svgwrite.text import TextArea from svgwrite.text import TBreak class TestTBreak(unittest.TestCase): def test_tostring(self): br = TBreak(profile='tiny') self.assertEqual(br.tostring(), "") def test_errors(self): br = TBreak() self.assertRaises(NotImplementedError, br.add, None) self.assertRaises(NotImplementedError, br.__getitem__, 'key') self.assertRaises(NotImplementedError, br.__setitem__, 'key', 'value') class TestTextAreaFullProfile(unittest.TestCase): def test_constructor(self): self.assertRaises(KeyError, TextArea, (0, 0)) class TestTextAreaTinyProfile(unittest.TestCase): def test_constructor(self): textarea = TextArea(insert=(1, 2), size=(10,20), profile='tiny') self.assertEqual(textarea.tostring(), '') def test_write_linebreaks(self): textarea = TextArea('\n', profile='tiny') self.assertEqual(textarea.tostring(), '') textarea = TextArea('\n\n', profile='tiny') self.assertEqual(textarea.tostring(), '') def test_write_lines(self): textarea = TextArea('line1\n', profile='tiny') self.assertEqual(textarea.tostring(), '') textarea = TextArea('line1\nline2', profile='tiny') self.assertEqual(textarea.tostring(), '') textarea = TextArea('line1\nline2\n', profile='tiny') self.assertEqual(textarea.tostring(), '') textarea = TextArea('line1\n \nline2\n', profile='tiny') self.assertEqual(textarea.tostring(), '') def test_line_increment(self): textarea = TextArea('line1\n', profile='tiny') textarea.line_increment('14') self.assertEqual(textarea.tostring(), '') def test_write_lines_prepending_linebreak(self): textarea = TextArea('\nline1\n', profile='tiny') self.assertEqual(textarea.tostring(), '') textarea = TextArea('\nline1\nline2', profile='tiny') self.assertEqual(textarea.tostring(), '') textarea = TextArea('\nline1\nline2\n', profile='tiny') self.assertEqual(textarea.tostring(), '') textarea = TextArea('\nline1\n\nline2\n', profile='tiny') self.assertEqual(textarea.tostring(), '') if __name__ == '__main__': unittest.main() svgwrite-1.4.1/tests/test_tiny12_typechecker.py000066400000000000000000000050301400026116000216420ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test tiny12 typechecker # Created: 08.10.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest from svgwrite.data.typechecker import Tiny12TypeChecker class TestTiny12TypeChecker(unittest.TestCase): def setUp(self): self.checker = Tiny12TypeChecker() def test_is_bool(self): self.assertTrue(self.checker.is_boolean(True)) self.assertTrue(self.checker.is_boolean(False)) self.assertTrue(self.checker.is_boolean(' true ')) self.assertTrue(self.checker.is_boolean(' false ')) self.assertTrue(self.checker.is_boolean('True')) self.assertTrue(self.checker.is_boolean('False')) def test_is_not_bool(self): self.assertFalse(self.checker.is_boolean(1)) self.assertFalse(self.checker.is_boolean(0)) self.assertFalse(self.checker.is_boolean((1, 1))) self.assertFalse(self.checker.is_boolean(dict(a=1, b=1))) def test_is_number(self): """ Integer and Float, also as String '100' or '3.1415'. """ # big numbers only valid for full profile self.assertTrue(self.checker.is_number(10000)) self.assertTrue(self.checker.is_number(-10000)) self.assertTrue(self.checker.is_number(3.141592)) self.assertTrue(self.checker.is_number('10000')) self.assertTrue(self.checker.is_number('-10000')) self.assertTrue(self.checker.is_number('3.141592')) def test_is_not_number(self): self.assertFalse(self.checker.is_number( (1,2) )) self.assertFalse(self.checker.is_number('manfred')) self.assertFalse(self.checker.is_number( dict(a=1, b=2) )) self.assertFalse(self.checker.is_number(100000)) self.assertFalse(self.checker.is_number(-100000)) self.assertFalse(self.checker.is_number('100000')) self.assertFalse(self.checker.is_number('-100000')) def test_is_focus(self): for focus in [' nav-next ', ' nav-prev ', ' nav-up ', ' nav-down ', ' nav-left ', ' nav-right ', ' nav-up-left ', ' nav-up-right ', 'nav-down-left', 'nav-down-right']: self.assertTrue(self.checker.is_focus(focus)) def test_is_not_focus(self): self.assertFalse(self.checker.is_focus('mozman')) self.assertFalse(self.checker.is_focus(1)) self.assertFalse(self.checker.is_focus((1,1))) if __name__=='__main__': unittest.main() svgwrite-1.4.1/tests/test_transform.py000066400000000000000000000070621400026116000201500ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test ITransform interface # Created: 25.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest from svgwrite.params import Parameter from svgwrite.base import BaseElement from svgwrite.mixins import Transform class Mock(BaseElement, Transform): elementname = 'g' _parameter = Parameter(True, 'full') class TestITransfer(unittest.TestCase): def test_mock_class(self): m = Mock() self.assertEqual(m.tostring(), '') def test_translate_tx(self): m = Mock() m.translate(tx=10) self.assertEqual(m.tostring(), '') def test_translate_tx_ty(self): m = Mock() # strings allowed m.translate(tx='10', ty=20) self.assertEqual(m.tostring(), '') def test_translate_err(self): m = Mock() # no units allowed self.assertRaises(TypeError, m.translate, '10cm') def test_rotate(self): m = Mock() m.rotate(angle=30) self.assertEqual(m.tostring(), '') def test_rotate_center(self): m = Mock() # strings allowed m.rotate(angle='30', center=(1,2)) self.assertEqual(m.tostring(), '') def test_rotate_err(self): m = Mock() # no units allowed self.assertRaises(TypeError, m.rotate, '30deg') self.assertRaises(TypeError, m.rotate, '30', center=('1cm', '1cm')) def test_scale_sx(self): m = Mock() m.scale(sx=3) self.assertEqual(m.tostring(), '') def test_scale_sx_sy(self): m = Mock() m.scale(sx='3', sy=2) self.assertEqual(m.tostring(), '') def test_scale_err(self): m = Mock() # no units allowed self.assertRaises(TypeError, m.scale, '3cm') self.assertRaises(TypeError, m.scale, '3', '2cm') def test_skewX(self): m = Mock() m.skewX(angle=30) self.assertEqual(m.tostring(), '') def test_skewX_str(self): m = Mock() m.skewX(angle='30') self.assertEqual(m.tostring(), '') def test_skewX_err(self): m = Mock() # no units allowed self.assertRaises(TypeError, m.skewX, '3deg') def test_skewY(self): m = Mock() m.skewY(angle=30) self.assertEqual(m.tostring(), '') def test_skewY_str(self): m = Mock() m.skewY(angle='30') self.assertEqual(m.tostring(), '') def test_skewY_err(self): m = Mock() # no units allowed self.assertRaises(TypeError, m.skewY, '3deg') def test_matrix(self): m = Mock() m.matrix(1,2,3,4,5,6) self.assertEqual(m.tostring(), '') def test_matrix_too_few_params(self): m = Mock() self.assertRaises(TypeError, m.matrix, 1, 2, 3, 4, 5) def test_combine_tranformation(self): m = Mock() m.translate(10,20) m.scale(2,2) self.assertEqual(m.tostring(), '') def test_delete_transformation(self): m = Mock() m.translate(10,20) del m.attribs['transform'] self.assertEqual(m.tostring(), '') if __name__=='__main__': unittest.main() svgwrite-1.4.1/tests/test_transformlistparser.py000066400000000000000000000051041400026116000222540ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: transform list parser # Created: 10.10.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import unittest from svgwrite.data.svgparser import is_valid_transferlist class TestTransformListParser(unittest.TestCase): def test_matrix_1(self): self.assertTrue(is_valid_transferlist("matrix(1 2 3 4 5 6)")) def test_matrix_2(self): self.assertTrue(is_valid_transferlist("matrix(1, 2, 3, 4, 5, 6)")) def test_translate_1(self): self.assertTrue(is_valid_transferlist("translate(1)")) def test_translate_2(self): self.assertTrue(is_valid_transferlist("translate(1 2)")) def test_translate_3(self): self.assertTrue(is_valid_transferlist("translate(1,2)")) def test_rotate_1(self): self.assertTrue(is_valid_transferlist("rotate(1)")) def test_rotate_3(self): self.assertTrue(is_valid_transferlist("rotate(1 2 3)")) def test_scale_1(self): self.assertTrue(is_valid_transferlist("scale(1)")) def test_scale_2(self): self.assertTrue(is_valid_transferlist("scale(2)")) def test_skewX(self): self.assertTrue(is_valid_transferlist("skewX(30)")) def test_skewY(self): self.assertTrue(is_valid_transferlist("skewY(30)")) def test_parse_skewX_errors(self): self.assertFalse(is_valid_transferlist("skewX()")) self.assertFalse(is_valid_transferlist("skewX(30 30)")) self.assertFalse(is_valid_transferlist("skewX(30,30)")) def test_parse_skewY_errors(self): self.assertFalse(is_valid_transferlist("skewY()")) self.assertFalse(is_valid_transferlist("skewY(30 30)")) self.assertFalse(is_valid_transferlist("skewY(30,30)")) def test_parse_matrix_errors(self): self.assertFalse(is_valid_transferlist("matrix()")) self.assertFalse(is_valid_transferlist("matrix(1, 2, 3, 4, 5, 6,)")) self.assertFalse(is_valid_transferlist("matrix(1, 2, 3, 4, 5, )")) self.assertFalse(is_valid_transferlist("matrix(1, 2, 3, 4)")) def test_multi_command(self): self.assertTrue(is_valid_transferlist("matrix(1 2 3 4 5 6) skewX(30)")) self.assertTrue(is_valid_transferlist("skewY(15), matrix(1 2 3 4 5 6) skewX(30)")) def test_multi_command_errors(self): self.assertFalse(is_valid_transferlist("skewX(15),, skewY(15)")) self.assertFalse(is_valid_transferlist("skewX(15), skewY(15) ,")) if __name__ == '__main__': unittest.main() svgwrite-1.4.1/tests/test_use.py000066400000000000000000000026571400026116000167360ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test svg element # Created: 25.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest from svgwrite.container import Use, Group from svgwrite.utils import AutoID class TestUse(unittest.TestCase): def test_constructor(self): use = Use('#an_id', x=10, y=20, width=100, height=200) self.assertEqual(use.tostring(), '') def test_constructor2(self): use = Use('#an_id', insert=(10, 20), size=(100, 200)) self.assertEqual(use.tostring(), '') def test_object_link(self): g = Group(id='test') use = Use(g) self.assertEqual(use.tostring(), '') def test_object_link_auto_id(self): AutoID(999) # set next id to 999 g = Group() use = Use(g) self.assertEqual(use.tostring(), '') def test_object_link_change_id(self): g = Group(id=999) self.assertEqual(g['id'], 999) use = Use(g) # change 'id' after assigning to object g['id'] = 'newid' self.assertEqual(use.tostring(), '') if __name__=='__main__': unittest.main() svgwrite-1.4.1/tests/test_utils.py000066400000000000000000000145111400026116000172720ustar00rootroot00000000000000#!/usr/bin/env python # coding:utf-8 # Author: mozman # Purpose: test utils module # Created: 10.09.2010 # Copyright (c) 2010-2020, Manfred Moitzi # License: MIT License import unittest from svgwrite.utils import rgb, AutoID, get_unit from svgwrite.utils import strlist, rect_top_left_corner from svgwrite.utils import split_angle, split_coordinate from svgwrite import cm class TestRgb(unittest.TestCase): def test_rgb_8bit(self): self.assertEqual(rgb(128, 128, 128), "rgb(128,128,128)") self.assertEqual(rgb(), "rgb(0,0,0)") # value overflow self.assertEqual(rgb(256, 256, 256), "rgb(0,0,0)") self.assertEqual(rgb(257, 257, 257), "rgb(1,1,1)") def test_rgb_percent(self): self.assertEqual(rgb(50, 50, 50, '%'), "rgb(50%,50%,50%)") self.assertEqual(rgb(mode='%'), "rgb(0%,0%,0%)") # value overflow self.assertEqual(rgb(101, -1, 101, '%'), "rgb(100%,0%,100%)") def test_rgb_invalid_mode(self): self.assertRaises(ValueError, rgb, mode='$') class TestStrList(unittest.TestCase): def test_basic_types(self): self.assertEqual(strlist([1, 2, 3]), "1,2,3") self.assertEqual(strlist([1, None, 3]), "1,3") self.assertEqual(strlist([1, 2, None]), "1,2") def test_seperator(self): self.assertEqual(strlist([1, 2, 3], ' '), "1 2 3") self.assertEqual(strlist([1, None, 3], ';'), "1;3") self.assertEqual(strlist([1, 2, None], ':'), "1:2") def test_list(self): self.assertEqual(strlist([(5, 'abc', None), (1, 2, None)]), "5,abc,1,2") self.assertEqual(strlist([(1, None, 3), 4]), "1,3,4") def test_string(self): self.assertEqual(strlist("5,abc,1,2"), "5,abc,1,2") class TestRectTopLeftCorner(unittest.TestCase): def test_top_left(self): res = rect_top_left_corner(insert=(10, 10), size=(10, 10)) self.assertEqual(res, (10, 10)) def test_top_center(self): res = rect_top_left_corner(insert=(10, 10), size=(10, 10), pos='top-center') self.assertEqual(res, (5, 10)) def test_top_right(self): res = rect_top_left_corner(insert=(10, 10), size=(10, 10), pos='top-right') self.assertEqual(res, (0, 10)) def test_middle_center(self): res = rect_top_left_corner(insert=(10, 10), size=(10, 10), pos='middle-center') self.assertEqual(res, (5, 5)) def test_bottom_center(self): res = rect_top_left_corner(insert=(10, 10), size=(10, 10), pos='bottom-center') self.assertEqual(res, (5, 0)) def test_valid_units(self): res = rect_top_left_corner(insert=('10mm', '10mm'), size=('10mm', '10mm'), pos='middle-center') # numbers converted to floats self.assertEqual(res, ('5.0mm', '5.0mm')) res = rect_top_left_corner(insert=('10in', '10in'), size=('10in', '10in'), pos='bottom-center') self.assertEqual(res, ('5.0in', '0.0in')) def test_invalid_units(self): # insert and size has to have the same units self.assertRaises(ValueError, rect_top_left_corner, insert=('10cm', '10cm'), size=(10, 10), pos='middle-center') self.assertRaises(ValueError, rect_top_left_corner, insert=('10mm', '10mm'), size=('10cm', '10cm'), pos='middle-center') self.assertRaises(ValueError, rect_top_left_corner, insert=('10mm', '10mm'), size=('10mm', '10cm'), pos='middle-center') def test_invalid_pos(self): # insert and size has to have the same units self.assertRaises(ValueError, rect_top_left_corner, insert=(1, 1), size=(1, 1), pos='middle-mitte') self.assertRaises(ValueError, rect_top_left_corner, insert=(1, 1), size=(1, 1), pos='mitte-center') class TestSplitCoordinate(unittest.TestCase): def test_int_coordinates(self): res = split_coordinate(10) self.assertEqual(res, (10, None)) def test_float_coordinates(self): res = split_coordinate(7.9) self.assertEqual(res, (7.9, None)) def test_valid_str_coordinates(self): res = split_coordinate('10cm') self.assertEqual(res, (10, 'cm')) res = split_coordinate('10.7in') self.assertEqual(res, (10.7, 'in')) def test_invalid_str_coordinates(self): self.assertRaises(ValueError, split_coordinate, '100km') self.assertRaises(ValueError, split_coordinate, '100ccm') self.assertRaises(ValueError, split_coordinate, '10,0cm') self.assertRaises(ValueError, split_coordinate, '1.0.0cm') class TestSplitAngle(unittest.TestCase): def test_int_angle(self): res = split_angle(10) self.assertEqual(res, (10, None)) def test_float_angle(self): res = split_angle(7.9) self.assertEqual(res, (7.9, None)) def test_valid_str_angle(self): res = split_angle('10deg') self.assertEqual(res, (10, 'deg')) res = split_angle('10.7rad') self.assertEqual(res, (10.7, 'rad')) res = split_angle('10.7grad') self.assertEqual(res, (10.7, 'grad')) def test_invalid_str_angle(self): self.assertRaises(ValueError, split_angle, '100km') self.assertRaises(ValueError, split_angle, '100ccm') self.assertRaises(ValueError, split_angle, '10,0deg') self.assertRaises(ValueError, split_angle, '1.0.0deg') class TestAutoID(unittest.TestCase): def test_next_id(self): getter = AutoID(1) self.assertEqual('id1', getter.next_id()) getter = AutoID() self.assertEqual('id2', getter.next_id()) self.assertEqual('id3', AutoID.next_id()) def test_set_next_id(self): # getter = AutoID() self.assertEqual('id7', AutoID.next_id(7)) self.assertEqual('id8', AutoID.next_id()) class TestGetUnit(unittest.TestCase): def test_number(self): self.assertEqual(None, get_unit(1)) self.assertEqual(None, get_unit(1.0)) def test_valid_units(self): self.assertEqual('cm', get_unit('1cm')) self.assertEqual('mm', get_unit('3.1415mm')) self.assertEqual('%', get_unit('300%')) def test_invalid_units(self): self.assertRaises(ValueError, get_unit, '1m') class TestUnit(unittest.TestCase): def test_cm(self): self.assertEqual('5cm', 5 * cm) def test_call_cm(self): self.assertEqual('5cm,7cm', cm(5, 7)) if __name__ == '__main__': unittest.main() svgwrite-1.4.1/tests/test_validator2.py000066400000000000000000000161721400026116000202060ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test utils module # Created: 10.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import unittest from svgwrite.validator2 import get_validator class TestGetCoordinate(unittest.TestCase): def test_invalid_profile(self): self.assertRaises(ValueError, get_validator, profile='invalid') def test_get_none_coordinate(self): validator = get_validator('tiny', debug=True) self.assertRaises(TypeError, validator.get_coordinate, None) def test_valid_units(self): validator = get_validator('tiny', debug=True) for value, number, unit in [(' 100px ', 100, 'px'), (' -100ex ', -100, 'ex'), (' 100em ', 100, 'em'), (' -100pt ', -100, 'pt'), (' 100pc ', 100, 'pc'), (' 100mm', 100, 'mm'), (' 100cm', 100, 'cm'), (' 100in', 100, 'in'), (' 5%', 5, '%')]: number2, unit2 = validator.get_coordinate(value) self.assertEqual(number2, number) self.assertEqual(unit2, unit) def test_not_valid_numbers(self): validator = get_validator('tiny', debug=True) for value in (' 1s00in ', ' 1s00mm ', ' 1s00% '): self.assertRaises(ValueError, validator.get_coordinate, value) self.assertRaises(ValueError, validator.get_length, value) def test_not_valid_units(self): validator = get_validator('tiny', debug=True) for value in (' 100km ', ' 100mi ', ' 100$ '): self.assertRaises(ValueError, validator.get_coordinate, value) def test_not_valid_tiny_values(self): validator = get_validator('tiny', debug=True) for value in (100000, '100000', -100000, '-100000'): self.assertRaises(ValueError, validator.get_coordinate, value) # but valid for full profile - do not raise an error validator = get_validator('full', debug=True) for value in (100000, '100000', -100000, '-100000'): validator.get_coordinate(value) def test_valid_elementname(self): validator = get_validator('full', debug=True) self.assertTrue(validator.is_valid_elementname('text')) def test_invalid_elementname(self): validator = get_validator('full', debug=True) self.assertFalse(validator.is_valid_elementname('textArea')) def test_valid_children(self): validator = get_validator('full', debug=True) self.assertTrue(validator.is_valid_children('text', 'tspan')) def test_invalid_children(self): validator = get_validator('full', debug=True) self.assertFalse(validator.is_valid_children('text', 'line')) def test_check_invalid_children(self): validator = get_validator('full', debug=True) self.assertRaises(ValueError, validator.check_valid_children, 'text', 'line') def test_color(self): validator = get_validator('full', debug=True) self.assertTrue(validator.check_svg_type("red", 'color')) self.assertTrue(validator.check_svg_type("#000000", 'color')) self.assertTrue(validator.check_svg_type("rgb(10%, 20%, 30%)", 'color')) self.assertTrue(validator.check_svg_type("rgb(10.1%, 20.2%, 30.3%)", 'color')) def test_text_decoration_styles(self): validator = get_validator('full', debug=True) self.assertTrue(validator.check_svg_type('overline', 'list-of-text-decoration-style')) self.assertTrue(validator.check_svg_type('underline', 'list-of-text-decoration-style')) self.assertTrue(validator.check_svg_type('line-through', 'list-of-text-decoration-style')) self.assertTrue(validator.check_svg_type('blink', 'list-of-text-decoration-style')) self.assertTrue(validator.check_svg_type('underline overline blink', 'list-of-text-decoration-style')) with self.assertRaises(TypeError): validator.check_svg_type('underline overline inherit', 'list-of-text-decoration-style') class TestCheckCoordinate(unittest.TestCase): def test_valid_units(self): validator = get_validator('tiny', debug=True) for value, number, unit in [(' 100px ', 100, 'px'), (' -100ex ', -100, 'ex'), (' 100em ', 100, 'em'), (' -100pt ', -100, 'pt'), (' 100pc ', 100, 'pc'), (' 100mm', 100, 'mm'), (' 100cm', 100, 'cm'), (' 100in', 100, 'in'), (' 5%', 5, '%')]: value2 = validator.check_svg_type(value, 'coordinate') # checks also value pass through self.assertEqual(value, value2) def test_not_valid_numbers(self): validator = get_validator('tiny', debug=True) for value in (' 1s00in ', ' 1s00mm ', ' 1s00% '): self.assertRaises(TypeError, validator.check_svg_type, value, 'coordinate') def test_not_valid_units(self): validator = get_validator('tiny', debug=True) for value in (' 100km ', ' 100mi ', ' 100$ '): self.assertRaises(TypeError, validator.check_svg_type, value, 'coordinate') def test_not_valid_tiny_values(self): validator = get_validator('tiny', debug=True) for value in (100000, '100000', -100000, '-100000'): self.assertRaises(TypeError, validator.check_svg_type, value, 'coordinate') # but valid for full profile - do not raise an error validator = get_validator('full', debug=True) for value in (100000, '100000', -100000, '-100000'): validator.check_svg_type(value, 'coordinate') class TestCheckTiny(unittest.TestCase): def test_valid_tiny(self): validator = get_validator('tiny', debug=True) for value in (10000, 0, -10000., -32767.9999, +32767.9999): validator.check_svg_type(value, 'number') # no exception should raised def test_invalid_tiny(self): validator = get_validator('tiny', debug=True) for value in (100000, -100000., -32768, 32768): self.assertRaises(TypeError, validator.check_svg_type, value, 'number') class TestCheckAngle(unittest.TestCase): def test_valid_angle(self): validator = get_validator('tiny', debug=True) for value in ('100deg', '0.5grad', '-1.5rad'): validator.check_svg_type(value, 'angle') # no exception should raised def test_invalid_angle(self): validator = get_validator('tiny', debug=True) for value in ('10cm', '-10px', '10in', '1gon', '3°'): self.assertRaises(TypeError, validator.check_svg_type, value, 'angle') class TestCheckTypes(unittest.TestCase): def test_class_names(self): validator = get_validator('full', debug=True) self.assertTrue(validator.is_valid_svg_type('class1 class2', 'list-of-name')) if __name__ == '__main__': unittest.main() svgwrite-1.4.1/tests/test_viewbox.py000066400000000000000000000035751400026116000176250ustar00rootroot00000000000000#!/usr/bin/env python #coding:utf-8 # Author: mozman -- # Purpose: test ITransform interface # Created: 25.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest from svgwrite.params import Parameter from svgwrite.base import BaseElement from svgwrite.mixins import ViewBox class Mock(BaseElement, ViewBox): elementname = 'svg' _parameter = Parameter(True, 'full') class TestViewBox(unittest.TestCase): def test_mock_class(self): m = Mock() self.assertEqual(m.tostring(), '') def test_viewbox(self): m = Mock() m.viewbox(minx=1, miny=2, width=10, height=20) self.assertEqual(m.tostring(), '') def test_viewbox_err(self): m = Mock() # no units allowed self.assertRaises(TypeError, m.viewbox, '10cm') def test_strech(self): m = Mock() m.stretch() self.assertEqual(m.tostring(), '') def test_fit_horiz(self): m = Mock() for align, expected in [('left', 'xMin'), ('center', 'xMid'), ('right', 'xMax')]: m.fit(align, 'top', 'meet') self.assertEqual(m.tostring(), '' % expected) def test_fit_vert(self): m = Mock() for align, expected in [('top', 'YMin'), ('middle', 'YMid'), ('bottom', 'YMax')]: m.fit('left', align, 'slice') self.assertEqual(m.tostring(), '' % expected) def test_fit_err(self): m = Mock() self.assertRaises(ValueError, m.fit, scale='invalid') self.assertRaises(KeyError, m.fit, horiz='invalid') self.assertRaises(KeyError, m.fit, vert='invalid') if __name__=='__main__': unittest.main() svgwrite-1.4.1/tests/test_xlink.py000066400000000000000000000040401400026116000172530ustar00rootroot00000000000000#!/usr/bin/env python # coding:utf-8 # Author: mozman -- # Purpose: test ITransform interface # Created: 25.09.2010 # Copyright (C) 2010, Manfred Moitzi # License: MIT License import sys import unittest import re from svgwrite.container import Group from svgwrite.params import Parameter from svgwrite.base import BaseElement from svgwrite.mixins import XLink class Mock(BaseElement, XLink): elementname = 'use' _parameter = Parameter(True, 'full') def next_id(self): return "id999" class TestIXLink(unittest.TestCase): def test_mock_class(self): m = Mock() self.assertEqual(m.tostring(), '') def test_href(self): m = Mock() m.set_href('#an_id') self.assertEqual(m.tostring(), '') def test_object_link(self): g = Group(id='test') m = Mock() m.set_href(g) self.assertEqual(m.tostring(), '') def test_object_link_auto_id(self): g = Group() m = Mock() m.set_href(g) self.assertTrue(re.match(r'^$', m.tostring())) def test_set_xlink_show(self): m = Mock() m.set_xlink(show='new') self.assertEqual(m.tostring(), '') m.set_xlink(show='replace') self.assertEqual(m.tostring(), '') def test_set_xlink_role(self): m = Mock() m.set_xlink(role='http://test/role') self.assertEqual(m.tostring(), '') def test_set_xlink_arcrole(self): m = Mock() m.set_xlink(arcrole='http://test/arcrole') self.assertEqual(m.tostring(), '') def test_set_xlink_title(self): m = Mock() m.set_xlink(title='test') self.assertEqual(m.tostring(), '') if __name__ == '__main__': unittest.main() svgwrite-1.4.1/tox.ini000066400000000000000000000005271400026116000146740ustar00rootroot00000000000000# tox (https://tox.readthedocs.io/) is a tool for running tests # in multiple virtualenvs. This configuration file will run the # test suite on all supported python versions. To use it, "pip install tox" # and then run "tox" from this directory. [tox] envlist = py39, pypy3 [testenv] commands = {envpython} -m pytest tests deps = pytest