Skip to content
Commits on Source (6)
......@@ -4,12 +4,13 @@ env:
- PYTHON_VERSION=$TRAVIS_PYTHON_VERSION
- NUMPY_VERSION=stable
- MAIN_CMD='python setup.py'
- CONDA_DEPENDENCIES='sphinx pillow coveralls coverage'
- CONDA_DEPENDENCIES='sphinx pillow coveralls coverage pytest'
- SETUP_XVFB=False
- EVENT_TYPE='push pull_request'
- SETUP_CMD='test'
- CONDA_CHANNELS='conda-forge'
- CIBW_TEST_REQUIRES='numpy pillow'
- CONDA_CHANNEL_PRIORITY='True'
- CIBW_TEST_REQUIRES='numpy pillow pytest'
- CIBW_TEST_COMMAND='python {project}/selftest.py'
- CIBW_BEFORE_BUILD_LINUX='yum install -y freetype-devel'
- TWINE_USERNAME='dhoese'
......
The Python Imaging Library: The aggdraw Module
# The aggdraw Library
*** Version 1.3.6 ***
## Version 1.3.10
- Fix Draw.path docstring mentioning unused x/y coordinates
- Fix compilation on OSX 10.9+
## Version 1.3.9
- Add docstrings to public functions from original effbot documentation
## Version 1.3.8
- Force rebuild to get working linux wheels
## Version 1.3.7
- Add binary wheel building
## Version 1.3.6
- Fix Freetype linking on Linux with no freetype-config
*** Version 1.3.5 ***
## Version 1.3.5
- Fix Freetype linking on Windows by using ctypes
*** Changes from release 1.3.3 to 1.3.4 ***
## Version 1.3.4
- Fix Freetype linking on certain systems [#27]
*** Changes from release 1.3.2 to 1.3.3 ***
## Version 1.3.3
- Fix Windows compatibility [#25]
*** Changes from release 1.3.1 to 1.3.2 ***
## Version 1.3.2
- Fix segmentation fault with certain compilers [#22]
*** Changes from release 1.3 to 1.3.1 ***
## Version 1.3.1
- Fix Python 2 compatibility when getting RGB from string colors [#21]
- Re-add ability to get colors from PIL [#21]
*** Changes from release 1.2 to 1.3 ***
## Version 1.3.0
- Python 3 support added
- Use freetype-config to find root freetype directory
- REVIVE THE PROJECT!
*** Changes from release 1.1 to 1.2 ***
## Changes from release 1.1 to 1.2
(1.2a3 released)
......@@ -70,7 +87,7 @@ The Python Imaging Library: The aggdraw Module
- Fixed a couple of gcc compiler nits.
*** Changes from release 1.0 to 1.1 ***
## Changes from release 1.0 to 1.1
(1.1 released)
......
......@@ -1329,7 +1329,7 @@ draw_rectangle(DrawObject* self, PyObject* args)
return Py_None;
}
const char *draw_path_doc = "Draw a path at the given positions (experimental).\n"
const char *draw_path_doc = "Draw the given path.\n"
"\n"
"If a brush is given, it is used to fill the path.\n"
"If a pen is given, it is used to draw an outline around the path.\n"
......@@ -1337,8 +1337,6 @@ const char *draw_path_doc = "Draw a path at the given positions (experimental).\
"\n"
"Parameters\n"
"----------\n"
"xy : iterable\n"
" A Python sequence (x, y, x, y, …).\n"
"path : Path\n"
" Path object created by the `Path` factory.\n"
"pen : Pen\n"
......
......@@ -3,15 +3,16 @@ environment:
PYTHON: "C:\\conda"
MINICONDA_VERSION: "latest"
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers\\appveyor\\windows_sdk.cmd"
CONDA_DEPENDENCIES: "sphinx pillow coveralls coverage"
CONDA_DEPENDENCIES: "sphinx pillow coveralls coverage pytest"
CONDA_CHANNELS: "conda-forge"
CONDA_CHANNEL_PRIORITY: "True"
TWINE_USERNAME: "dhoese"
TWINE_PASSWORD:
secure: zws6RrJGZ5XULrqXQDF/Cw==
matrix:
- CIBW_TEST_REQUIRES: "numpy pillow"
- CIBW_TEST_REQUIRES: "numpy pillow pytest"
CIBW_TEST_COMMAND: "python {project}\\selftest.py"
CIBUILDWHEEL: 1
......@@ -48,7 +49,7 @@ install:
build: false # Not a C# project, build stuff at the test step instead.
build_script:
- if [%CIBUILDWHEEL%]==[1] pip install cibuildwheel==0.10.0
- if [%CIBUILDWHEEL%]==[1] pip install cibuildwheel
- if [%CIBUILDWHEEL%]==[1] cibuildwheel --output-dir dist
- if [%CIBUILDWHEEL%]==[1] powershell ci/appveyor-twine.ps1
......
#!/usr/bin/env bash
if [ "${BUILDMODE}" = "ASTROPY" ]; then
if [[ "${BUILDMODE}" == "ASTROPY" ]]; then
git clone --depth 1 git://github.com/astropy/ci-helpers.git
source ci-helpers/travis/setup_conda.sh
elif [ "${BUILDMODE}" = "CIBUILDWHEEL" ]; then
elif [[ "${BUILDMODE}" == "CIBUILDWHEEL" ]]; then
export PIP=pip
if [ $(uname) = "Darwin" ]; then
if [[ $(uname) == "Darwin" ]]; then
export PIP=pip2
fi
$PIP install cibuildwheel==0.10.0
$PIP install cibuildwheel
fi
\ No newline at end of file
aggdraw (1.3.9+ds-3) UNRELEASED; urgency=medium
aggdraw (1.3.10-1) unstable; urgency=medium
[ Bas Couwenberg ]
* Update gbp.conf to use --source-only-changes by default.
-- Bas Couwenberg <sebastic@debian.org> Sun, 07 Jul 2019 07:36:16 +0200
[ Antonio Valentino ]
* New upstream release.
* debian/copyright:
- drop Files-Excluded for '.svn' files that are no longer in the
upstream tarball
* debian/control:
- add dependency form python{,3}-pytest
* debian/rules:
- install the upstream changelog
-- Antonio Valentino <antonio.valentino@tiscali.it> Sun, 07 Jul 2019 10:04:53 +0000
aggdraw (1.3.9+ds-2) unstable; urgency=medium
......
......@@ -16,7 +16,9 @@ Build-Depends: debhelper (>= 11),
python-pil,
python3-pil,
python-pkgconfig,
python3-pkgconfig
python3-pkgconfig,
python-pytest,
python3-pytest
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/debian-gis-team/aggdraw
Vcs-Git: https://salsa.debian.org/debian-gis-team/aggdraw.git
......
......@@ -2,8 +2,6 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: aggdraw
Upstream-Contact: Fredrik Lundh <fredrik@pythonware.com>
Source: https://github.com/pytroll/aggdraw
Files-Excluded: */.svn
Comment: unnecessary VCS directories
Files: *
Copyright: 2011-2018 AggDraw Developers
......
......@@ -14,3 +14,6 @@ override_dh_auto_test:
PYBUILD_SYSTEM=custom \
PYBUILD_TEST_ARGS="env PYTHONPATH={build_dir} python{version} selftest.py -v" \
dh_auto_test
override_dh_installchangelogs:
dh_installchangelogs -k CHANGELOG.md
......@@ -4,7 +4,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
SOURCEDIR = source
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
......
.. aggdraw documentation master file, created by
sphinx-quickstart on Sun Nov 25 14:38:56 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
AggDraw's documentation
=======================
.. automodule:: aggdraw
:members:
:undoc-members:
:show-inheritance:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
......@@ -7,7 +7,7 @@ REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set SOURCEDIR=source
set BUILDDIR=_build
if "%1" == "" goto help
......
......@@ -187,7 +187,7 @@ epub_exclude_files = ['search.html']
# -- Options for intersphinx extension ---------------------------------------
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {'https://docs.python.org/3/': None}
# -- Options for todo extension ----------------------------------------------
......
AggDraw
=======
The AggDraw library provides a python interface on top of
`the AGG library <http://www.antigrain.com/>`_. The library was originally
developed by Fredrik Lundh (effbot), but has since been picked up by various
developers. It is currently maintained by the PyTroll developmer group. The
official repository can be found on GitHub:
https://github.com/pytroll/aggdraw
The original documentation by effbot is
`still available <http://effbot.org/zone/aggdraw-index.htm>`_ but may be out
of date with the current version of the library. Original examples will be
migrated as time is available (pull requests welcome).
Installation
============
Aggdraw is available on Linux, OSX, and Windows. It can be installed from PyPI
with pip:
.. code-block:: bash
pip install aggdraw
Or from conda with the conda-forge channel:
.. code-block:: bash
conda install -c conda-forge aggdraw
API
===
.. automodule:: aggdraw
:members:
:undoc-members:
:show-inheritance:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
# $Id$
# -*- coding: iso-8859-1 -*-
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# sanity check
import numpy as np
from PIL import Image
import aggdraw
from aggdraw import Draw, Symbol, Brush, Pen, Path
import pytest
def test_module_init():
"""
>>> assert hasattr(aggdraw, 'VERSION')
>>> assert isinstance(aggdraw.VERSION, str)
>>> assert hasattr(aggdraw, '__version__')
>>> assert isinstance(aggdraw.__version__, str)
"""
import aggdraw
assert hasattr(aggdraw, 'VERSION')
assert isinstance(aggdraw.VERSION, str)
assert hasattr(aggdraw, '__version__')
assert isinstance(aggdraw.__version__, str)
def test_draw():
"""
>>> draw = Draw("RGB")
Traceback (most recent call last):
AttributeError: 'str' object has no attribute 'mode'
>>> draw = Draw("RGB", (800, 600))
>>> draw.mode, draw.size
('RGB', (800, 600))
from aggdraw import Draw
from PIL import Image
with pytest.raises(AttributeError) as excinfo:
Draw("RGB")
assert "'str' object has no attribute 'mode'" in str(excinfo.value)
>>> draw = Draw("RGB", (800, 600), "white")
>>> draw.mode, draw.size
('RGB', (800, 600))
draw = Draw("RGB", (800, 600))
assert draw.mode == 'RGB'
assert draw.size == (800, 600)
>>> im = Image.new("RGB", (600, 800))
>>> draw = Draw(im)
>>> draw.mode, draw.size
('RGB', (600, 800))
draw = Draw("RGB", (800, 600), "white")
assert draw.mode == 'RGB'
assert draw.size == (800, 600)
im = Image.new("RGB", (600, 800))
draw = Draw(im)
assert draw.mode == 'RGB'
assert draw.size == (600, 800)
"""
def test_flush():
"""
>>> im = Image.new("RGB", (600, 800))
>>> draw = Draw(im)
>>> draw.flush().mode
'RGB'
"""
from aggdraw import Draw
from PIL import Image
im = Image.new("RGB", (600, 800))
draw = Draw(im)
assert draw.flush().mode == 'RGB'
def test_pen():
"""
>>> pen = Pen("black")
>>> pen = Pen("black", 1)
>>> pen = Pen("black", 1.5)
>>> pen = Pen("black", 1, opacity=128)
from aggdraw import Pen
Pen("black")
Pen("black", 1)
Pen("black", 1.5)
Pen("black", 1, opacity=128)
>>> pen = Pen(0)
>>> pen = Pen((0,0,0))
>>> pen = Pen("rgb(0,0,0)")
>>> pen = Pen("gold")
"""
Pen(0)
Pen((0,0,0))
Pen("rgb(0,0,0)")
Pen("gold")
def test_brush():
"""
>>> brush = Brush("black")
>>> brush = Brush("black", opacity=128)
>>> brush = Brush(0)
>>> brush = Brush((0,0,0))
>>> brush = Brush("rgb(0,0,0)")
>>> brush = Brush("gold")
from aggdraw import Brush
Brush("black")
Brush("black", opacity=128)
"""
Brush(0)
Brush((0, 0, 0))
Brush("rgb(0, 0, 0)")
Brush("gold")
def test_graphics():
"""
from aggdraw import Draw, Pen, Brush
draw = Draw("RGB", (500, 500))
>>> draw = Draw("RGB", (500, 500))
pen = Pen("black")
brush = Brush("black")
>>> pen = Pen("black")
>>> brush = Brush("black")
draw.line((50, 50, 100, 100), pen)
>>> draw.line((50, 50, 100, 100), pen)
draw.rectangle((50, 150, 100, 200), pen)
draw.rectangle((50, 220, 100, 270), brush)
draw.rectangle((50, 290, 100, 340), brush, pen)
draw.rectangle((50, 360, 100, 410), pen, brush)
>>> draw.rectangle((50, 150, 100, 200), pen)
>>> draw.rectangle((50, 220, 100, 270), brush)
>>> draw.rectangle((50, 290, 100, 340), brush, pen)
>>> draw.rectangle((50, 360, 100, 410), pen, brush)
draw.ellipse((120, 150, 170, 200), pen)
draw.ellipse((120, 220, 170, 270), brush)
draw.ellipse((120, 290, 170, 340), brush, pen)
draw.ellipse((120, 360, 170, 410), pen, brush)
>>> draw.ellipse((120, 150, 170, 200), pen)
>>> draw.ellipse((120, 220, 170, 270), brush)
>>> draw.ellipse((120, 290, 170, 340), brush, pen)
>>> draw.ellipse((120, 360, 170, 410), pen, brush)
>>> draw.polygon((190+25, 150, 190, 200, 190+50, 200), pen)
>>> draw.polygon((190+25, 220, 190, 270, 190+50, 270), brush)
>>> draw.polygon((190+25, 290, 190, 340, 190+50, 340), brush, pen)
>>> draw.polygon((190+25, 360, 190, 410, 190+50, 410), pen, brush)
"""
draw.polygon((190+25, 150, 190, 200, 190+50, 200), pen)
draw.polygon((190+25, 220, 190, 270, 190+50, 270), brush)
draw.polygon((190+25, 290, 190, 340, 190+50, 340), brush, pen)
draw.polygon((190+25, 360, 190, 410, 190+50, 410), pen, brush)
def test_graphics2():
"""See issue #14
>>> symbol = Symbol("M400 200 L400 400")
>>> pen = Pen("red")
>>> image = Image.fromarray(np.zeros((800, 600, 3)), mode="RGB")
>>> canvas = Draw(image)
>>> canvas.symbol((0, 0), symbol, pen)
>>> image_pointer = canvas.flush()
>>> assert np.asarray(image).sum() == 50800
"""
"""See issue #14."""
from aggdraw import Draw, Symbol, Pen
from PIL import Image
import numpy as np
symbol = Symbol("M400 200 L400 400")
pen = Pen("red")
image = Image.fromarray(np.zeros((800, 600, 3)), mode="RGB")
canvas = Draw(image)
canvas.symbol((0, 0), symbol, pen)
canvas.flush()
assert np.asarray(image).sum() == 50800
def test_graphics3():
"""See issue #22
>>> main = Image.new('RGB', (480, 1024), 'white')
>>> d = aggdraw.Draw(main)
>>> p = aggdraw.Pen((90,) * 3, 0.5)
"""
"""See issue #22."""
from aggdraw import Draw, Pen
from PIL import Image
main = Image.new('RGB', (480, 1024), 'white')
d = Draw(main)
p = Pen((90,) * 3, 0.5)
def test_path():
"""
>>> p = Path()
>>> p = Path([0,0])
>>> p = Path([0,0,0,0])
from aggdraw import Draw, Path
Path()
Path([0, 0])
Path([0, 0, 0, 0])
>>> p = Path()
>>> p.moveto(0, 0)
>>> p.lineto(1, 1)
>>> p.coords()
[0.0, 0.0, 1.0, 1.0]
p = Path()
p.moveto(0, 0)
p.lineto(1, 1)
assert p.coords() == [0.0, 0.0, 1.0, 1.0]
>>> p.curveto(0, 0, 0, 0, 0, 0)
>>> p.close()
>>> p.coords()
[0.0, 0.0, 1.0, 1.0, 0.125, 0.125, 0.0, 0.0]
p.curveto(0, 0, 0, 0, 0, 0)
p.close()
p.coords()
assert p.coords() == [0.0, 0.0, 1.0, 1.0, 0.125, 0.125, 0.0, 0.0]
>>> draw = Draw("RGB", (800, 600))
>>> draw.line(p)
>>> draw.polygon(p)
>>> draw.symbol((0, 0), p)
"""
draw = Draw("RGB", (800, 600))
draw.line(p)
draw.polygon(p)
draw.symbol((0, 0), p)
def test_symbol():
"""
>>> s = Symbol("M0,0L0,0L0,0L0,0Z")
>>> s = Symbol("M0,0L0,0,0,0,0,0Z", 10)
>>> s = Symbol("M0,0C0,0,0,0,0,0Z")
>>> s = Symbol("M0,0S0,0,0,0,0,0Z")
from aggdraw import Symbol
Symbol("M0,0L0,0L0,0L0,0Z")
Symbol("M0,0L0,0,0,0,0,0Z", 10)
Symbol("M0,0C0,0,0,0,0,0Z")
Symbol("M0,0S0,0,0,0,0,0Z")
>>> s = Symbol("m0,0l0,0l0,0l0,0z")
>>> s = Symbol("m0,0l0,0,0,0,0,0z", 10)
>>> s = Symbol("m0,0c0,0,0,0,0,0z")
>>> s = Symbol("m0,0s0,0,0,0,0,0z")
"""
Symbol("m0,0l0,0l0,0l0,0z")
Symbol("m0,0l0,0,0,0,0,0z", 10)
Symbol("m0,0c0,0,0,0,0,0z")
Symbol("m0,0s0,0,0,0,0,0z")
def test_transform():
"""
>>> draw = Draw("RGB", (500, 500))
>>> draw.settransform()
>>> draw.settransform((250, 250))
>>> draw.settransform((1, 0, 250, 0, 1, 250))
>>> draw.settransform((2.0, 0.5, 250, 0.5, 2.0, 250))
>>> draw.settransform()
from aggdraw import Draw
draw = Draw("RGB", (500, 500))
"""
draw.settransform()
draw.settransform((250, 250))
draw.settransform((1, 0, 250, 0, 1, 250))
draw.settransform((2.0, 0.5, 250, 0.5, 2.0, 250))
draw.settransform()
if __name__ == "__main__":
# use doctest to make sure the test program behaves as documented!
import sys, doctest, selftest
status = doctest.testmod(selftest)
if status[0]:
print("*** %s tests of %d failed." % status)
else:
print("%s tests passed." % status[1])
sys.exit(int(status[0]))
import sys
sys.exit(pytest.main(sys.argv))
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Setup script for aggdraw
#
......@@ -14,13 +15,16 @@ from __future__ import print_function
import os
import sys
import subprocess
import platform
from distutils.sysconfig import get_config_var
from distutils.version import LooseVersion
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
VERSION = "1.3.9"
VERSION = "1.3.10"
SUMMARY = "High quality drawing interface for PIL."
......@@ -34,6 +38,22 @@ with the WCK renderer.
"""
def is_platform_mac():
return sys.platform == 'darwin'
# For mac, ensure extensions are built for macos 10.9 when compiling on a
# 10.9 system or above, overriding distuitls behaviour which is to target
# the version that python was built for. This may be overridden by setting
# MACOSX_DEPLOYMENT_TARGET before calling setup.py
if is_platform_mac():
if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
current_system = LooseVersion(platform.mac_ver()[0])
python_target = LooseVersion(get_config_var('MACOSX_DEPLOYMENT_TARGET'))
if python_target < '10.9' and current_system >= '10.9':
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
def _get_freetype_config():
print("Trying freetype-config to find freetype library...")
try:
......@@ -150,5 +170,5 @@ setup(
)
],
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
tests_require=['pillow'],
tests_require=['pillow', 'pytest'],
)