[Python-modules-commits] [python-pgmagick] 01/05: Imported Upstream version 0.6
Takaki Taniguchi
takaki at moszumanska.debian.org
Thu Nov 26 03:19:33 UTC 2015
This is an automated email from the git hooks/post-receive script.
takaki pushed a commit to branch master
in repository python-pgmagick.
commit b8a00d263b77004c8bf378320b46621e65904b21
Author: TANIGUCHI Takaki <takaki at asis.media-as.org>
Date: Thu Nov 26 11:06:37 2015 +0900
Imported Upstream version 0.6
---
PKG-INFO | 12 +++++++-----
README.rst | 10 ++++++----
pgmagick.egg-info/PKG-INFO | 12 +++++++-----
pgmagick/_version.py | 2 +-
pgmagick/api.py | 16 +++++++++++-----
setup.py | 24 +++++++++++++++++-------
src/_Image.cpp | 2 +-
src/_PathArcAbs.cpp | 2 +-
src/_PathArcRel.cpp | 2 +-
src/_PathCurvetoAbs.cpp | 2 +-
src/_PathCurvetoRel.cpp | 2 +-
src/_PathLinetoAbs.cpp | 2 +-
src/_PathLinetoRel.cpp | 2 +-
src/_PathMovetoAbs.cpp | 2 +-
src/_PathMovetoRel.cpp | 2 +-
src/_PathQuadraticCurvetoAbs.cpp | 2 +-
src/_PathQuadraticCurvetoRel.cpp | 2 +-
src/_PathSmoothCurvetoAbs.cpp | 2 +-
src/_PathSmoothCurvetoRel.cpp | 2 +-
src/_PathSmoothQuadraticCurvetoAbs.cpp | 2 +-
src/_PathSmoothQuadraticCurvetoRel.cpp | 2 +-
src/_STL.cpp | 4 ++--
src/_VPath.cpp | 6 ++++++
src/_gminfo.cpp | 23 ++++++++---------------
src/_main.cpp | 2 +-
test/test_cookbook.py | 28 +++++++++++++++++++++++-----
test/test_pgmagick_api.py | 12 +++++++++---
27 files changed, 113 insertions(+), 68 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 1dc16e5..cff799c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pgmagick
-Version: 0.5.12
+Version: 0.6
Summary: Yet Another Python wrapper for GraphicsMagick
Home-page: http://bitbucket.org/hhatto/pgmagick
Author: Hideo Hattori
@@ -9,8 +9,8 @@ License: MIT
Description: About
=====
- .. image:: https://drone.io/bitbucket.org/hhatto/pgmagick/status.png
- :target: https://drone.io/bitbucket.org/hhatto/pgmagick
+ .. image:: https://travis-ci.org/hhatto/pgmagick.svg?branch=master
+ :target: https://travis-ci.org/hhatto/pgmagick
:alt: Build status
pgmagick is a yet another boost.python based wrapper for GraphicsMagick.
@@ -172,11 +172,13 @@ Description: About
Links
=====
* PyPI_
- * bitbucket_
+ * `Project Page`_
+ * `Project Page (Old)`_
* `CI(Jenkins)`_
.. _PyPI: http://pypi.python.org/pypi/pgmagick/
- .. _bitbucket: https://bitbucket.org/hhatto/pgmagick/
+ .. _`Project Page`: https://github.com/hhatto/pgmagick/
+ .. _`Project Page (Old)`: https://bitbucket.org/hhatto/pgmagick/
.. _`CI(Jenkins)`: http://jenkins.hexacosa.net/job/pgmagick/
Keywords: GraphicsMagick ImageMagick graphics boost image
diff --git a/README.rst b/README.rst
index 30ce5aa..8132d07 100644
--- a/README.rst
+++ b/README.rst
@@ -1,8 +1,8 @@
About
=====
-.. image:: https://drone.io/bitbucket.org/hhatto/pgmagick/status.png
- :target: https://drone.io/bitbucket.org/hhatto/pgmagick
+.. image:: https://travis-ci.org/hhatto/pgmagick.svg?branch=master
+ :target: https://travis-ci.org/hhatto/pgmagick
:alt: Build status
pgmagick is a yet another boost.python based wrapper for GraphicsMagick.
@@ -164,9 +164,11 @@ Python APIs(*NOTICE!! this api is alpha version!!*)::
Links
=====
* PyPI_
-* bitbucket_
+* `Project Page`_
+* `Project Page (Old)`_
* `CI(Jenkins)`_
.. _PyPI: http://pypi.python.org/pypi/pgmagick/
-.. _bitbucket: https://bitbucket.org/hhatto/pgmagick/
+.. _`Project Page`: https://github.com/hhatto/pgmagick/
+.. _`Project Page (Old)`: https://bitbucket.org/hhatto/pgmagick/
.. _`CI(Jenkins)`: http://jenkins.hexacosa.net/job/pgmagick/
diff --git a/pgmagick.egg-info/PKG-INFO b/pgmagick.egg-info/PKG-INFO
index 1dc16e5..cff799c 100644
--- a/pgmagick.egg-info/PKG-INFO
+++ b/pgmagick.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pgmagick
-Version: 0.5.12
+Version: 0.6
Summary: Yet Another Python wrapper for GraphicsMagick
Home-page: http://bitbucket.org/hhatto/pgmagick
Author: Hideo Hattori
@@ -9,8 +9,8 @@ License: MIT
Description: About
=====
- .. image:: https://drone.io/bitbucket.org/hhatto/pgmagick/status.png
- :target: https://drone.io/bitbucket.org/hhatto/pgmagick
+ .. image:: https://travis-ci.org/hhatto/pgmagick.svg?branch=master
+ :target: https://travis-ci.org/hhatto/pgmagick
:alt: Build status
pgmagick is a yet another boost.python based wrapper for GraphicsMagick.
@@ -172,11 +172,13 @@ Description: About
Links
=====
* PyPI_
- * bitbucket_
+ * `Project Page`_
+ * `Project Page (Old)`_
* `CI(Jenkins)`_
.. _PyPI: http://pypi.python.org/pypi/pgmagick/
- .. _bitbucket: https://bitbucket.org/hhatto/pgmagick/
+ .. _`Project Page`: https://github.com/hhatto/pgmagick/
+ .. _`Project Page (Old)`: https://bitbucket.org/hhatto/pgmagick/
.. _`CI(Jenkins)`: http://jenkins.hexacosa.net/job/pgmagick/
Keywords: GraphicsMagick ImageMagick graphics boost image
diff --git a/pgmagick/_version.py b/pgmagick/_version.py
index dd9570a..27fda16 100644
--- a/pgmagick/_version.py
+++ b/pgmagick/_version.py
@@ -1 +1 @@
-__version__ = '0.5.12'
+__version__ = '0.6'
diff --git a/pgmagick/api.py b/pgmagick/api.py
index d36633c..f013c10 100644
--- a/pgmagick/api.py
+++ b/pgmagick/api.py
@@ -542,6 +542,7 @@ class Image(object):
self.img = pgmagick.Image(geometry, color)
else:
self.img = pgmagick.Image(geometry, pgmagick.Color())
+ self.img.write(pgmagick.Blob(), 'MIFF')
else:
self.img = pgmagick.Image()
@@ -618,6 +619,7 @@ class Image(object):
def composite(self, composite_img, offset,
compose=pgmagick.CompositeOperator.InCompositeOp):
+ img = composite_img.img if type(composite_img) == Image else composite_img
if isinstance(offset, (list, tuple)):
x = int(offset[0])
y = int(offset[1])
@@ -640,7 +642,7 @@ class Image(object):
else: # other string
compose = getattr(pgmagick.CompositeOperator,
"%sCompositeOp" % compose.title())
- self.img.composite(composite_img, offset, compose)
+ self.img.composite(img, offset, compose)
def contrast(self, sharpen):
# TODO: not implemented
@@ -783,12 +785,16 @@ class Draw(object):
def composite(self, x, y, width, height, image,
op=pgmagick.CompositeOperator.OverCompositeOp):
- # FIXME: unable to composite pgmagick.Image object.
+ if type(image) == Image:
+ img = image.img
+ else:
+ img = image
if width == 0 or height == 0:
- composite = pgmagick.DrawableCompositeImage(x, y, image)
+ composite = pgmagick.DrawableCompositeImage(float(x), float(y), img)
else:
- composite = pgmagick.DrawableCompositeImage(x, y, width, height,
- image, op)
+ composite = pgmagick.DrawableCompositeImage(float(x), float(y),
+ float(width), float(height),
+ img, op)
self.drawer.append(composite)
def ellipse(self, org_x, org_y, radius_x, radius_y, arc_start, arc_end):
diff --git a/setup.py b/setup.py
index 1ccac98..c7102ca 100644
--- a/setup.py
+++ b/setup.py
@@ -4,6 +4,8 @@ import glob
import os
import re
import sys
+import ast
+import io
GMCPP_PC = 'GraphicsMagick++.pc'
IMCPP_PC = 'ImageMagick++.pc'
@@ -82,16 +84,16 @@ include_dirs.append(header_path)
# find to library path for boost_python
# TODO: only test on Ubuntu11.10
-_version = sys.version_info
+_python_version = sys.version_info
boost_lib_target_files = []
-if _version >= (3, ):
- boost_lib_target_files.append("boost_python-py%s%s" % (_version[0], _version[1]))
+if _python_version >= (3, ):
+ boost_lib_target_files.append("boost_python-py%s%s" % (_python_version[0], _python_version[1]))
# ArchLinux uses boost_python3
boost_lib_target_files.append("boost_python3")
-boost_lib_target_files.append("boost_python-mt-py%s%s" % (_version[0], _version[1]))
+boost_lib_target_files.append("boost_python-mt-py%s%s" % (_python_version[0], _python_version[1]))
# gentoo appends the python version numbers to the boost_python libraries
-boost_lib_target_files.append("boost_python-%s.%s" % (_version[0], _version[1]))
+boost_lib_target_files.append("boost_python-%s.%s" % (_python_version[0], _python_version[1]))
boost_lib_target_files.append("boost_python-mt")
for boost_lib in boost_lib_target_files:
@@ -129,6 +131,7 @@ else:
if not _version:
_version = get_version_from_devheaders(include_dirs)
if _version:
+ _str_version = _version
print("%s version: %s" % (LIBRARY, _version))
_version = list(map(int, _version.split('.')))
if len(_version) == 2:
@@ -159,13 +162,20 @@ if _version:
ext_compile_args = ["-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x"]
elif LIBRARY == 'ImageMagick':
ext_compile_args = ["-DPGMAGICK_LIB_IMAGEMAGICK"]
+ ext_compile_args.append("-D_LIBRARY_VERSION=\"%s\"" % (_str_version))
else:
_version = '%s version: ???' % (LIBRARY)
-exec(open('pgmagick/_version.py').read())
+
+def version():
+ """Return version string."""
+ with io.open('pgmagick/_version.py') as input_file:
+ for line in input_file:
+ if line.startswith('__version__'):
+ return ast.parse(line).body[0].value.s
setup(name='pgmagick',
- version=__version__,
+ version=version(),
description="Yet Another Python wrapper for GraphicsMagick",
long_description=open('README.rst').read(),
author='Hideo Hattori',
diff --git a/src/_Image.cpp b/src/_Image.cpp
index e354e89..5270dc9 100644
--- a/src/_Image.cpp
+++ b/src/_Image.cpp
@@ -540,7 +540,7 @@ void __Image()
.def("writePixels", &Magick::Image::writePixels)
/* no user-serviceable parts */
.def("modifyImage", &Magick::Image::modifyImage)
-#ifndef PGMAGICK_LIB_GRAPHICSMAGICK_1_3_20
+#if !defined(PGMAGICK_LIB_GRAPHICSMAGICK_1_3_20) && !defined(PGMAGICK_LIB_GRAPHICSMAGICK_1_3_22)
.def("throwImageException", &Magick::Image::throwImageException)
#endif
.def("registerId", &Magick::Image::registerId)
diff --git a/src/_PathArcAbs.cpp b/src/_PathArcAbs.cpp
index 81fb89d..973e44a 100644
--- a/src/_PathArcAbs.cpp
+++ b/src/_PathArcAbs.cpp
@@ -29,7 +29,7 @@ struct Magick_PathArcAbs_Wrapper: Magick::PathArcAbs
void __PathArcAbs()
{
- class_< Magick::PathArcAbs, Magick_PathArcAbs_Wrapper >("PathArcAbs", init< const Magick::PathArcArgs& >())
+ class_< Magick::PathArcAbs, bases<Magick::VPathBase>, Magick_PathArcAbs_Wrapper >("PathArcAbs", init< const Magick::PathArcArgs& >())
.def(init< const Magick::PathArcArgsList& >())
.def(init< const Magick::PathArcAbs& >())
;
diff --git a/src/_PathArcRel.cpp b/src/_PathArcRel.cpp
index 1f6d4a7..04c31b4 100644
--- a/src/_PathArcRel.cpp
+++ b/src/_PathArcRel.cpp
@@ -29,7 +29,7 @@ struct Magick_PathArcRel_Wrapper: Magick::PathArcRel
void __PathArcRel()
{
- class_< Magick::PathArcRel, Magick_PathArcRel_Wrapper >("PathArcRel", init< const Magick::PathArcArgs& >())
+ class_< Magick::PathArcRel, bases<Magick::VPathBase>, Magick_PathArcRel_Wrapper >("PathArcRel", init< const Magick::PathArcArgs& >())
.def(init< const Magick::PathArcArgsList& >())
.def(init< const Magick::PathArcRel& >())
;
diff --git a/src/_PathCurvetoAbs.cpp b/src/_PathCurvetoAbs.cpp
index 757c5ba..3b8a71b 100644
--- a/src/_PathCurvetoAbs.cpp
+++ b/src/_PathCurvetoAbs.cpp
@@ -29,7 +29,7 @@ struct Magick_PathCurvetoAbs_Wrapper: Magick::PathCurvetoAbs
void __PathCurvetoAbs()
{
- class_< Magick::PathCurvetoAbs, Magick_PathCurvetoAbs_Wrapper >("PathCurvetoAbs", init< const Magick::PathCurvetoArgs& >())
+ class_< Magick::PathCurvetoAbs, bases<Magick::VPathBase>, Magick_PathCurvetoAbs_Wrapper >("PathCurvetoAbs", init< const Magick::PathCurvetoArgs& >())
.def(init< const Magick::PathCurveToArgsList& >())
.def(init< const Magick::PathCurvetoAbs& >())
;
diff --git a/src/_PathCurvetoRel.cpp b/src/_PathCurvetoRel.cpp
index 4ed8c21..a84c669 100644
--- a/src/_PathCurvetoRel.cpp
+++ b/src/_PathCurvetoRel.cpp
@@ -29,7 +29,7 @@ struct Magick_PathCurvetoRel_Wrapper: Magick::PathCurvetoRel
void __PathCurvetoRel()
{
- class_< Magick::PathCurvetoRel, Magick_PathCurvetoRel_Wrapper >("PathCurvetoRel", init< const Magick::PathCurvetoArgs& >())
+ class_< Magick::PathCurvetoRel, bases<Magick::VPathBase>, Magick_PathCurvetoRel_Wrapper >("PathCurvetoRel", init< const Magick::PathCurvetoArgs& >())
.def(init< const Magick::PathCurveToArgsList& >())
.def(init< const Magick::PathCurvetoRel& >())
;
diff --git a/src/_PathLinetoAbs.cpp b/src/_PathLinetoAbs.cpp
index 3b84f14..01477ba 100644
--- a/src/_PathLinetoAbs.cpp
+++ b/src/_PathLinetoAbs.cpp
@@ -29,7 +29,7 @@ struct Magick_PathLinetoAbs_Wrapper: Magick::PathLinetoAbs
void __PathLinetoAbs()
{
- class_< Magick::PathLinetoAbs, Magick_PathLinetoAbs_Wrapper >("PathLinetoAbs", init< const Magick::Coordinate& >())
+ class_< Magick::PathLinetoAbs, bases<Magick::VPathBase>, Magick_PathLinetoAbs_Wrapper >("PathLinetoAbs", init< const Magick::Coordinate& >())
.def(init< const Magick::CoordinateList& >())
.def(init< const Magick::PathLinetoAbs& >())
;
diff --git a/src/_PathLinetoRel.cpp b/src/_PathLinetoRel.cpp
index 273d71b..076ec3f 100644
--- a/src/_PathLinetoRel.cpp
+++ b/src/_PathLinetoRel.cpp
@@ -29,7 +29,7 @@ struct Magick_PathLinetoRel_Wrapper: Magick::PathLinetoRel
void __PathLinetoRel()
{
- class_< Magick::PathLinetoRel, Magick_PathLinetoRel_Wrapper >("PathLinetoRel", init< const Magick::Coordinate& >())
+ class_< Magick::PathLinetoRel, bases<Magick::VPathBase>, Magick_PathLinetoRel_Wrapper >("PathLinetoRel", init< const Magick::Coordinate& >())
.def(init< const Magick::CoordinateList& >())
.def(init< const Magick::PathLinetoRel& >())
;
diff --git a/src/_PathMovetoAbs.cpp b/src/_PathMovetoAbs.cpp
index a7e390e..8a1618c 100644
--- a/src/_PathMovetoAbs.cpp
+++ b/src/_PathMovetoAbs.cpp
@@ -29,7 +29,7 @@ struct Magick_PathMovetoAbs_Wrapper: Magick::PathMovetoAbs
void __PathMovetoAbs()
{
- class_< Magick::PathMovetoAbs, Magick_PathMovetoAbs_Wrapper >("PathMovetoAbs", init< const Magick::Coordinate& >())
+ class_< Magick::PathMovetoAbs, bases<Magick::VPathBase>, Magick_PathMovetoAbs_Wrapper >("PathMovetoAbs", init< const Magick::Coordinate& >())
.def(init< const Magick::CoordinateList& >())
.def(init< const Magick::PathMovetoAbs& >())
;
diff --git a/src/_PathMovetoRel.cpp b/src/_PathMovetoRel.cpp
index 2c444fb..84a9c08 100644
--- a/src/_PathMovetoRel.cpp
+++ b/src/_PathMovetoRel.cpp
@@ -29,7 +29,7 @@ struct Magick_PathMovetoRel_Wrapper: Magick::PathMovetoRel
void __PathMovetoRel()
{
- class_< Magick::PathMovetoRel, Magick_PathMovetoRel_Wrapper >("PathMovetoRel", init< const Magick::Coordinate& >())
+ class_< Magick::PathMovetoRel, bases<Magick::VPathBase>, Magick_PathMovetoRel_Wrapper >("PathMovetoRel", init< const Magick::Coordinate& >())
.def(init< const Magick::CoordinateList& >())
.def(init< const Magick::PathMovetoRel& >())
;
diff --git a/src/_PathQuadraticCurvetoAbs.cpp b/src/_PathQuadraticCurvetoAbs.cpp
index 4147c5a..372f99a 100644
--- a/src/_PathQuadraticCurvetoAbs.cpp
+++ b/src/_PathQuadraticCurvetoAbs.cpp
@@ -29,7 +29,7 @@ struct Magick_PathQuadraticCurvetoAbs_Wrapper: Magick::PathQuadraticCurvetoAbs
void __PathQuadraticCurvetoAbs()
{
- class_< Magick::PathQuadraticCurvetoAbs, Magick_PathQuadraticCurvetoAbs_Wrapper >("PathQuadraticCurvetoAbs", init< const Magick::PathQuadraticCurvetoArgs& >())
+ class_< Magick::PathQuadraticCurvetoAbs, bases<Magick::VPathBase>, Magick_PathQuadraticCurvetoAbs_Wrapper >("PathQuadraticCurvetoAbs", init< const Magick::PathQuadraticCurvetoArgs& >())
.def(init< const Magick::PathQuadraticCurvetoArgsList& >())
.def(init< const Magick::PathQuadraticCurvetoAbs& >())
;
diff --git a/src/_PathQuadraticCurvetoRel.cpp b/src/_PathQuadraticCurvetoRel.cpp
index fbfa801..bb2cdb4 100644
--- a/src/_PathQuadraticCurvetoRel.cpp
+++ b/src/_PathQuadraticCurvetoRel.cpp
@@ -29,7 +29,7 @@ struct Magick_PathQuadraticCurvetoRel_Wrapper: Magick::PathQuadraticCurvetoRel
void __PathQuadraticCurvetoRel()
{
- class_< Magick::PathQuadraticCurvetoRel, Magick_PathQuadraticCurvetoRel_Wrapper >("PathQuadraticCurvetoRel", init< const Magick::PathQuadraticCurvetoArgs& >())
+ class_< Magick::PathQuadraticCurvetoRel, bases<Magick::VPathBase>, Magick_PathQuadraticCurvetoRel_Wrapper >("PathQuadraticCurvetoRel", init< const Magick::PathQuadraticCurvetoArgs& >())
.def(init< const Magick::PathQuadraticCurvetoArgsList& >())
.def(init< const Magick::PathQuadraticCurvetoRel& >())
;
diff --git a/src/_PathSmoothCurvetoAbs.cpp b/src/_PathSmoothCurvetoAbs.cpp
index 0898f34..dc985af 100644
--- a/src/_PathSmoothCurvetoAbs.cpp
+++ b/src/_PathSmoothCurvetoAbs.cpp
@@ -29,7 +29,7 @@ struct Magick_PathSmoothCurvetoAbs_Wrapper: Magick::PathSmoothCurvetoAbs
void __PathSmoothCurvetoAbs()
{
- class_< Magick::PathSmoothCurvetoAbs, Magick_PathSmoothCurvetoAbs_Wrapper >("PathSmoothCurvetoAbs", init< const Magick::Coordinate& >())
+ class_< Magick::PathSmoothCurvetoAbs, bases<Magick::VPathBase>, Magick_PathSmoothCurvetoAbs_Wrapper >("PathSmoothCurvetoAbs", init< const Magick::Coordinate& >())
.def(init< const Magick::CoordinateList& >())
.def(init< const Magick::PathSmoothCurvetoAbs& >())
;
diff --git a/src/_PathSmoothCurvetoRel.cpp b/src/_PathSmoothCurvetoRel.cpp
index 60e262f..ccd5b4b 100644
--- a/src/_PathSmoothCurvetoRel.cpp
+++ b/src/_PathSmoothCurvetoRel.cpp
@@ -29,7 +29,7 @@ struct Magick_PathSmoothCurvetoRel_Wrapper: Magick::PathSmoothCurvetoRel
void __PathSmoothCurvetoRel()
{
- class_< Magick::PathSmoothCurvetoRel, Magick_PathSmoothCurvetoRel_Wrapper >("PathSmoothCurvetoRel", init< const Magick::Coordinate& >())
+ class_< Magick::PathSmoothCurvetoRel, bases<Magick::VPathBase>, Magick_PathSmoothCurvetoRel_Wrapper >("PathSmoothCurvetoRel", init< const Magick::Coordinate& >())
.def(init< const Magick::CoordinateList& >())
.def(init< const Magick::PathSmoothCurvetoRel& >())
;
diff --git a/src/_PathSmoothQuadraticCurvetoAbs.cpp b/src/_PathSmoothQuadraticCurvetoAbs.cpp
index c1f578c..0c88e91 100644
--- a/src/_PathSmoothQuadraticCurvetoAbs.cpp
+++ b/src/_PathSmoothQuadraticCurvetoAbs.cpp
@@ -29,7 +29,7 @@ struct Magick_PathSmoothQuadraticCurvetoAbs_Wrapper: Magick::PathSmoothQuadratic
void __PathSmoothQuadraticCurvetoAbs()
{
- class_< Magick::PathSmoothQuadraticCurvetoAbs, Magick_PathSmoothQuadraticCurvetoAbs_Wrapper >("PathSmoothQuadraticCurvetoAbs", init< const Magick::Coordinate& >())
+ class_< Magick::PathSmoothQuadraticCurvetoAbs, bases<Magick::VPathBase>, Magick_PathSmoothQuadraticCurvetoAbs_Wrapper >("PathSmoothQuadraticCurvetoAbs", init< const Magick::Coordinate& >())
.def(init< const Magick::CoordinateList& >())
.def(init< const Magick::PathSmoothQuadraticCurvetoAbs& >())
;
diff --git a/src/_PathSmoothQuadraticCurvetoRel.cpp b/src/_PathSmoothQuadraticCurvetoRel.cpp
index d54a975..488fb85 100644
--- a/src/_PathSmoothQuadraticCurvetoRel.cpp
+++ b/src/_PathSmoothQuadraticCurvetoRel.cpp
@@ -29,7 +29,7 @@ struct Magick_PathSmoothQuadraticCurvetoRel_Wrapper: Magick::PathSmoothQuadratic
void __PathSmoothQuadraticCurvetoRel()
{
- class_< Magick::PathSmoothQuadraticCurvetoRel, Magick_PathSmoothQuadraticCurvetoRel_Wrapper >("PathSmoothQuadraticCurvetoRel", init< const Magick::Coordinate& >())
+ class_< Magick::PathSmoothQuadraticCurvetoRel, bases<Magick::VPathBase>, Magick_PathSmoothQuadraticCurvetoRel_Wrapper >("PathSmoothQuadraticCurvetoRel", init< const Magick::Coordinate& >())
.def(init< const Magick::CoordinateList& >())
.def(init< const Magick::PathSmoothQuadraticCurvetoRel& >())
;
diff --git a/src/_STL.cpp b/src/_STL.cpp
index 6e7af92..c0cccae 100644
--- a/src/_STL.cpp
+++ b/src/_STL.cpp
@@ -113,8 +113,8 @@ void __STL()
{
class_< _ImageList >("ImageList", init< >())
.def("__len__", &_ImageList::_length)
- .def("__getitem__", (Magick::Image (_ImageList::*)(const unsigned int))&_ImageList::_get)
- .def("__iter__", range(&_ImageList::_begin, &_ImageList::_end))
+ .def("__getitem__", (Magick::Image (_ImageList::*)(const unsigned int))&_ImageList::_get)
+ .def("__iter__", range(&_ImageList::_begin, &_ImageList::_end))
.def("append", (void (_ImageList::*)(Magick::Image))&_ImageList::_append)
.def("appendImages", (void (_ImageList::*)(Magick::Image*))&_ImageList::_appendImages)
.def("coalesceImags", (void (_ImageList::*)(void))&_ImageList::_coalesceImages)
diff --git a/src/_VPath.cpp b/src/_VPath.cpp
index 2be667b..a6b8e2b 100644
--- a/src/_VPath.cpp
+++ b/src/_VPath.cpp
@@ -4,11 +4,17 @@
#include <Magick++/Drawable.h>
#include <Magick++.h>
+using namespace boost;
using namespace boost::python;
void __VPath()
{
+ implicitly_convertible< Magick::VPathBase, Magick::VPath >();
+
+ class_< Magick::VPathBase, noncopyable >("VPathBase", no_init)
+ ;
+
class_< Magick::VPath >("VPath", init< >())
.def(init< const Magick::VPathBase& >())
.def(init< const Magick::VPath& >())
diff --git a/src/_gminfo.cpp b/src/_gminfo.cpp
index 93b18b3..6a63a8a 100644
--- a/src/_gminfo.cpp
+++ b/src/_gminfo.cpp
@@ -2,26 +2,19 @@
using namespace boost::python;
-#define _LIB_VERSION "1.1.x"
#define _LIB_NAME "GraphicsMagick"
-#ifdef PGMAGICK_LIB_GRAPHICSMAGICK_1_3_x
- #undef _LIB_VERSION
- #define _LIB_VERSION "1.3.x"
-#endif
-#ifdef PGMAGICK_LIB_GRAPHICSMAGICK_1_3_19
- #undef _LIB_VERSION
- #define _LIB_VERSION "1.3.19"
-#endif
-#ifdef PGMAGICK_LIB_IMAGEMAGICK
- #undef _LIB_VERSION
- #define _LIB_VERSION "6.x.x"
- #undef _LIB_NAME
- #define _LIB_NAME "ImageMagick"
+#ifndef _LIBRARY_VERSION
+ #define _LIBRARY_VERSION "0.0.0"
+
+ #ifdef PGMAGICK_LIB_IMAGEMAGICK
+ #undef _LIB_NAME
+ #define _LIB_NAME "ImageMagick"
+ #endif
#endif
const char* get_version(void)
{
- return _LIB_VERSION;
+ return _LIBRARY_VERSION;
}
const char* get_library(void)
{
diff --git a/src/_main.cpp b/src/_main.cpp
index 6e3f3ff..00951df 100644
--- a/src/_main.cpp
+++ b/src/_main.cpp
@@ -121,6 +121,7 @@ BOOST_PYTHON_MODULE(_pgmagick)
__Coordinate();
__DecorationType();
__DistortImageMethod();
+ __VPath();
__Drawable();
__DrawableAffine();
__DrawableArc();
@@ -218,6 +219,5 @@ BOOST_PYTHON_MODULE(_pgmagick)
__STL();
__TypeMetric();
__VirtualPixelMethod();
- __VPath();
__gminfo();
}
diff --git a/test/test_cookbook.py b/test/test_cookbook.py
index 1b7ffc4..bbd04da 100644
--- a/test/test_cookbook.py
+++ b/test/test_cookbook.py
@@ -1,5 +1,6 @@
# coding: utf-8
import os.path
+import sys
import unittest
from pgmagick import api
from pgmagick import Image, Geometry, Blob
@@ -31,17 +32,25 @@ class TestCookbook(unittest.TestCase):
def test_annotate(self):
img = api.Image((300, 200))
+ if sys.platform.lower() == 'darwin':
+ img.font("/Library/Fonts/Arial.ttf")
img.annotate('Hello World')
img.write(self.tmp_filename_png)
def test_annotate_with_angle45(self):
img = api.Image((300, 200))
+ if sys.platform.lower() == 'darwin':
+ img.font("/Library/Fonts/Arial.ttf")
img.annotate('Hello World', angle=45)
img.write(self.tmp_filename_png)
def test_annotate_with_japanese_font(self):
img = api.Image((300, 200))
- img.font("/usr/share/fonts/truetype/ttf-japanese-gothic.ttf")
+ if sys.platform.lower() == 'darwin':
+ img.font("/System/Library/Fonts/Hiragino Sans GB W3.ttc")
+ else:
+ # TODO: not support windows
+ img.font("/usr/share/fonts/truetype/ttf-japanese-gothic.ttf")
img.annotate('ようこそpgmagickへ!!')
img.write(self.tmp_filename_png)
@@ -63,13 +72,22 @@ class TestCookbook(unittest.TestCase):
self.assertEqual(img2.width, 150)
self.assertEqual(img2.height, 100)
+ @unittest.skipIf(sys.version_info[0] == 3, "not support python3.x")
def test_scale_jpeg(self):
img = api.Image((400, 400), 'blue')
img.write(self.tmp_filename_jpg)
- img2 = Image(Blob(open(self.tmp_filename_jpg).read()),
- Geometry(200, 200))
- img2.scale('200x200')
- img2.write(self.tmp_filename_jpg)
+ with open(self.tmp_filename_jpg, 'rb') as fp:
+ b = Blob(str(fp.read()))
+ img2 = Image(b, Geometry(200, 200))
+ if sys.platform.lower() == 'darwin':
+ # NOTE: error occur when use '200x200' param
+ # -----------------------------------------------------
+ # RuntimeError: Magick: Application transferred too few
+ # scanlines (x.jpg) reported by coders/jpeg.c:344 (JPEGErrorHandler)
+ img2.scale('199x199')
+ else:
+ img2.scale('200x200')
+ img2.write(self.tmp_filename_jpg)
if __name__ == '__main__':
unittest.main()
diff --git a/test/test_pgmagick_api.py b/test/test_pgmagick_api.py
index cf69997..8e5ed12 100644
--- a/test/test_pgmagick_api.py
+++ b/test/test_pgmagick_api.py
@@ -2,9 +2,14 @@ import unittest
import sys
sys.path.append('../')
sys.path.append('./')
+import pgmagick
from pgmagick.api import Image, Draw
+print(pgmagick.gminfo().version)
+libgm_version = [int(v) for v in pgmagick.gminfo().version.split('.')]
+
+
class ImageTestCase(unittest.TestCase):
def setUp(self):
@@ -23,13 +28,13 @@ class ImageTestCase(unittest.TestCase):
img.write(unicode('unicode.jpg'))
def test_nonarg(self):
- im = Image()
+ Image()
def test_arg(self):
- im = Image((600, 400), 'red')
+ Image((600, 400), 'red')
def test_arg_float(self):
- im = Image((600.5, 400.4), 'red')
+ Image((600.5, 400.4), 'red')
def test_blur(self):
self.img.blur(2, 2.3)
@@ -336,6 +341,7 @@ class DrawTestCase(unittest.TestCase):
self.im.draw(self.d)
self.im.write('t.png')
+ @unittest.skipIf(libgm_version <= [1, 3, 12], "bug in gm version: %s" % str(libgm_version))
def test_stroke_linejoin(self):
self.d.stroke_color('lime')
self.d.stroke_linejoin('round')
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pgmagick.git
More information about the Python-modules-commits
mailing list