booleanOperations


NamebooleanOperations JSON
Version 0.9.0 PyPI version JSON
download
home_pagehttps://github.com/typemytype/booleanOperations
SummaryBoolean operations on paths.
upload_time2019-11-13 17:52:51
maintainer
docs_urlNone
authorFrederik Berlaen
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements fonttools pyclipper
Travis-CI
coveralls test coverage No coveralls.
            |Build Status| |PyPI| |Python Versions|

BooleanOperations
=================

Boolean operations on paths which uses a super fast `polygon clipper
library by Angus Johnson <http://www.angusj.com/delphi/clipper.php>`__.

You can download the latest version from PyPI:

https://pypi.org/project/booleanOperations.

Install
-------

`Pip <https://pip.pypa.io/en/stable/>`__ is the recommended tool to
install booleanOperations.

To install the latest version:

.. code:: sh

    pip install booleanOperations

BooleanOperations depends on the following packages:

- `pyclipper <https://pypi.org/project/pyclipper/>`__: Cython wrapper for
  the C++ Clipper library
- `fonttools <github.com/behdad/fonttools>`__

All dependencies are available on PyPI, so they will be resolved
automatically upon installing booleanOperations.

BooleanOperationManager
-----------------------

Containing a ``BooleanOperationManager`` handling all boolean operations
on paths. Paths must be similar to ``defcon``, ``robofab`` contours. A
manager draws the result in a ``pointPen``.

.. code:: py

    from booleanOperations import BooleanOperationManager

    manager = BooleanOperationManager()

BooleanOperationManager()
~~~~~~~~~~~~~~~~~~~~~~~~~

Create a ``BooleanOperationManager``.

manager.union(contours, pointPen)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Performs a union on all ``contours`` and draw it in the ``pointPen``.
(this is a what a remove overlaps does)

manager.difference(contours, clipContours, pointPen)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Knock out the ``clipContours`` from the ``contours`` and draw it in the
``pointPen``.

manager.intersection(contours, clipContours, pointPen)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Draw only the overlaps from the ``contours`` with the
``clipContours``\ and draw it in the ``pointPen``.

manager.xor(contours, clipContours, pointPen)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Draw only the parts that not overlaps from the ``contours`` with the
``clipContours``\ and draw it in the ``pointPen``.

manager.getIntersections(contours)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Returning all intersection for the given contours

BooleanGlyph
------------

A glyph like object with boolean powers.

.. code:: py

    from booleanOperations.booleanGlyph import BooleanGlyph

    booleanGlyph = BooleanGlyph(sourceGlyph)

BooleanGlyph(sourceGlyph)
~~~~~~~~~~~~~~~~~~~~~~~~~

Create a ``BooleanGlyph`` object from ``sourceGlyph``. This is a very
shallow glyph object with basic support.

booleanGlyph.union(other)
^^^^^^^^^^^^^^^^^^^^^^^^^

Perform a **union** with the ``other``. Other must be a glyph or
``BooleanGlyph`` object.

.. code:: py

    result = BooleanGlyph(glyph).union(BooleanGlyph(glyph2))
    result = BooleanGlyph(glyph) | BooleanGlyph(glyph2)

booleanGlyph.difference(other)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Perform a **difference** with the ``other``. Other must be a glyph or
``BooleanGlyph`` object.

.. code:: py

    result = BooleanGlyph(glyph).difference(BooleanGlyph(glyph2))
    result = BooleanGlyph(glyph) % BooleanGlyph(glyph2)

booleanGlyph.intersection(other)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Perform a **intersection** with the ``other``. Other must be a glyph or
``BooleanGlyph`` object.

.. code:: py

    result = BooleanGlyph(glyph).intersection(BooleanGlyph(glyph2))
    result = BooleanGlyph(glyph) & BooleanGlyph(glyph2)

booleanGlyph.xor(other)
^^^^^^^^^^^^^^^^^^^^^^^

Perform a **xor** with the ``other``. Other must be a glyph or
``BooleanGlyph`` object.

.. code:: py

    result = BooleanGlyph(glyph).xor(BooleanGlyph(glyph2))
    result = BooleanGlyph(glyph) ^ BooleanGlyph(glyph2)

booleanGlyph.removeOverlap()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Perform a **union** on it self. This will remove all overlapping
contours and self intersecting contours.

.. code:: py

    result = BooleanGlyph(glyph).removeOverlap()

--------------

booleanGlyph.name
^^^^^^^^^^^^^^^^^

The **name** of the ``sourceGlyph``.

booleanGlyph.unicodes
^^^^^^^^^^^^^^^^^^^^^

The **unicodes** of the ``sourceGlyph``.

