{ "info": { "author": "Lennart Regebro", "author_email": "regebro@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Multimedia :: Graphics" ], "description": "svg.path\n========\n\nsvg.path is a collection of objects that implement the different path\ncommands in SVG, and a parser for SVG path definitions.\n\n\nUsage\n-----\n\nThere are four path segment objects, ``Line``, ``Arc``, ``CubicBezier`` and\n``QuadraticBezier``.`There is also a ``Path`` object that acts as a\ncollection of the path segment objects.\n\nAll coordinate values for these classes are given as ``complex`` values,\nwhere the ``.real`` part represents the X coordinate, and the ``.imag`` part\nrepresentes the Y coordinate.\n\n >>> from svg.path import Path, Line, Arc, CubicBezier, QuadraticBezier\n\nAll of these objects have a ``.point()`` function which will return the\ncoordinates of a point on the path, where the point is given as a floating\npoint value where ``0.0`` is the start of the path and ``1.0`` is end end.\n\nYou can calculate the length of a Path or it's segments with the\n``.length()`` function. For CubicBezier and Arc segments this is done by\ngeometric approximation and for this reason **may be very slow**. You can\nmake it faster by passing in an ``error`` option to the method. If you\ndon't pass in error, it defaults to ``1e-12``.\n\n >>> CubicBezier(300+100j, 100+100j, 200+200j, 200+300j).length(error=1e-5)\n 297.2208145656899\n\nCubicBezier and Arc also has a ``min_depth`` option that specifies the\nminimum recursion depth. This is set to 5 by default, resulting in using a\nminimum of 32 segments for the calculation. Setting it to 0 is a bad idea for\nCubicBeziers, as they may become approximated to a straight line.\n\n``Line.length()`` and ``QuadraticBezier.length()`` also takes these\nparameters, but they are ignored.\n\nCubicBezier and QuadraticBezier also has ``is_smooth_from(previous)``\nmethods, that check if the segment is a \"smooth\" segment compared to the\ngiven segment.\n\nThere is also a ``parse_path()`` function that will take an SVG path definition\nand return a ``Path`` object.\n\n >>> from svg.path import parse_path\n >>> parse_path('M 100 100 L 300 100')\n Path(Move(to=(100+100j)), Line(start=(100+100j), end=(300+100j)), closed=False)\n\n\nClasses\n.......\n\nThese are the SVG path segment classes. See the `SVG specifications\n`_ for more information on what each\nparameter means.\n\n* ``Line(start, end)``\n\n* ``Arc(start, radius, rotation, arc, sweep, end)``\n\n* ``QuadraticBezier(start, control, end)``\n\n* ``CubicBezier(start, control1, control2, end)``\n\nIn addition to that, there is the ``Path`` class, which is instantiated\nwith a sequence of path segments:\n\n* ``Path(*segments)``\n\nThe ``Path`` class is a mutable sequence, so it behaves like a list.\nYou can add to it and replace path segments etc.\n\n >>> path = Path(Line(100+100j,300+100j), Line(100+100j,300+100j))\n >>> path.append(QuadraticBezier(300+100j, 200+200j, 200+300j))\n >>> path[0] = Line(200+100j,300+100j)\n >>> del path[1]\n\nThe path object also has a ``d()`` method that will return the\nSVG representation of the Path segments.\n\n >>> path.d()\n 'M 200,100 L 300,100 Q 200,200 200,300'\n\n\nExamples\n........\n\nThis SVG path example draws a triangle:\n\n\n >>> path1 = parse_path('M 100 100 L 300 100 L 200 300 z')\n\nYou can format SVG paths in many different ways, all valid paths should be\naccepted:\n\n >>> path2 = parse_path('M100,100L300,100L200,300z')\n\nAnd these paths should be equal:\n\n >>> path1 == path2\n True\n\nYou can also build a path from objects:\n\n >>> path3 = Path(Line(100+100j,300+100j), Line(300+100j, 200+300j), Line(200+300j, 100+100j))\n\nAnd it should again be equal to the first path:\n\n >>> path1 == path2\n True\n\nPaths are mutable sequences, you can slice and append:\n\n >>> path1.append(QuadraticBezier(300+100j, 200+200j, 200+300j))\n >>> len(path1[2:]) == 3\n True\n\nPaths also have a ``closed`` property, which defines if the path should be\nseen as a closed path or not.\n\n >>> path = parse_path('M100,100L300,100L200,300z')\n >>> path.closed\n True\n\nIf you modify the path in such a way that it is no longer closeable, it will\nnot be closed.\n\n >>> path[0].start = (100+105j)\n >>> path[1].start = (100+105j)\n >>> path.closed\n False\n\nHowever, a path previously set as closed will automatically close if it it\nfurther modified to that it can be closed.\n\n >>> path[-1].end = (300+100j)\n >>> path.closed\n True\n\nTrying to set a Path to be closed if the end does not coincide with the start\nof any segment will raise an error.\n\n >>> path = parse_path('M100,100L300,100L200,300')\n >>> path.closed = True\n Traceback (most recent call last):\n ...\n ValueError: End does not coincide with a segment start.\n\n\nFuture features\n---------------\n\n* Reversing paths. They should then reasonably be drawn \"backwards\" meaning each\n path segment also needs to be reversed.\n\n* Mathematical transformations might make sense.\n\n\nLicence\n-------\n\nThis module is under a MIT License.\n\nContributors\n============\n\nLennart Regebro , Original Author\n\nJustin Gruenberg implemented the Quadradic Bezier calculations and\nprovided suggestions and feedback about the d() function.\n\nMichiel Schallig suggested calculating length by recursive straight-line\napproximations, which enables you to choose between accuracy or speed.\nSteve Schwarz added an error argument to make that choice an argument.\n\nThanks also to bug fixers Martin R, abcjjy, Daniel Stender and MTician.\n\nChangelog\n=========\n\n\n3.0 (2018-08-14)\n----------------\n\n- Dropped support for Python 3.1 and 3.2. It still works, but it may stop.\n Added support for Python 3.6. Dropped support for Jython, it's not\n supported by Travis, and hasn't seen a release in over a year.\n\n- #33: Move commands are now preserved when parsed.\n\n- Subpaths are no longer merged even if they are joined.\n\n- #30: Arcs where the endpoint is the same as the start point caused a crash.\n The SVG specs say that it instead should be the equavalent of skipping\n that section, which now is the case.\n\n\n2.2 (2016-10-15)\n----------------\n\n- Don't add a line when closing a path if it's not needed.\n\n\n2.1.1 (2016-02-28)\n------------------\n\n- #18: QuadraticBeziers could get a DivideByZero error under certain\n circumstances. [MTician]\n\n- Accept an error parameter to Path.point() to be able to\n control error vs performance setting. [saschwarz]\n\n- #25: Arc's could create a MathDomain error under certain circumstances.\n\n- #17: Set last_command always.\n\n\n2.0.1 (2015-10-17)\n------------------\n\n- #20: The doctext for the closed() setter was incorrect.\n\n- #19: Fixed so tests didn't use relative paths. [danstender]\n\n\n2.0 (2015-05-15)\n----------------\n\n- Nothing changed yet.\n\n\n2.0b1 (2014-11-06)\n------------------\n\n- Added a Path.d() function to generate the Path's d attribute.\n\n- Added is_smooth_from() on QubicBezier and QuadradicBezier.\n\n- Path()'s now have a .closed property.\n\n- Fixed the representation so it's parseable.\n\n- The calculations for CubicBezier and Arc segments are now recursive,\n and will end when a specific accuracy has been achieved.\n This is somewhat faster for Arcs and somewhat slower for CubicBezier.\n However, you can now specify an accuracy, so if you want faster but\n looser calculations, you can have that.\n\n- 't' segments (smooth, relative QuadraticBeziers) whose previous segment was\n not a QuadraticBezier would get an incorrect control point.\n\n\n1.2 (2014-11-01)\n----------------\n\n- New Quadradic Bezier implementation. [Justin Gruenberg]\n\n- Solved issue #6: Z close path behavior. [abcjjy]\n\n\n1.1 (2013-10-19)\n----------------\n\n- Floats with negative exponents work again.\n\n- New tokenizer that is around 20 times faster.\n\n\n1.0 (2013-05-28)\n----------------\n\n- Solved issue #2: Paths with negative values and no spaces didn't work.\n [regebro]\n\n\n1.0b1 (2013-02-03)\n------------------\n\n- Original release.\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/regebro/svg.path", "keywords": "svg path maths", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "svg.path", "package_url": "https://pypi.org/project/svg.path/", "platform": "", "project_url": "https://pypi.org/project/svg.path/", "project_urls": { "Homepage": "https://github.com/regebro/svg.path" }, "release_url": "https://pypi.org/project/svg.path/3.0/", "requires_dist": [ "setuptools" ], "requires_python": "", "summary": "SVG path objects and parser", "version": "3.0" }, "last_serial": 4169668, "releases": { "2.1.1": [ { "comment_text": "", "digests": { "md5": "487a6429e495c9d2f8baaf15d9d0d216", "sha256": "c4acf1c17e1e3370fcc610ead8ff6ecbbd49f0f676a27335e76d1ddce21dfa14" }, "downloads": -1, "filename": "svg.path-2.1.1.tar.gz", "has_sig": false, "md5_digest": "487a6429e495c9d2f8baaf15d9d0d216", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19278, "upload_time": "2016-02-29T02:41:14", "url": "https://files.pythonhosted.org/packages/f0/8f/8121e7c7ad116249343e7ad781fe2ca0f7a111741d1d99998901258433ec/svg.path-2.1.1.tar.gz" } ], "2.2": [ { "comment_text": "", "digests": { "md5": "4dc43f859480918316fb62a45ed881d7", "sha256": "bc7b75606e76f910bf0045d09a5f8415aaafff3cedd0a3ce9f0d474fe2007722" }, "downloads": -1, "filename": "svg.path-2.2.tar.gz", "has_sig": false, "md5_digest": "4dc43f859480918316fb62a45ed881d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19352, "upload_time": "2016-10-15T10:01:15", "url": "https://files.pythonhosted.org/packages/1d/6c/cf484a95b895a7acd3989082501c67c8f43b6f91181f2a0b7aa634d1df6f/svg.path-2.2.tar.gz" } ], "3.0": [ { "comment_text": "", "digests": { "md5": "eac6dda9e8b806f73d73bf894b553f49", "sha256": "a4ef1da33f6dffc57f17cef1cbc674991fd2fd9d3c472e36f9c1e34ee5d63f01" }, "downloads": -1, "filename": "svg.path-3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "eac6dda9e8b806f73d73bf894b553f49", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23636, "upload_time": "2018-08-14T14:31:47", "url": "https://files.pythonhosted.org/packages/50/2f/618c5b6804e6dda90f024f0bc2d14ffc3db00221a818ee35da478427015d/svg.path-3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "13c080a8ce70cc6445c40e7191cf281d", "sha256": "7b568f90f67fd25413c8da9f8bc9f9f8ab089425c20fa03330e97e77d13880ee" }, "downloads": -1, "filename": "svg.path-3.0.tar.gz", "has_sig": false, "md5_digest": "13c080a8ce70cc6445c40e7191cf281d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18456, "upload_time": "2018-08-14T14:31:49", "url": "https://files.pythonhosted.org/packages/5a/7f/7a601000fc400024f76e660569b0b97f98787279daff079f0dbfa89293ba/svg.path-3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eac6dda9e8b806f73d73bf894b553f49", "sha256": "a4ef1da33f6dffc57f17cef1cbc674991fd2fd9d3c472e36f9c1e34ee5d63f01" }, "downloads": -1, "filename": "svg.path-3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "eac6dda9e8b806f73d73bf894b553f49", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23636, "upload_time": "2018-08-14T14:31:47", "url": "https://files.pythonhosted.org/packages/50/2f/618c5b6804e6dda90f024f0bc2d14ffc3db00221a818ee35da478427015d/svg.path-3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "13c080a8ce70cc6445c40e7191cf281d", "sha256": "7b568f90f67fd25413c8da9f8bc9f9f8ab089425c20fa03330e97e77d13880ee" }, "downloads": -1, "filename": "svg.path-3.0.tar.gz", "has_sig": false, "md5_digest": "13c080a8ce70cc6445c40e7191cf281d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18456, "upload_time": "2018-08-14T14:31:49", "url": "https://files.pythonhosted.org/packages/5a/7f/7a601000fc400024f76e660569b0b97f98787279daff079f0dbfa89293ba/svg.path-3.0.tar.gz" } ] }