Issue using PythonMagick Drawable* requiring CoordinateList

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
bertieb
Posts: 1
Joined: 2014-02-14T09:31:08-07:00
Authentication code: 6789

Issue using PythonMagick Drawable* requiring CoordinateList

Post by bertieb »

Hi all, I would appreicate some guidance on the use of PythonMagick's Drawables. At the moment I am getting used to the API and have drawn a couple test shapes (eg circle). However, I am getting a C++ signature mismatch error when trying to use a class that requires Coordinates, such as DrawableBezier or DrawablePolygon.

For example, the test code:

Code: Select all

        img = PythonMagick.Image("512x512", "white")
        img.fillColor(PythonMagick.Color("#FF0000FF"))

        coord1 = PythonMagick.Coordinate(50,50)
        coord2 = PythonMagick.Coordinate(50,150)
        coord3 = PythonMagick.Coordinate(200,250)
        coord4 = PythonMagick.Coordinate(50,25)
        coordlist = [coord1, coord2, coord3, coord4]

        bezier = PythonMagick.DrawableBezier(coordlist)
        img.draw(bezier)

        img.write("test.png")
Fails with:

Code: Select all

Traceback (most recent call last):
  File "painter.py", line 49, in <module>
    bezier = PythonMagick.DrawableBezier(coordlist)
Boost.Python.ArgumentError: Python argument types in
    DrawableBezier.__init__(DrawableBezier, list)
did not match C++ signature:
    __init__(_object*, Magick::DrawableBezier)
    __init__(_object*, std::list<Magick::Coordinate, std::allocator<Magick::Coordinate> >)
I've had a look at the Magick++ documentation, which makes references to CoordinateList types (IIRC). I figured a python list of PythonMagick.Coordinate would be massaged to a std::list of Magick::Coordinates but perhaps this isn't happening? I freely admit to stabbing in the dark here!

Could someone point me in the right direction here? Part of the problem may be my unfamiliarity with Boost/C++ but the docs don't describe the use of Drawables and searches have turned up dry as well. Thanks in advance! :)
Post Reply