booleanGlyph.width
^^^^^^^^^^^^^^^^^^

The **width** of the ``sourceGlyph``.

booleanGlyph.lib
^^^^^^^^^^^^^^^^

The **lib** of the ``sourceGlyph``.

booleanGlyph.note
^^^^^^^^^^^^^^^^^

The **note** of the ``sourceGlyph``.

booleanGlyph.contours
^^^^^^^^^^^^^^^^^^^^^

List the **contours** of the glyph.

booleanGlyph.components
^^^^^^^^^^^^^^^^^^^^^^^

List the **components** of the glyph.

booleanGlyph.anchors
^^^^^^^^^^^^^^^^^^^^

List the **anchors** of the glyph.

.. |Build Status| image:: https://api.travis-ci.org/typemytype/booleanOperations.svg
   :target: https://travis-ci.org/typemytype/booleanOperations
.. |PyPI| image:: https://img.shields.io/pypi/v/booleanOperations.svg
   :target: https://pypi.org/project/booleanOperations/
.. |Python Versions| image:: https://img.shields.io/badge/python-3.6,%203.7-blue.svg



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/typemytype/booleanOperations",
    "name": "booleanOperations",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Frederik Berlaen",
    "author_email": "frederik@typemytype.com",
    "download_url": "https://files.pythonhosted.org/packages/57/d9/9eae7bc4ba3a38ab7426522fb08e12df54aec27595d7bcd1bc0670aec873/booleanOperations-0.9.0.zip",
    "platform": "",
    "description": "|Build Status| |PyPI| |Python Versions|\n\nBooleanOperations\n=================\n\nBoolean operations on paths which uses a super fast `polygon clipper\nlibrary by Angus Johnson <http://www.angusj.com/delphi/clipper.php>`__.\n\nYou can download the latest version from PyPI:\n\nhttps://pypi.org/project/booleanOperations.\n\nInstall\n-------\n\n`Pip <https://pip.pypa.io/en/stable/>`__ is the recommended tool to\ninstall booleanOperations.\n\nTo install the latest version:\n\n.. code:: sh\n\n    pip install booleanOperations\n\nBooleanOperations depends on the following packages:\n\n- `pyclipper <https://pypi.org/project/pyclipper/>`__: Cython wrapper for\n  the C++ Clipper library\n- `fonttools <github.com/behdad/fonttools>`__\n\nAll dependencies are available on PyPI, so they will be resolved\nautomatically upon installing booleanOperations.\n\nBooleanOperationManager\n-----------------------\n\nContaining a ``BooleanOperationManager`` handling all boolean operations\non paths. Paths must be similar to ``defcon``, ``robofab`` contours. A\nmanager draws the result in a ``pointPen``.\n\n.. code:: py\n\n    from booleanOperations import BooleanOperationManager\n\n    manager = BooleanOperationManager()\n\nBooleanOperationManager()\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nCreate a ``BooleanOperationManager``.\n\nmanager.union(contours, pointPen)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPerforms a union on all ``contours`` and draw it in the ``pointPen``.\n(this is a what a remove overlaps does)\n\nmanager.difference(contours, clipContours, pointPen)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nKnock out the ``clipContours`` from the ``contours`` and draw it in the\n``pointPen``.\n\nmanager.intersection(contours, clipContours, pointPen)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nDraw only the overlaps from the ``contours`` with the\n``clipContours``\\ and draw it in the ``pointPen``.\n\nmanager.xor(contours, clipContours, pointPen)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nDraw only the parts that not overlaps from the ``contours`` with the\n``clipContours``\\ and draw it in the ``pointPen``.\n\nmanager.getIntersections(contours)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nReturning all intersection for the given contours\n\nBooleanGlyph\n------------\n\nA glyph like object with boolean powers.\n\n.. code:: py\n\n    from booleanOperations.booleanGlyph import BooleanGlyph\n\n    booleanGlyph = BooleanGlyph(sourceGlyph)\n\nBooleanGlyph(sourceGlyph)\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nCreate a ``BooleanGlyph`` object from ``sourceGlyph``. This is a very\nshallow glyph object with basic support.\n\nbooleanGlyph.union(other)\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPerform a **union** with the ``other``. Other must be a glyph or\n``BooleanGlyph`` object.\n\n.. code:: py\n\n    result = BooleanGlyph(glyph).union(BooleanGlyph(glyph2))\n    result = BooleanGlyph(glyph) | BooleanGlyph(glyph2)\n\nbooleanGlyph.difference(other)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPerform a **difference** with the ``other``. Other must be a glyph or\n``BooleanGlyph`` object.\n\n.. code:: py\n\n    result = BooleanGlyph(glyph).difference(BooleanGlyph(glyph2))\n    result = BooleanGlyph(glyph) % BooleanGlyph(glyph2)\n\nbooleanGlyph.intersection(other)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPerform a **intersection** with the ``other``. Other must be a glyph or\n``BooleanGlyph`` object.\n\n.. code:: py\n\n    result = BooleanGlyph(glyph).intersection(BooleanGlyph(glyph2))\n    result = BooleanGlyph(glyph) & BooleanGlyph(glyph2)\n\nbooleanGlyph.xor(other)\n^^^^^^^^^^^^^^^^^^^^^^^\n\nPerform a **xor** with the ``other``. Other must be a glyph or\n``BooleanGlyph`` object.\n\n.. code:: py\n\n    result = BooleanGlyph(glyph).xor(BooleanGlyph(glyph2))\n    result = BooleanGlyph(glyph) ^ BooleanGlyph(glyph2)\n\nbooleanGlyph.removeOverlap()\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPerform a **union** on it self. This will remove all overlapping\ncontours and self intersecting contours.\n\n.. code:: py\n\n    result = BooleanGlyph(glyph).removeOverlap()\n\n--------------\n\nbooleanGlyph.name\n^^^^^^^^^^^^^^^^^\n\nThe **name** of the ``sourceGlyph``.\n\nbooleanGlyph.unicodes\n^^^^^^^^^^^^^^^^^^^^^\n\nThe **unicodes** of the ``sourceGlyph``.\n\nbooleanGlyph.width\n^^^^^^^^^^^^^^^^^^\n\nThe **width** of the ``sourceGlyph``.\n\nbooleanGlyph.lib\n^^^^^^^^^^^^^^^^\n\nThe **lib** of the ``sourceGlyph``.\n\nbooleanGlyph.note\n^^^^^^^^^^^^^^^^^\n\nThe **note** of the ``sourceGlyph``.\n\nbooleanGlyph.contours\n^^^^^^^^^^^^^^^^^^^^^\n\nList the **contours** of the glyph.\n\nbooleanGlyph.components\n^^^^^^^^^^^^^^^^^^^^^^^\n\nList the **components** of the glyph.\n\nbooleanGlyph.anchors\n^^^^^^^^^^^^^^^^^^^^\n\nList the **anchors** of the glyph.\n\n.. |Build Status| image:: https://api.travis-ci.org/typemytype/booleanOperations.svg\n   :target: https://travis-ci.org/typemytype/booleanOperations\n.. |PyPI| image:: https://img.shields.io/pypi/v/booleanOperations.svg\n   :target: https://pypi.org/project/booleanOperations/\n.. |Python Versions| image:: https://img.shields.io/badge/python-3.6,%203.7-blue.svg\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Boolean operations on paths.",
    "version": "0.9.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "fb70caeb3a1a0fe29ed20b4362d0a283",
                "sha256": "86c291c2fba9faedff6f007c932d7f242dd9b4304e9c6ca8149f864d07877a59"
            },
            "downloads": -1,
            "filename": "booleanOperations-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fb70caeb3a1a0fe29ed20b4362d0a283",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 18480,
            "upload_time": "2019-11-13T17:52:49",
            "upload_time_iso_8601": "2019-11-13T17:52:49.744732Z",
            "url": "https://files.pythonhosted.org/packages/fc/c6/c4cae54f482465a33c5f011d95ec64293dce9e012dac7873147c2dc85396/booleanOperations-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "a5bbdb108b0fc58a6f7effcc27c51285",
                "sha256": "8cfa821c32ad374fa120d6b2e0b444ebeac57c91e6631528645fa19ac2a281b8"
            },
            "downloads": -1,
            "filename": "booleanOperations-0.9.0.zip",
            "has_sig": false,
            "md5_digest": "a5bbdb108b0fc58a6f7effcc27c51285",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 202950,
            "upload_time": "2019-11-13T17:52:51",
            "upload_time_iso_8601": "2019-11-13T17:52:51.704993Z",
            "url": "https://files.pythonhosted.org/packages/57/d9/9eae7bc4ba3a38ab7426522fb08e12df54aec27595d7bcd1bc0670aec873/booleanOperations-0.9.0.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2019-11-13 17:52:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "typemytype",
    "github_project": "booleanOperations",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "appveyor": true,
    "requirements": [
        {
            "name": "fonttools",
            "specs": [
                [
                    "==",
                    "4.0.2"
                ]
            ]
        },
        {
            "name": "pyclipper",
            "specs": [
                [
                    "==",
                    "1.1.0.post1"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "booleanoperations"
}
        
Elapsed time: 0.01742s