/* Generated by Cython 0.12.1 on Mon Apr 12 07:55:14 2010 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyString_Type                PyUnicode_Type
  #define PyString_CheckExact          PyUnicode_CheckExact
#else
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_CheckExact           PyString_CheckExact
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)

#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#else
  #define _USE_MATH_DEFINES
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API__potrace___potrace
#include "potracelib.h"
#include "stdlib.h"
#include "stdio.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"

#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #else
    #define CYTHON_INLINE 
  #endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString          PyString_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyString_AsString
#else
#define __Pyx_PyBytes_FromString          PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyBytes_AsString
#endif

#define __Pyx_PyBytes_FromUString(s)      __Pyx_PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)        ((unsigned char*) __Pyx_PyBytes_AsString(s))

#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

#if !defined(T_PYSSIZET)
#if PY_VERSION_HEX < 0x02050000
#define T_PYSSIZET T_INT
#elif !defined(T_LONGLONG)
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
#else
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
#endif
#endif


#if !defined(T_ULONGLONG)
#define __Pyx_T_UNSIGNED_INT(x) \
        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : -1))))
#else
#define __Pyx_T_UNSIGNED_INT(x) \
        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : \
        ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))))
#endif
#if !defined(T_LONGLONG)
#define __Pyx_T_SIGNED_INT(x) \
        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
        ((sizeof(x) == sizeof(int))   ? T_INT : \
        ((sizeof(x) == sizeof(long))  ? T_LONG : -1))))
#else
#define __Pyx_T_SIGNED_INT(x) \
        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
        ((sizeof(x) == sizeof(int))   ? T_INT : \
        ((sizeof(x) == sizeof(long))  ? T_LONG : \
        ((sizeof(x) == sizeof(PY_LONG_LONG))   ? T_LONGLONG : -1)))))
#endif

#define __Pyx_T_FLOATING(x) \
        ((sizeof(x) == sizeof(float)) ? T_FLOAT : \
        ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1))

#if !defined(T_SIZET)
#if !defined(T_ULONGLONG)
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
#else
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
#endif
#endif

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char **__pyx_f;


#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif

#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif

typedef npy_int8 __pyx_t_5numpy_int8_t;

typedef npy_int16 __pyx_t_5numpy_int16_t;

typedef npy_int32 __pyx_t_5numpy_int32_t;

typedef npy_int64 __pyx_t_5numpy_int64_t;

typedef npy_uint8 __pyx_t_5numpy_uint8_t;

typedef npy_uint16 __pyx_t_5numpy_uint16_t;

typedef npy_uint32 __pyx_t_5numpy_uint32_t;

typedef npy_uint64 __pyx_t_5numpy_uint64_t;

typedef npy_float32 __pyx_t_5numpy_float32_t;

typedef npy_float64 __pyx_t_5numpy_float64_t;

typedef npy_long __pyx_t_5numpy_int_t;

typedef npy_longlong __pyx_t_5numpy_long_t;

typedef npy_intp __pyx_t_5numpy_intp_t;

typedef npy_uintp __pyx_t_5numpy_uintp_t;

typedef npy_ulong __pyx_t_5numpy_uint_t;

typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

typedef npy_double __pyx_t_5numpy_float_t;

typedef npy_double __pyx_t_5numpy_double_t;

typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif

/* Type declarations */

typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

typedef npy_cdouble __pyx_t_5numpy_complex_t;

/* "/home/flupke/source/pypotrace/potrace/bezier.pxd":4
 * 
 * 
 * cdef np.ndarray bezier(np.ndarray p, int steps=?)             # <<<<<<<<<<<<<<
 * cdef np.ndarray adaptive_bezier(np.ndarray p)
 */

struct __pyx_opt_args_7potrace_6bezier_bezier {
  int __pyx_n;
  int steps;
};

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":213
 * 
 * 
 * cdef class CornerSegment:             # <<<<<<<<<<<<<<
 *     """
 *     Represents a corner segment in a :class:`Curve` object.
 */

struct __pyx_obj_7potrace_8_potrace_CornerSegment {
  PyObject_HEAD
  PyObject *c;
  PyObject *end_point;
  PyObject *is_corner;
};

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":155
 * 
 * 
 * cdef class State:             # <<<<<<<<<<<<<<
 *     """
 *     Stores a potrace state struct.
 */

struct __pyx_obj_7potrace_8_potrace_State {
  PyObject_HEAD
  struct potrace_state_s *po_state;
};

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":194
 * 
 * 
 * cdef class BezierSegment:             # <<<<<<<<<<<<<<
 *     """
 *     Represents a Bezier segment in a :class:`Curve` object.
 */

struct __pyx_obj_7potrace_8_potrace_BezierSegment {
  PyObject_HEAD
  PyObject *c1;
  PyObject *c2;
  PyObject *end_point;
  PyObject *is_corner;
};

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":312
 * 
 * 
 * cdef class Path:             # <<<<<<<<<<<<<<
 *     """
 *     Path objects store a list of :class:`Curve` objects.
 */

struct __pyx_obj_7potrace_8_potrace_Path {
  PyObject_HEAD
  struct __pyx_vtabstruct_7potrace_8_potrace_Path *__pyx_vtab;
  PyObject *curves;
  PyObject *curves_tree;
};

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":230
 * 
 * 
 * cdef class Curve:             # <<<<<<<<<<<<<<
 *     """
 *     Curve objects represent closed, non intersecting curves.
 */

struct __pyx_obj_7potrace_8_potrace_Curve {
  PyObject_HEAD
  struct __pyx_vtabstruct_7potrace_8_potrace_Curve *__pyx_vtab;
  PyObject *segments;
  PyObject *children;
};

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":25
 * 
 * 
 * cdef class Bitmap:             # <<<<<<<<<<<<<<
 *     """
 *     Create a Bitmap instance.
 */

struct __pyx_obj_7potrace_8_potrace_Bitmap {
  PyObject_HEAD
  struct __pyx_vtabstruct_7potrace_8_potrace_Bitmap *__pyx_vtab;
  PyArrayObject *_data;
  struct potrace_bitmap_s po_bitmap;
};

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":134
 * 
 * 
 * cdef class Parameters:             # <<<<<<<<<<<<<<
 *     """
 *     Stores parameters for the potrace_trace function.
 */

struct __pyx_obj_7potrace_8_potrace_Parameters {
  PyObject_HEAD
  struct potrace_param_s *po_params;
};


/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":312
 * 
 * 
 * cdef class Path:             # <<<<<<<<<<<<<<
 *     """
 *     Path objects store a list of :class:`Curve` objects.
 */

struct __pyx_vtabstruct_7potrace_8_potrace_Path {
  PyObject *(*append_curve)(struct __pyx_obj_7potrace_8_potrace_Path *, struct potrace_curve_s *);
};
static struct __pyx_vtabstruct_7potrace_8_potrace_Path *__pyx_vtabptr_7potrace_8_potrace_Path;


/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":230
 * 
 * 
 * cdef class Curve:             # <<<<<<<<<<<<<<
 *     """
 *     Curve objects represent closed, non intersecting curves.
 */

struct __pyx_vtabstruct_7potrace_8_potrace_Curve {
  PyObject *(*append_bezier)(struct __pyx_obj_7potrace_8_potrace_Curve *, struct potrace_dpoint_s *, struct potrace_dpoint_s *, struct potrace_dpoint_s *);
  PyObject *(*append_corner)(struct __pyx_obj_7potrace_8_potrace_Curve *, struct potrace_dpoint_s *, struct potrace_dpoint_s *);
};
static struct __pyx_vtabstruct_7potrace_8_potrace_Curve *__pyx_vtabptr_7potrace_8_potrace_Curve;


/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":25
 * 
 * 
 * cdef class Bitmap:             # <<<<<<<<<<<<<<
 *     """
 *     Create a Bitmap instance.
 */

struct __pyx_vtabstruct_7potrace_8_potrace_Bitmap {
  PyObject *(*free_bitmap)(struct __pyx_obj_7potrace_8_potrace_Bitmap *);
};
static struct __pyx_vtabstruct_7potrace_8_potrace_Bitmap *__pyx_vtabptr_7potrace_8_potrace_Bitmap;

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
  end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
  }
  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
#else
  #define __Pyx_RefNannySetupContext(name)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
    const char* function_name, int kw_allowed); /*proto*/

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */

#define UNARY_NEG_WOULD_OVERFLOW(x)		(((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))


static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
    }
    return r;
}

static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (PyList_Append(L, x) < 0) return NULL;
        Py_INCREF(Py_None);
        return Py_None; /* this is just to have an accurate signature */
    }
    else {
        PyObject *r, *m;
        m = __Pyx_GetAttrString(L, "append");
        if (!m) return NULL;
        r = PyObject_CallFunctionObjArgs(m, x, NULL);
        Py_DECREF(m);
        return r;
    }
}

static CYTHON_INLINE int __Pyx_mod_int(int, int); /* proto */

static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */

#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \
                                                    __Pyx_SetItemInt_Generic(o, to_py_func(i), v))

static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}

static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) {
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        Py_INCREF(v);
        Py_DECREF(PyList_GET_ITEM(o, i));
        PyList_SET_ITEM(o, i, v);
        return 1;
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0)))
        return PySequence_SetItem(o, i, v);
    else {
        PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i);
        return __Pyx_SetItemInt_Generic(o, j, v);
    }
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void);

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif

#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eqf(a, b)   ((a)==(b))
    #define __Pyx_c_sumf(a, b)  ((a)+(b))
    #define __Pyx_c_difff(a, b) ((a)-(b))
    #define __Pyx_c_prodf(a, b) ((a)*(b))
    #define __Pyx_c_quotf(a, b) ((a)/(b))
    #define __Pyx_c_negf(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
    #define __Pyx_c_conjf(z)    (::std::conj(z))
    /*#define __Pyx_c_absf(z)     (::std::abs(z))*/
  #else
    #define __Pyx_c_is_zerof(z) ((z)==0)
    #define __Pyx_c_conjf(z)    (conjf(z))
    /*#define __Pyx_c_absf(z)     (cabsf(z))*/
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
    /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/
#endif

static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq(a, b)   ((a)==(b))
    #define __Pyx_c_sum(a, b)  ((a)+(b))
    #define __Pyx_c_diff(a, b) ((a)-(b))
    #define __Pyx_c_prod(a, b) ((a)*(b))
    #define __Pyx_c_quot(a, b) ((a)/(b))
    #define __Pyx_c_neg(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero(z) ((z)==(double)0)
    #define __Pyx_c_conj(z)    (::std::conj(z))
    /*#define __Pyx_c_abs(z)     (::std::abs(z))*/
  #else
    #define __Pyx_c_is_zero(z) ((z)==0)
    #define __Pyx_c_conj(z)    (conj(z))
    /*#define __Pyx_c_abs(z)     (cabs(z))*/
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
    /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static void __Pyx_WriteUnraisable(const char *name); /*proto*/

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict);  /*proto*/

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from python_buffer */

/* Module declarations from python_ref */

/* Module declarations from stdlib */

/* Module declarations from stdio */

/* Module declarations from numpy */

/* Module declarations from numpy */

static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/
/* Module declarations from python_string */

/* Module declarations from potrace.bezier */

static PyArrayObject *(*__pyx_f_7potrace_6bezier_bezier)(PyArrayObject *, struct __pyx_opt_args_7potrace_6bezier_bezier *__pyx_optional_args); /*proto*/
static PyArrayObject *(*__pyx_f_7potrace_6bezier_adaptive_bezier)(PyArrayObject *); /*proto*/
/* Module declarations from potrace._potrace */

static PyTypeObject *__pyx_ptype_7potrace_8_potrace_Bitmap = 0;
static PyTypeObject *__pyx_ptype_7potrace_8_potrace_Parameters = 0;
static PyTypeObject *__pyx_ptype_7potrace_8_potrace_State = 0;
static PyTypeObject *__pyx_ptype_7potrace_8_potrace_BezierSegment = 0;
static PyTypeObject *__pyx_ptype_7potrace_8_potrace_CornerSegment = 0;
static PyTypeObject *__pyx_ptype_7potrace_8_potrace_Curve = 0;
static PyTypeObject *__pyx_ptype_7potrace_8_potrace_Path = 0;
static int __pyx_v_7potrace_8_potrace_N;
static void __pyx_f_7potrace_8_potrace_setpixel(struct potrace_bitmap_s *, int, int, int); /*proto*/
static struct __pyx_obj_7potrace_8_potrace_State *__pyx_f_7potrace_8_potrace_state_from_ptr(struct potrace_state_s *); /*proto*/
static struct __pyx_obj_7potrace_8_potrace_Path *__pyx_f_7potrace_8_potrace_path_from_ptr(struct potrace_path_s *); /*proto*/
static PyObject *__pyx_f_7potrace_8_potrace_init_curves_tree(PyObject *, PyObject *, struct potrace_path_s *); /*proto*/
#define __Pyx_MODULE_NAME "potrace._potrace"
int __pyx_module_is_main_potrace___potrace = 0;

/* Implementation of potrace._potrace */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k_4[] = "error tracing bitmap";
static char __pyx_k_6[] = "can't query null state object";
static char __pyx_k_7[] = "can't access the image property of an incomplete trace state";
static char __pyx_k_8[] = "BezierSegment(c1=%s, c2=%s, end_point=%s)";
static char __pyx_k_9[] = "CornerSegment(c=%s, end_point=%s)";
static char __pyx_k_11[] = "ndarray is not C contiguous";
static char __pyx_k_12[] = "ndarray is not Fortran contiguous";
static char __pyx_k_13[] = "Non-native byte order not supported";
static char __pyx_k_14[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_15[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_16[] = "Format string allocated too short.";
static char __pyx_k_17[] = "\n        This property is true if this State object stores a successful\n        operation.\n        ";
static char __pyx_k_18[] = "\n        This property returns a Path containing a copy of this state's data.\n        ";
static char __pyx_k_19[] = "\n        The curve starting point.\n        ";
static char __pyx_k__B[] = "B";
static char __pyx_k__H[] = "H";
static char __pyx_k__I[] = "I";
static char __pyx_k__L[] = "L";
static char __pyx_k__O[] = "O";
static char __pyx_k__Q[] = "Q";
static char __pyx_k__b[] = "b";
static char __pyx_k__c[] = "c";
static char __pyx_k__d[] = "d";
static char __pyx_k__f[] = "f";
static char __pyx_k__g[] = "g";
static char __pyx_k__h[] = "h";
static char __pyx_k__i[] = "i";
static char __pyx_k__l[] = "l";
static char __pyx_k__n[] = "n";
static char __pyx_k__q[] = "q";
static char __pyx_k__w[] = "w";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
static char __pyx_k__Zd[] = "Zd";
static char __pyx_k__Zf[] = "Zf";
static char __pyx_k__Zg[] = "Zg";
static char __pyx_k__c1[] = "c1";
static char __pyx_k__c2[] = "c2";
static char __pyx_k__dy[] = "dy";
static char __pyx_k__np[] = "np";
static char __pyx_k__ok[] = "ok";
static char __pyx_k__buf[] = "buf";
static char __pyx_k__map[] = "map";
static char __pyx_k__obj[] = "obj";
static char __pyx_k__res[] = "res";
static char __pyx_k__tag[] = "tag";
static char __pyx_k__Path[] = "Path";
static char __pyx_k__base[] = "base";
static char __pyx_k__data[] = "data";
static char __pyx_k__ndim[] = "ndim";
static char __pyx_k__next[] = "next";
static char __pyx_k__Curve[] = "Curve";
static char __pyx_k___data[] = "_data";
static char __pyx_k__curve[] = "curve";
static char __pyx_k__descr[] = "descr";
static char __pyx_k__empty[] = "empty";
static char __pyx_k__image[] = "image";
static char __pyx_k__names[] = "names";
static char __pyx_k__numpy[] = "numpy";
static char __pyx_k__plist[] = "plist";
static char __pyx_k__range[] = "range";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__zeros[] = "zeros";
static char __pyx_k__Bitmap[] = "Bitmap";
static char __pyx_k__curves[] = "curves";
static char __pyx_k__fields[] = "fields";
static char __pyx_k__format[] = "format";
static char __pyx_k__method[] = "method";
static char __pyx_k__status[] = "status";
static char __pyx_k____all__[] = "__all__";
static char __pyx_k__regular[] = "regular";
static char __pyx_k__sibling[] = "sibling";
static char __pyx_k__strides[] = "strides";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k__adaptive[] = "adaptive";
static char __pyx_k__alphamax[] = "alphamax";
static char __pyx_k__children[] = "children";
static char __pyx_k__itemsize[] = "itemsize";
static char __pyx_k__po_state[] = "po_state";
static char __pyx_k__readonly[] = "readonly";
static char __pyx_k__segments[] = "segments";
static char __pyx_k__turdsize[] = "turdsize";
static char __pyx_k__type_num[] = "type_num";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__byteorder[] = "byteorder";
static char __pyx_k__childlist[] = "childlist";
static char __pyx_k__end_point[] = "end_point";
static char __pyx_k__is_corner[] = "is_corner";
static char __pyx_k__opticurve[] = "opticurve";
static char __pyx_k__po_bitmap[] = "po_bitmap";
static char __pyx_k__po_params[] = "po_params";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__suboffsets[] = "suboffsets";
static char __pyx_k__turnpolicy[] = "turnpolicy";
static char __pyx_k__curves_tree[] = "curves_tree";
static char __pyx_k__free_bitmap[] = "free_bitmap";
static char __pyx_k__start_point[] = "start_point";
static char __pyx_k__PotraceError[] = "PotraceError";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k__append_curve[] = "append_curve";
static char __pyx_k__opttolerance[] = "opttolerance";
static char __pyx_k__BezierSegment[] = "BezierSegment";
static char __pyx_k__CornerSegment[] = "CornerSegment";
static char __pyx_k__append_bezier[] = "append_bezier";
static char __pyx_k__append_corner[] = "append_corner";
static char __pyx_k__TURNPOLICY_LEFT[] = "TURNPOLICY_LEFT";
static char __pyx_k__TURNPOLICY_BLACK[] = "TURNPOLICY_BLACK";
static char __pyx_k__TURNPOLICY_RIGHT[] = "TURNPOLICY_RIGHT";
static char __pyx_k__TURNPOLICY_WHITE[] = "TURNPOLICY_WHITE";
static char __pyx_k__TURNPOLICY_RANDOM[] = "TURNPOLICY_RANDOM";
static char __pyx_k__potracelib_version[] = "potracelib_version";
static char __pyx_k__TURNPOLICY_MAJORITY[] = "TURNPOLICY_MAJORITY";
static char __pyx_k__TURNPOLICY_MINORITY[] = "TURNPOLICY_MINORITY";
static PyObject *__pyx_kp_u_11;
static PyObject *__pyx_kp_u_12;
static PyObject *__pyx_kp_u_13;
static PyObject *__pyx_kp_u_14;
static PyObject *__pyx_kp_u_15;
static PyObject *__pyx_kp_u_16;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_n_s__BezierSegment;
static PyObject *__pyx_n_s__Bitmap;
static PyObject *__pyx_n_s__CornerSegment;
static PyObject *__pyx_n_s__Curve;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__Path;
static PyObject *__pyx_n_s__PotraceError;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__TURNPOLICY_BLACK;
static PyObject *__pyx_n_s__TURNPOLICY_LEFT;
static PyObject *__pyx_n_s__TURNPOLICY_MAJORITY;
static PyObject *__pyx_n_s__TURNPOLICY_MINORITY;
static PyObject *__pyx_n_s__TURNPOLICY_RANDOM;
static PyObject *__pyx_n_s__TURNPOLICY_RIGHT;
static PyObject *__pyx_n_s__TURNPOLICY_WHITE;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____all__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s___data;
static PyObject *__pyx_n_s__adaptive;
static PyObject *__pyx_n_s__alphamax;
static PyObject *__pyx_n_s__append_bezier;
static PyObject *__pyx_n_s__append_corner;
static PyObject *__pyx_n_s__append_curve;
static PyObject *__pyx_n_s__base;
static PyObject *__pyx_n_s__buf;
static PyObject *__pyx_n_s__byteorder;
static PyObject *__pyx_n_s__c;
static PyObject *__pyx_n_s__c1;
static PyObject *__pyx_n_s__c2;
static PyObject *__pyx_n_s__childlist;
static PyObject *__pyx_n_s__children;
static PyObject *__pyx_n_s__curve;
static PyObject *__pyx_n_s__curves;
static PyObject *__pyx_n_s__curves_tree;
static PyObject *__pyx_n_s__data;
static PyObject *__pyx_n_s__descr;
static PyObject *__pyx_n_s__dy;
static PyObject *__pyx_n_s__empty;
static PyObject *__pyx_n_s__end_point;
static PyObject *__pyx_n_s__fields;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_s__free_bitmap;
static PyObject *__pyx_n_s__h;
static PyObject *__pyx_n_s__image;
static PyObject *__pyx_n_s__is_corner;
static PyObject *__pyx_n_s__itemsize;
static PyObject *__pyx_n_s__map;
static PyObject *__pyx_n_s__method;
static PyObject *__pyx_n_s__n;
static PyObject *__pyx_n_s__names;
static PyObject *__pyx_n_s__ndim;
static PyObject *__pyx_n_s__next;
static PyObject *__pyx_n_s__np;
static PyObject *__pyx_n_s__numpy;
static PyObject *__pyx_n_s__obj;
static PyObject *__pyx_n_s__ok;
static PyObject *__pyx_n_s__opticurve;
static PyObject *__pyx_n_s__opttolerance;
static PyObject *__pyx_n_s__plist;
static PyObject *__pyx_n_s__po_bitmap;
static PyObject *__pyx_n_s__po_params;
static PyObject *__pyx_n_s__po_state;
static PyObject *__pyx_n_s__potracelib_version;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__readonly;
static PyObject *__pyx_n_s__regular;
static PyObject *__pyx_n_s__res;
static PyObject *__pyx_n_s__segments;
static PyObject *__pyx_n_s__shape;
static PyObject *__pyx_n_s__sibling;
static PyObject *__pyx_n_s__start_point;
static PyObject *__pyx_n_s__status;
static PyObject *__pyx_n_s__strides;
static PyObject *__pyx_n_s__suboffsets;
static PyObject *__pyx_n_s__tag;
static PyObject *__pyx_n_s__turdsize;
static PyObject *__pyx_n_s__turnpolicy;
static PyObject *__pyx_n_s__type_num;
static PyObject *__pyx_n_s__w;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__zeros;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_15;
static PyObject *__pyx_int_30;
static PyObject *__pyx_k_1;
static PyObject *__pyx_k_2;
static PyObject *__pyx_k_3;
static int __pyx_k_5;
static PyObject *__pyx_k_10;

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":36
 *     cdef potrace_bitmap_s po_bitmap
 * 
 *     def __init__(self, data):             # <<<<<<<<<<<<<<
 *         self.data = data
 * 
 */

static int __pyx_pf_7potrace_8_potrace_6Bitmap___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7potrace_8_potrace_6Bitmap___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  int __pyx_r;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_data = values[0];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("potrace._potrace.Bitmap.__init__");
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":37
 * 
 *     def __init__(self, data):
 *         self.data = data             # <<<<<<<<<<<<<<
 * 
 *     def __cinit__(self):
 */
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__data, __pyx_v_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.Bitmap.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":39
 *         self.data = data
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.po_bitmap.map = NULL
 * 
 */

static int __pyx_pf_7potrace_8_potrace_6Bitmap___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7potrace_8_potrace_6Bitmap___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":40
 * 
 *     def __cinit__(self):
 *         self.po_bitmap.map = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.map = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":42
 *         self.po_bitmap.map = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.free_bitmap()
 * 
 */

static void __pyx_pf_7potrace_8_potrace_6Bitmap___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_7potrace_8_potrace_6Bitmap___dealloc__(PyObject *__pyx_v_self) {
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":43
 * 
 *     def __dealloc__(self):
 *         self.free_bitmap()             # <<<<<<<<<<<<<<
 * 
 *     def trace(self, turdsize=2, turnpolicy=POTRACE_TURNPOLICY_MINORITY,
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_7potrace_8_potrace_Bitmap *)((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->__pyx_vtab)->free_bitmap(((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.Bitmap.__dealloc__");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":45
 *         self.free_bitmap()
 * 
 *     def trace(self, turdsize=2, turnpolicy=POTRACE_TURNPOLICY_MINORITY,             # <<<<<<<<<<<<<<
 *             alphamax=1.0, opticurve=1, opttolerance=0.2):
 *         """
 */

static PyObject *__pyx_pf_7potrace_8_potrace_6Bitmap_trace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7potrace_8_potrace_6Bitmap_trace[] = "\n""        Trace the bitmap and wrap the result in a :class:`Path` instance.\n""\n""        The *turdsize* parameter can be used to \"despeckle\" the bitmap to be\n""        traced, by removing all curves whose enclosed area is below the given\n""        threshold. The current default for the *turdsize* parameter is 2; its\n""        useful range is from 0 to infinity.\n""\n""        The *turnpolicy* parameter determines how to resolve ambiguities during\n""        decomposition of bitmaps into paths. The possible choices for the\n""        *turnpolicy* parameter are:\n""        \n""        * :const:`TURNPOLICY_BLACK`: prefers to connect black\n""          (foreground) components.\n""\n""        * :const:`TURNPOLICY_WHITE`: prefers to connect white\n""          (background) components.\n""        \n""        * :const:`TURNPOLICY_LEFT`: always take a left turn.\n""\n""        * :const:`TURNPOLICY_RIGHT`: always take a right turn.\n""\n""        * :const:`TURNPOLICY_MINORITY`: prefers to connect the color\n""          (black or white) that occurs least frequently in a local neighborhood\n""          of the current position.\n""\n""        * :const:`TURNPOLICY_MAJORITY`: prefers to connect the color \n""          (black or white) that occurs most frequently in a local neighborhood\n""          of the current position.\n""\n""        * :const:`TURNPOLICY_RANDOM`: choose randomly.\n""        \n""        The current default policy is :const:`TURNPOLICY_MINORITY`, which tends\n""        to keep visual lines connected.\n""\n""        The *alphamax* parameter is a threshold for the detection of corners.\n""        It controls the smoothness of the traced curve. The current default is\n""        1.0; useful range of this parameter is from 0.0 (polygon) to 1.3333\n""        (no corners).\n""\n""        The *opticurve* parameter is a boolean flag that controls whether\n""        Potrace will attempt to \"simplify\" the final curve by reducing the\n""        number of Bezier curve segments.  Opticurve=1 turns on optimization,\n""        and *opticurve=0* turns it off. The current default is on.\n""\n""        The *opttolerance* parameter defines the amount of error allowed in\n""        this simplification. The current default is 0.2. Larger values tend to\n""        decrease the number of segments, at the expense of less accuracy. The\n""        useful range is from 0 to infinity, although in practice one would\n""        hardly choose values greater than 1 or so. For most purposes, the\n""        default value is a good tradeoff between space and accuracy.\n""        ";
static PyObject *__pyx_pf_7potrace_8_potrace_6Bitmap_trace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_turdsize = 0;
  PyObject *__pyx_v_turnpolicy = 0;
  PyObject *__pyx_v_alphamax = 0;
  PyObject *__pyx_v_opticurve = 0;
  PyObject *__pyx_v_opttolerance = 0;
  struct __pyx_obj_7potrace_8_potrace_Parameters *__pyx_v_params = 0;
  PyObject *__pyx_v_ret;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__turdsize,&__pyx_n_s__turnpolicy,&__pyx_n_s__alphamax,&__pyx_n_s__opticurve,&__pyx_n_s__opttolerance,0};
  __Pyx_RefNannySetupContext("trace");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    values[0] = ((PyObject *)__pyx_int_2);
    values[1] = __pyx_k_1;
    values[2] = __pyx_k_2;
    values[3] = ((PyObject *)__pyx_int_1);
    values[4] = __pyx_k_3;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__turdsize);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__turnpolicy);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alphamax);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
      case  3:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__opticurve);
        if (unlikely(value)) { values[3] = value; kw_args--; }
      }
      case  4:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__opttolerance);
        if (unlikely(value)) { values[4] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "trace") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_turdsize = values[0];
    __pyx_v_turnpolicy = values[1];
    __pyx_v_alphamax = values[2];
    __pyx_v_opticurve = values[3];
    __pyx_v_opttolerance = values[4];
  } else {
    __pyx_v_turdsize = ((PyObject *)__pyx_int_2);
    __pyx_v_turnpolicy = __pyx_k_1;
    __pyx_v_alphamax = __pyx_k_2;
    __pyx_v_opticurve = ((PyObject *)__pyx_int_1);
    __pyx_v_opttolerance = __pyx_k_3;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  5: __pyx_v_opttolerance = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: __pyx_v_opticurve = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: __pyx_v_alphamax = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_turnpolicy = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_turdsize = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trace", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("potrace._potrace.Bitmap.trace");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_turdsize);
  __Pyx_INCREF(__pyx_v_turnpolicy);
  __Pyx_INCREF(__pyx_v_alphamax);
  __Pyx_INCREF(__pyx_v_opticurve);
  __Pyx_INCREF(__pyx_v_opttolerance);
  __pyx_v_ret = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":99
 *         default value is a good tradeoff between space and accuracy.
 *         """
 *         cdef Parameters params = Parameters(turdsize=turdsize,             # <<<<<<<<<<<<<<
 *                 turnpolicy=turnpolicy, alphamax=alphamax, opticurve=opticurve,
 *                 opttolerance=opttolerance)
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__turdsize), __pyx_v_turdsize) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":100
 *         """
 *         cdef Parameters params = Parameters(turdsize=turdsize,
 *                 turnpolicy=turnpolicy, alphamax=alphamax, opticurve=opticurve,             # <<<<<<<<<<<<<<
 *                 opttolerance=opttolerance)
 *         # Trace bitmap
 */
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__turnpolicy), __pyx_v_turnpolicy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__alphamax), __pyx_v_alphamax) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__opticurve), __pyx_v_opticurve) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":101
 *         cdef Parameters params = Parameters(turdsize=turdsize,
 *                 turnpolicy=turnpolicy, alphamax=alphamax, opticurve=opticurve,
 *                 opttolerance=opttolerance)             # <<<<<<<<<<<<<<
 *         # Trace bitmap
 *         ret = state_from_ptr(potrace_trace(params.po_params, &self.po_bitmap))
 */
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__opttolerance), __pyx_v_opttolerance) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_7potrace_8_potrace_Parameters)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_params = ((struct __pyx_obj_7potrace_8_potrace_Parameters *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":103
 *                 opttolerance=opttolerance)
 *         # Trace bitmap
 *         ret = state_from_ptr(potrace_trace(params.po_params, &self.po_bitmap))             # <<<<<<<<<<<<<<
 *         if not ret.ok:
 *             raise PotraceError("error tracing bitmap")
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_7potrace_8_potrace_state_from_ptr(potrace_trace(__pyx_v_params->po_params, (&((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_ret);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":104
 *         # Trace bitmap
 *         ret = state_from_ptr(potrace_trace(params.po_params, &self.po_bitmap))
 *         if not ret.ok:             # <<<<<<<<<<<<<<
 *             raise PotraceError("error tracing bitmap")
 *         return ret.image
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_ret, __pyx_n_s__ok); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (__pyx_t_4) {

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":105
 *         ret = state_from_ptr(potrace_trace(params.po_params, &self.po_bitmap))
 *         if not ret.ok:
 *             raise PotraceError("error tracing bitmap")             # <<<<<<<<<<<<<<
 *         return ret.image
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__PotraceError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
    __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":106
 *         if not ret.ok:
 *             raise PotraceError("error tracing bitmap")
 *         return ret.image             # <<<<<<<<<<<<<<
 * 
 *     property data:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_ret, __pyx_n_s__image); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("potrace._potrace.Bitmap.trace");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_params);
  __Pyx_DECREF(__pyx_v_ret);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_turdsize);
  __Pyx_DECREF(__pyx_v_turnpolicy);
  __Pyx_DECREF(__pyx_v_alphamax);
  __Pyx_DECREF(__pyx_v_opticurve);
  __Pyx_DECREF(__pyx_v_opttolerance);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":109
 * 
 *     property data:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self._data
 * 
 */

static PyObject *__pyx_pf_7potrace_8_potrace_6Bitmap_4data___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_6Bitmap_4data___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":110
 *     property data:
 *         def __get__(self):
 *             return self._data             # <<<<<<<<<<<<<<
 * 
 *         def __set__(self, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->_data));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->_data);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":112
 *             return self._data
 * 
 *         def __set__(self, value):             # <<<<<<<<<<<<<<
 *             cdef int x, y
 *             self._data = value
 */

static int __pyx_pf_7potrace_8_potrace_6Bitmap_4data___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_6Bitmap_4data___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_v_x;
  int __pyx_v_y;
  PyObject *__pyx_v_size;
  int __pyx_r;
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_v_size = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":114
 *         def __set__(self, value):
 *             cdef int x, y
 *             self._data = value             # <<<<<<<<<<<<<<
 *             # Init potrace bitmap struct
 *             self.po_bitmap.w = self._data.shape[1]
 */
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->_data);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->_data));
  ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->_data = ((PyArrayObject *)__pyx_v_value);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":116
 *             self._data = value
 *             # Init potrace bitmap struct
 *             self.po_bitmap.w = self._data.shape[1]             # <<<<<<<<<<<<<<
 *             self.po_bitmap.h = self._data.shape[0]
 *             self.po_bitmap.dy = (self.po_bitmap.w + (
 */
  ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.w = (((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->_data->dimensions[1]);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":117
 *             # Init potrace bitmap struct
 *             self.po_bitmap.w = self._data.shape[1]
 *             self.po_bitmap.h = self._data.shape[0]             # <<<<<<<<<<<<<<
 *             self.po_bitmap.dy = (self.po_bitmap.w + (
 *                 (N - (self.po_bitmap.w & (N - 1))) & (N - 1))) / N
 */
  ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.h = (((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->_data->dimensions[0]);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":119
 *             self.po_bitmap.h = self._data.shape[0]
 *             self.po_bitmap.dy = (self.po_bitmap.w + (
 *                 (N - (self.po_bitmap.w & (N - 1))) & (N - 1))) / N             # <<<<<<<<<<<<<<
 *             # Allocate bitmap buffer
 *             size = self.po_bitmap.h * self.po_bitmap.dy * sizeof(potrace_word)
 */
  __pyx_t_1 = (((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.w + ((__pyx_v_7potrace_8_potrace_N - (((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.w & (__pyx_v_7potrace_8_potrace_N - 1))) & (__pyx_v_7potrace_8_potrace_N - 1)));
  if (unlikely(__pyx_v_7potrace_8_potrace_N == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  else if (sizeof(long) == sizeof(long) && unlikely(__pyx_v_7potrace_8_potrace_N == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) {
    PyErr_Format(PyExc_OverflowError, "value too large to perform division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":118
 *             self.po_bitmap.w = self._data.shape[1]
 *             self.po_bitmap.h = self._data.shape[0]
 *             self.po_bitmap.dy = (self.po_bitmap.w + (             # <<<<<<<<<<<<<<
 *                 (N - (self.po_bitmap.w & (N - 1))) & (N - 1))) / N
 *             # Allocate bitmap buffer
 */
  ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.dy = __Pyx_div_long(__pyx_t_1, __pyx_v_7potrace_8_potrace_N);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":121
 *                 (N - (self.po_bitmap.w & (N - 1))) & (N - 1))) / N
 *             # Allocate bitmap buffer
 *             size = self.po_bitmap.h * self.po_bitmap.dy * sizeof(potrace_word)             # <<<<<<<<<<<<<<
 *             self.free_bitmap()
 *             self.po_bitmap.map = <potrace_word*>stdlib.malloc(size)
 */
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(((((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.h * ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.dy) * (sizeof(potrace_word)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_size);
  __pyx_v_size = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":122
 *             # Allocate bitmap buffer
 *             size = self.po_bitmap.h * self.po_bitmap.dy * sizeof(potrace_word)
 *             self.free_bitmap()             # <<<<<<<<<<<<<<
 *             self.po_bitmap.map = <potrace_word*>stdlib.malloc(size)
 *             # Initialize bitmap buffer from numpy array
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_7potrace_8_potrace_Bitmap *)((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->__pyx_vtab)->free_bitmap(((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":123
 *             size = self.po_bitmap.h * self.po_bitmap.dy * sizeof(potrace_word)
 *             self.free_bitmap()
 *             self.po_bitmap.map = <potrace_word*>stdlib.malloc(size)             # <<<<<<<<<<<<<<
 *             # Initialize bitmap buffer from numpy array
 *             for y in range(self.po_bitmap.h):
 */
  __pyx_t_3 = __Pyx_PyInt_AsSize_t(__pyx_v_size); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.map = ((potrace_word *)malloc(__pyx_t_3));

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":125
 *             self.po_bitmap.map = <potrace_word*>stdlib.malloc(size)
 *             # Initialize bitmap buffer from numpy array
 *             for y in range(self.po_bitmap.h):             # <<<<<<<<<<<<<<
 *                 for x in range(self.po_bitmap.w):
 *                     setpixel(&self.po_bitmap, x, y, bool(self._data[y, x]))
 */
  __pyx_t_4 = ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.h;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_y = __pyx_t_5;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":126
 *             # Initialize bitmap buffer from numpy array
 *             for y in range(self.po_bitmap.h):
 *                 for x in range(self.po_bitmap.w):             # <<<<<<<<<<<<<<
 *                     setpixel(&self.po_bitmap, x, y, bool(self._data[y, x]))
 * 
 */
    __pyx_t_6 = ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap.w;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
      __pyx_v_x = __pyx_t_7;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":127
 *             for y in range(self.po_bitmap.h):
 *                 for x in range(self.po_bitmap.w):
 *                     setpixel(&self.po_bitmap, x, y, bool(self._data[y, x]))             # <<<<<<<<<<<<<<
 * 
 *     cdef free_bitmap(self):
 */
      __pyx_t_2 = PyInt_FromLong(__pyx_v_y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyInt_FromLong(__pyx_v_x); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_2 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_GetItem(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->_data), __pyx_t_9); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)&PyBool_Type)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_f_7potrace_8_potrace_setpixel((&((struct __pyx_obj_7potrace_8_potrace_Bitmap *)__pyx_v_self)->po_bitmap), __pyx_v_x, __pyx_v_y, __pyx_t_10);
    }
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("potrace._potrace.Bitmap.data.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_size);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":129
 *                     setpixel(&self.po_bitmap, x, y, bool(self._data[y, x]))
 * 
 *     cdef free_bitmap(self):             # <<<<<<<<<<<<<<
 *         if self.po_bitmap.map != NULL:
 *             stdlib.free(self.po_bitmap.map)
 */

static  PyObject *__pyx_f_7potrace_8_potrace_6Bitmap_free_bitmap(struct __pyx_obj_7potrace_8_potrace_Bitmap *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("free_bitmap");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":130
 * 
 *     cdef free_bitmap(self):
 *         if self.po_bitmap.map != NULL:             # <<<<<<<<<<<<<<
 *             stdlib.free(self.po_bitmap.map)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->po_bitmap.map != NULL);
  if (__pyx_t_1) {

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":131
 *     cdef free_bitmap(self):
 *         if self.po_bitmap.map != NULL:
 *             stdlib.free(self.po_bitmap.map)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    free(__pyx_v_self->po_bitmap.map);
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":141
 *     cdef potrace_param_s *po_params
 * 
 *     def __cinit__(self, int turdsize=2,             # <<<<<<<<<<<<<<
 *             int turnpolicy=POTRACE_TURNPOLICY_MINORITY, double alphamax=1.0,
 *             int opticurve=1, double opttolerance=0.2, *args, **kwargs):
 */

static int __pyx_pf_7potrace_8_potrace_10Parameters___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7potrace_8_potrace_10Parameters___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_turdsize;
  int __pyx_v_turnpolicy;
  double __pyx_v_alphamax;
  int __pyx_v_opticurve;
  double __pyx_v_opttolerance;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__turdsize,&__pyx_n_s__turnpolicy,&__pyx_n_s__alphamax,&__pyx_n_s__opticurve,&__pyx_n_s__opttolerance,0};
  __Pyx_RefNannySetupContext("__cinit__");
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 5) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 5, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_args);

    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs);
      return -1;
    }
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__turdsize);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__turnpolicy);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alphamax);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
      case  3:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__opticurve);
        if (unlikely(value)) { values[3] = value; kw_args--; }
      }
      case  4:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__opttolerance);
        if (unlikely(value)) { values[4] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 5) ? PyTuple_GET_SIZE(__pyx_args) : 5;
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_turdsize = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_turdsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_turdsize = ((int)2);
    }
    if (values[1]) {
      __pyx_v_turnpolicy = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_turnpolicy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_turnpolicy = __pyx_k_5;
    }
    if (values[2]) {
      __pyx_v_alphamax = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_alphamax == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":142
 * 
 *     def __cinit__(self, int turdsize=2,
 *             int turnpolicy=POTRACE_TURNPOLICY_MINORITY, double alphamax=1.0,             # <<<<<<<<<<<<<<
 *             int opticurve=1, double opttolerance=0.2, *args, **kwargs):
 *         self.po_params = potrace_param_default()
 */
      __pyx_v_alphamax = ((double)1.0);
    }
    if (values[3]) {
      __pyx_v_opticurve = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_opticurve == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_opticurve = ((int)1);
    }
    if (values[4]) {
      __pyx_v_opttolerance = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_opttolerance == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":143
 *     def __cinit__(self, int turdsize=2,
 *             int turnpolicy=POTRACE_TURNPOLICY_MINORITY, double alphamax=1.0,
 *             int opticurve=1, double opttolerance=0.2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.po_params = potrace_param_default()
 *         self.po_params.turdsize = turdsize
 */
      __pyx_v_opttolerance = ((double)0.20000000000000001);
    }
  } else {
    __pyx_v_turdsize = ((int)2);
    __pyx_v_turnpolicy = __pyx_k_5;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":142
 * 
 *     def __cinit__(self, int turdsize=2,
 *             int turnpolicy=POTRACE_TURNPOLICY_MINORITY, double alphamax=1.0,             # <<<<<<<<<<<<<<
 *             int opticurve=1, double opttolerance=0.2, *args, **kwargs):
 *         self.po_params = potrace_param_default()
 */
    __pyx_v_alphamax = ((double)1.0);
    __pyx_v_opticurve = ((int)1);

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":143
 *     def __cinit__(self, int turdsize=2,
 *             int turnpolicy=POTRACE_TURNPOLICY_MINORITY, double alphamax=1.0,
 *             int opticurve=1, double opttolerance=0.2, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.po_params = potrace_param_default()
 *         self.po_params.turdsize = turdsize
 */
    __pyx_v_opttolerance = ((double)0.20000000000000001);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      default:
      case  5: __pyx_v_opttolerance = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_opttolerance == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  4: __pyx_v_opticurve = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_opticurve == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  3: __pyx_v_alphamax = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_alphamax == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  2: __pyx_v_turnpolicy = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_turnpolicy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_turdsize = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_turdsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_AddTraceback("potrace._potrace.Parameters.__cinit__");
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":144
 *             int turnpolicy=POTRACE_TURNPOLICY_MINORITY, double alphamax=1.0,
 *             int opticurve=1, double opttolerance=0.2, *args, **kwargs):
 *         self.po_params = potrace_param_default()             # <<<<<<<<<<<<<<
 *         self.po_params.turdsize = turdsize
 *         self.po_params.turnpolicy = turnpolicy
 */
  ((struct __pyx_obj_7potrace_8_potrace_Parameters *)__pyx_v_self)->po_params = potrace_param_default();

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":145
 *             int opticurve=1, double opttolerance=0.2, *args, **kwargs):
 *         self.po_params = potrace_param_default()
 *         self.po_params.turdsize = turdsize             # <<<<<<<<<<<<<<
 *         self.po_params.turnpolicy = turnpolicy
 *         self.po_params.alphamax = alphamax
 */
  ((struct __pyx_obj_7potrace_8_potrace_Parameters *)__pyx_v_self)->po_params->turdsize = __pyx_v_turdsize;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":146
 *         self.po_params = potrace_param_default()
 *         self.po_params.turdsize = turdsize
 *         self.po_params.turnpolicy = turnpolicy             # <<<<<<<<<<<<<<
 *         self.po_params.alphamax = alphamax
 *         self.po_params.opticurve = opticurve
 */
  ((struct __pyx_obj_7potrace_8_potrace_Parameters *)__pyx_v_self)->po_params->turnpolicy = __pyx_v_turnpolicy;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":147
 *         self.po_params.turdsize = turdsize
 *         self.po_params.turnpolicy = turnpolicy
 *         self.po_params.alphamax = alphamax             # <<<<<<<<<<<<<<
 *         self.po_params.opticurve = opticurve
 *         self.po_params.opttolerance = opttolerance
 */
  ((struct __pyx_obj_7potrace_8_potrace_Parameters *)__pyx_v_self)->po_params->alphamax = __pyx_v_alphamax;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":148
 *         self.po_params.turnpolicy = turnpolicy
 *         self.po_params.alphamax = alphamax
 *         self.po_params.opticurve = opticurve             # <<<<<<<<<<<<<<
 *         self.po_params.opttolerance = opttolerance
 * 
 */
  ((struct __pyx_obj_7potrace_8_potrace_Parameters *)__pyx_v_self)->po_params->opticurve = __pyx_v_opticurve;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":149
 *         self.po_params.alphamax = alphamax
 *         self.po_params.opticurve = opticurve
 *         self.po_params.opttolerance = opttolerance             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  ((struct __pyx_obj_7potrace_8_potrace_Parameters *)__pyx_v_self)->po_params->opttolerance = __pyx_v_opttolerance;

  __pyx_r = 0;
  __Pyx_DECREF(__pyx_v_args);
  __Pyx_DECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":151
 *         self.po_params.opttolerance = opttolerance
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         potrace_param_free(self.po_params)
 * 
 */

static void __pyx_pf_7potrace_8_potrace_10Parameters___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_7potrace_8_potrace_10Parameters___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":152
 * 
 *     def __dealloc__(self):
 *         potrace_param_free(self.po_params)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  potrace_param_free(((struct __pyx_obj_7potrace_8_potrace_Parameters *)__pyx_v_self)->po_params);

  __Pyx_RefNannyFinishContext();
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":164
 *     cdef potrace_state_s *po_state
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.po_state = NULL
 * 
 */

static int __pyx_pf_7potrace_8_potrace_5State___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7potrace_8_potrace_5State___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":165
 * 
 *     def __cinit__(self):
 *         self.po_state = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  ((struct __pyx_obj_7potrace_8_potrace_State *)__pyx_v_self)->po_state = NULL;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":167
 *         self.po_state = NULL
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.po_state != NULL:
 *             potrace_state_free(self.po_state)
 */

static void __pyx_pf_7potrace_8_potrace_5State___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_7potrace_8_potrace_5State___dealloc__(PyObject *__pyx_v_self) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":168
 * 
 *     def __dealloc__(self):
 *         if self.po_state != NULL:             # <<<<<<<<<<<<<<
 *             potrace_state_free(self.po_state)
 * 
 */
  __pyx_t_1 = (((struct __pyx_obj_7potrace_8_potrace_State *)__pyx_v_self)->po_state != NULL);
  if (__pyx_t_1) {

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":169
 *     def __dealloc__(self):
 *         if self.po_state != NULL:
 *             potrace_state_free(self.po_state)             # <<<<<<<<<<<<<<
 * 
 *     property ok:
 */
    potrace_state_free(((struct __pyx_obj_7potrace_8_potrace_State *)__pyx_v_self)->po_state);
    goto __pyx_L5;
  }
  __pyx_L5:;

  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":177
 *         """
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if self.po_state == NULL:
 *                 raise ValueError("can't query null state object")
 */

static PyObject *__pyx_pf_7potrace_8_potrace_5State_2ok___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_5State_2ok___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":178
 * 
 *         def __get__(self):
 *             if self.po_state == NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError("can't query null state object")
 *             return self.po_state.status == POTRACE_STATUS_OK
 */
  __pyx_t_1 = (((struct __pyx_obj_7potrace_8_potrace_State *)__pyx_v_self)->po_state == NULL);
  if (__pyx_t_1) {

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":179
 *         def __get__(self):
 *             if self.po_state == NULL:
 *                 raise ValueError("can't query null state object")             # <<<<<<<<<<<<<<
 *             return self.po_state.status == POTRACE_STATUS_OK
 * 
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":180
 *             if self.po_state == NULL:
 *                 raise ValueError("can't query null state object")
 *             return self.po_state.status == POTRACE_STATUS_OK             # <<<<<<<<<<<<<<
 * 
 *     property image:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyBool_FromLong((((struct __pyx_obj_7potrace_8_potrace_State *)__pyx_v_self)->po_state->status == POTRACE_STATUS_OK)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("potrace._potrace.State.ok.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":187
 *         """
 * 
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             if not self.ok:
 *                 raise ValueError("can't access the image property of "
 */

static PyObject *__pyx_pf_7potrace_8_potrace_5State_5image___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_5State_5image___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":188
 * 
 *         def __get__(self):
 *             if not self.ok:             # <<<<<<<<<<<<<<
 *                 raise ValueError("can't access the image property of "
 *                         "an incomplete trace state")
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ok); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":189
 *         def __get__(self):
 *             if not self.ok:
 *                 raise ValueError("can't access the image property of "             # <<<<<<<<<<<<<<
 *                         "an incomplete trace state")
 *             return path_from_ptr(self.po_state.plist);
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_7));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":191
 *                 raise ValueError("can't access the image property of "
 *                         "an incomplete trace state")
 *             return path_from_ptr(self.po_state.plist);             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_7potrace_8_potrace_path_from_ptr(((struct __pyx_obj_7potrace_8_potrace_State *)__pyx_v_self)->po_state->plist)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("potrace._potrace.State.image.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":199
 *     """
 * 
 *     cdef public tuple c1, c2, end_point             # <<<<<<<<<<<<<<
 *     cdef public bool is_corner
 * 
 */

static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment_2c1___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment_2c1___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_13BezierSegment_2c1___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_13BezierSegment_2c1___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1));
  ((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1 = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.BezierSegment.c1.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment_2c2___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment_2c2___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_13BezierSegment_2c2___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_13BezierSegment_2c2___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2));
  ((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2 = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.BezierSegment.c2.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment_9end_point___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment_9end_point___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_13BezierSegment_9end_point___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_13BezierSegment_9end_point___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point));
  ((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.BezierSegment.end_point.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":200
 * 
 *     cdef public tuple c1, c2, end_point
 *     cdef public bool is_corner             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, c1, c2, end_point):
 */

static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment_9is_corner___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment_9is_corner___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->is_corner));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->is_corner);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_13BezierSegment_9is_corner___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_13BezierSegment_9is_corner___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyBool_Check(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bool, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->is_corner);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->is_corner));
  ((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->is_corner = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.BezierSegment.is_corner.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":202
 *     cdef public bool is_corner
 * 
 *     def __init__(self, c1, c2, end_point):             # <<<<<<<<<<<<<<
 *         self.c1 = c1
 *         self.c2 = c2
 */

static int __pyx_pf_7potrace_8_potrace_13BezierSegment___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7potrace_8_potrace_13BezierSegment___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_c1 = 0;
  PyObject *__pyx_v_c2 = 0;
  PyObject *__pyx_v_end_point = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__c1,&__pyx_n_s__c2,&__pyx_n_s__end_point,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c1);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c2);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end_point);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_c1 = values[0];
    __pyx_v_c2 = values[1];
    __pyx_v_end_point = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_c1 = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_c2 = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_end_point = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("potrace._potrace.BezierSegment.__init__");
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":203
 * 
 *     def __init__(self, c1, c2, end_point):
 *         self.c1 = c1             # <<<<<<<<<<<<<<
 *         self.c2 = c2
 *         self.end_point = end_point
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v_c1))||((__pyx_v_c1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_c1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_c1);
  __Pyx_GIVEREF(__pyx_v_c1);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1));
  ((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1 = ((PyObject *)__pyx_v_c1);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":204
 *     def __init__(self, c1, c2, end_point):
 *         self.c1 = c1
 *         self.c2 = c2             # <<<<<<<<<<<<<<
 *         self.end_point = end_point
 *         self.is_corner = False
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v_c2))||((__pyx_v_c2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_c2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_c2);
  __Pyx_GIVEREF(__pyx_v_c2);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2));
  ((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2 = ((PyObject *)__pyx_v_c2);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":205
 *         self.c1 = c1
 *         self.c2 = c2
 *         self.end_point = end_point             # <<<<<<<<<<<<<<
 *         self.is_corner = False
 * 
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v_end_point))||((__pyx_v_end_point) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_end_point)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_end_point);
  __Pyx_GIVEREF(__pyx_v_end_point);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point));
  ((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point = ((PyObject *)__pyx_v_end_point);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":206
 *         self.c2 = c2
 *         self.end_point = end_point
 *         self.is_corner = False             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBool_Check(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bool, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->is_corner);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->is_corner));
  ((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->is_corner = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.BezierSegment.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":208
 *         self.is_corner = False
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "BezierSegment(c1=%s, c2=%s, end_point=%s)" % (self.c1,
 *                 self.c2, self.end_point)
 */

static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_13BezierSegment___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":209
 * 
 *     def __repr__(self):
 *         return "BezierSegment(c1=%s, c2=%s, end_point=%s)" % (self.c1,             # <<<<<<<<<<<<<<
 *                 self.c2, self.end_point)
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":210
 *     def __repr__(self):
 *         return "BezierSegment(c1=%s, c2=%s, end_point=%s)" % (self.c1,
 *                 self.c2, self.end_point)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->c2));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)__pyx_v_self)->end_point));
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("potrace._potrace.BezierSegment.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":218
 *     """
 * 
 *     cdef public tuple c, end_point             # <<<<<<<<<<<<<<
 *     cdef public bool is_corner
 * 
 */

static PyObject *__pyx_pf_7potrace_8_potrace_13CornerSegment_1c___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_13CornerSegment_1c___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_13CornerSegment_1c___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_13CornerSegment_1c___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c));
  ((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.CornerSegment.c.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7potrace_8_potrace_13CornerSegment_9end_point___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_13CornerSegment_9end_point___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_13CornerSegment_9end_point___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_13CornerSegment_9end_point___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point));
  ((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.CornerSegment.end_point.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":219
 * 
 *     cdef public tuple c, end_point
 *     cdef public bool is_corner             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, c, end_point):
 */

static PyObject *__pyx_pf_7potrace_8_potrace_13CornerSegment_9is_corner___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_13CornerSegment_9is_corner___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->is_corner));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->is_corner);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_13CornerSegment_9is_corner___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_13CornerSegment_9is_corner___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyBool_Check(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bool, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->is_corner);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->is_corner));
  ((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->is_corner = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.CornerSegment.is_corner.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":221
 *     cdef public bool is_corner
 * 
 *     def __init__(self, c, end_point):             # <<<<<<<<<<<<<<
 *         self.c = c
 *         self.end_point = end_point
 */

static int __pyx_pf_7potrace_8_potrace_13CornerSegment___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7potrace_8_potrace_13CornerSegment___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_c = 0;
  PyObject *__pyx_v_end_point = 0;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__c,&__pyx_n_s__end_point,0};
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end_point);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_c = values[0];
    __pyx_v_end_point = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_c = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_end_point = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("potrace._potrace.CornerSegment.__init__");
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":222
 * 
 *     def __init__(self, c, end_point):
 *         self.c = c             # <<<<<<<<<<<<<<
 *         self.end_point = end_point
 *         self.is_corner = True
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v_c))||((__pyx_v_c) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_c)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_c);
  __Pyx_GIVEREF(__pyx_v_c);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c));
  ((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c = ((PyObject *)__pyx_v_c);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":223
 *     def __init__(self, c, end_point):
 *         self.c = c
 *         self.end_point = end_point             # <<<<<<<<<<<<<<
 *         self.is_corner = True
 * 
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v_end_point))||((__pyx_v_end_point) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_end_point)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_end_point);
  __Pyx_GIVEREF(__pyx_v_end_point);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point));
  ((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point = ((PyObject *)__pyx_v_end_point);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":224
 *         self.c = c
 *         self.end_point = end_point
 *         self.is_corner = True             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBool_Check(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bool, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->is_corner);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->is_corner));
  ((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->is_corner = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.CornerSegment.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":226
 *         self.is_corner = True
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "CornerSegment(c=%s, end_point=%s)" % (self.c, self.end_point)
 * 
 */

static PyObject *__pyx_pf_7potrace_8_potrace_13CornerSegment___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_13CornerSegment___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__repr__");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":227
 * 
 *     def __repr__(self):
 *         return "CornerSegment(c=%s, end_point=%s)" % (self.c, self.end_point)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->c));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)__pyx_v_self)->end_point));
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("potrace._potrace.CornerSegment.__repr__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":238
 *     """
 * 
 *     cdef public list segments             # <<<<<<<<<<<<<<
 *     cdef public list children
 * 
 */

static PyObject *__pyx_pf_7potrace_8_potrace_5Curve_8segments___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_5Curve_8segments___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_5Curve_8segments___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_5Curve_8segments___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments));
  ((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.Curve.segments.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":239
 * 
 *     cdef public list segments
 *     cdef public list children             # <<<<<<<<<<<<<<
 * 
 *     # Bezier tesselation methods constants
 */

static PyObject *__pyx_pf_7potrace_8_potrace_5Curve_8children___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_5Curve_8children___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->children));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->children);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_5Curve_8children___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_5Curve_8children___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->children);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->children));
  ((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->children = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.Curve.children.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":245
 *     adaptive = 1
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.segments = []
 *         self.children = []
 */

static int __pyx_pf_7potrace_8_potrace_5Curve___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7potrace_8_potrace_5Curve___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":246
 * 
 *     def __init__(self):
 *         self.segments = []             # <<<<<<<<<<<<<<
 *         self.children = []
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments));
  ((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":247
 *     def __init__(self):
 *         self.segments = []
 *         self.children = []             # <<<<<<<<<<<<<<
 * 
 *     property start_point:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->children);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->children));
  ((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->children = __pyx_t_1;
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.Curve.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":253
 *         The curve starting point.
 *         """
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             return self.segments[-1].end_point
 * 
 */

static PyObject *__pyx_pf_7potrace_8_potrace_5Curve_11start_point___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_5Curve_11start_point___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__get__");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":254
 *         """
 *         def __get__(self):
 *             return self.segments[-1].end_point             # <<<<<<<<<<<<<<
 * 
 *     def tesselate(self, method=adaptive, res=30):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__end_point); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("potrace._potrace.Curve.start_point.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":256
 *             return self.segments[-1].end_point
 * 
 *     def tesselate(self, method=adaptive, res=30):             # <<<<<<<<<<<<<<
 *         """
 *         Tesselate the curve.
 */

static PyObject *__pyx_pf_7potrace_8_potrace_5Curve_tesselate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7potrace_8_potrace_5Curve_tesselate[] = "\n        Tesselate the curve.\n\n        Returns a numpy array containing the curve vertices. The *method*\n        argument is for selecting the bezier segments tesselation method:\n        :attr:`adaptive` (the default) uses an adaptive tesselation algorithm\n        and :attr:`regular` divides the segments with a fixed number of steps\n        (controled by the *res* argument).\n        ";
static PyObject *__pyx_pf_7potrace_8_potrace_5Curve_tesselate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_res = 0;
  PyObject *__pyx_v_num_verts;
  PyObject *__pyx_v_tess_segs;
  PyObject *__pyx_v_start_point;
  PyObject *__pyx_v_bezier_cp;
  PyObject *__pyx_v_seg;
  PyObject *__pyx_v_tseg;
  PyObject *__pyx_v_ret;
  PyObject *__pyx_v_cur_index;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  struct __pyx_opt_args_7potrace_6bezier_bezier __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__method,&__pyx_n_s__res,0};
  __Pyx_RefNannySetupContext("tesselate");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[0] = __pyx_k_10;
    values[1] = ((PyObject *)__pyx_int_30);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tesselate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_method = values[0];
    __pyx_v_res = values[1];
  } else {
    __pyx_v_method = __pyx_k_10;
    __pyx_v_res = ((PyObject *)__pyx_int_30);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_res = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_method = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tesselate", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("potrace._potrace.Curve.tesselate");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_method);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_v_num_verts = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tess_segs = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_start_point = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_bezier_cp = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_seg = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tseg = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ret = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_cur_index = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":267
 *         """
 *         # Tesselate segments
 *         num_verts = 0             # <<<<<<<<<<<<<<
 *         tess_segs = []
 *         start_point = self.start_point
 */
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_DECREF(__pyx_v_num_verts);
  __pyx_v_num_verts = __pyx_int_0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":268
 *         # Tesselate segments
 *         num_verts = 0
 *         tess_segs = []             # <<<<<<<<<<<<<<
 *         start_point = self.start_point
 *         bezier_cp = np.empty((4, 2))
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_v_tess_segs);
  __pyx_v_tess_segs = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":269
 *         num_verts = 0
 *         tess_segs = []
 *         start_point = self.start_point             # <<<<<<<<<<<<<<
 *         bezier_cp = np.empty((4, 2))
 *         for seg in self.segments:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__start_point); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_start_point);
  __pyx_v_start_point = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":270
 *         tess_segs = []
 *         start_point = self.start_point
 *         bezier_cp = np.empty((4, 2))             # <<<<<<<<<<<<<<
 *         for seg in self.segments:
 *             if seg.is_corner:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_4);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_4);
  __Pyx_GIVEREF(__pyx_int_4);
  __Pyx_INCREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_bezier_cp);
  __pyx_v_bezier_cp = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":271
 *         start_point = self.start_point
 *         bezier_cp = np.empty((4, 2))
 *         for seg in self.segments:             # <<<<<<<<<<<<<<
 *             if seg.is_corner:
 *                 tseg = np.zeros((2, 2))
 */
  if (likely(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments) != Py_None)) {
    __pyx_t_4 = 0; __pyx_t_1 = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments); __Pyx_INCREF(__pyx_t_1);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
    __Pyx_DECREF(__pyx_v_seg);
    __pyx_v_seg = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":272
 *         bezier_cp = np.empty((4, 2))
 *         for seg in self.segments:
 *             if seg.is_corner:             # <<<<<<<<<<<<<<
 *                 tseg = np.zeros((2, 2))
 *                 tseg[0,:] = seg.c
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_seg, __pyx_n_s__is_corner); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":273
 *         for seg in self.segments:
 *             if seg.is_corner:
 *                 tseg = np.zeros((2, 2))             # <<<<<<<<<<<<<<
 *                 tseg[0,:] = seg.c
 *                 tseg[1,:] = seg.end_point
 */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      __Pyx_INCREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_tseg);
      __pyx_v_tseg = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":274
 *             if seg.is_corner:
 *                 tseg = np.zeros((2, 2))
 *                 tseg[0,:] = seg.c             # <<<<<<<<<<<<<<
 *                 tseg[1,:] = seg.end_point
 *                 tess_segs.append(tseg)
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_seg, __pyx_n_s__c); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      if (PyObject_SetItem(__pyx_v_tseg, __pyx_t_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":275
 *                 tseg = np.zeros((2, 2))
 *                 tseg[0,:] = seg.c
 *                 tseg[1,:] = seg.end_point             # <<<<<<<<<<<<<<
 *                 tess_segs.append(tseg)
 *                 num_verts += 2
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_seg, __pyx_n_s__end_point); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      if (PyObject_SetItem(__pyx_v_tseg, __pyx_t_6, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":276
 *                 tseg[0,:] = seg.c
 *                 tseg[1,:] = seg.end_point
 *                 tess_segs.append(tseg)             # <<<<<<<<<<<<<<
 *                 num_verts += 2
 *             else:
 */
      __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_tess_segs, __pyx_v_tseg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":277
 *                 tseg[1,:] = seg.end_point
 *                 tess_segs.append(tseg)
 *                 num_verts += 2             # <<<<<<<<<<<<<<
 *             else:
 *                 bezier_cp[0,:] = start_point
 */
      __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_num_verts, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_num_verts);
      __pyx_v_num_verts = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":279
 *                 num_verts += 2
 *             else:
 *                 bezier_cp[0,:] = start_point             # <<<<<<<<<<<<<<
 *                 bezier_cp[1,:] = seg.c1
 *                 bezier_cp[2,:] = seg.c2
 */
      __pyx_t_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      if (PyObject_SetItem(__pyx_v_bezier_cp, __pyx_t_6, __pyx_v_start_point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":280
 *             else:
 *                 bezier_cp[0,:] = start_point
 *                 bezier_cp[1,:] = seg.c1             # <<<<<<<<<<<<<<
 *                 bezier_cp[2,:] = seg.c2
 *                 bezier_cp[3,:] = seg.end_point
 */
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_seg, __pyx_n_s__c1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      if (PyObject_SetItem(__pyx_v_bezier_cp, __pyx_t_2, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":281
 *                 bezier_cp[0,:] = start_point
 *                 bezier_cp[1,:] = seg.c1
 *                 bezier_cp[2,:] = seg.c2             # <<<<<<<<<<<<<<
 *                 bezier_cp[3,:] = seg.end_point
 *                 if method == self.adaptive:
 */
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_seg, __pyx_n_s__c2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      if (PyObject_SetItem(__pyx_v_bezier_cp, __pyx_t_3, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":282
 *                 bezier_cp[1,:] = seg.c1
 *                 bezier_cp[2,:] = seg.c2
 *                 bezier_cp[3,:] = seg.end_point             # <<<<<<<<<<<<<<
 *                 if method == self.adaptive:
 *                     tseg = adaptive_bezier(bezier_cp)
 */
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_seg, __pyx_n_s__end_point); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      if (PyObject_SetItem(__pyx_v_bezier_cp, __pyx_t_2, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":283
 *                 bezier_cp[2,:] = seg.c2
 *                 bezier_cp[3,:] = seg.end_point
 *                 if method == self.adaptive:             # <<<<<<<<<<<<<<
 *                     tseg = adaptive_bezier(bezier_cp)
 *                 elif method == self.regular:
 */
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__adaptive); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_method, __pyx_t_6, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_5) {

        /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":284
 *                 bezier_cp[3,:] = seg.end_point
 *                 if method == self.adaptive:
 *                     tseg = adaptive_bezier(bezier_cp)             # <<<<<<<<<<<<<<
 *                 elif method == self.regular:
 *                     tseg = bezier(bezier_cp, res)
 */
        if (!(likely(((__pyx_v_bezier_cp) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_bezier_cp, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = ((PyObject *)__pyx_f_7potrace_6bezier_adaptive_bezier(((PyArrayObject *)__pyx_v_bezier_cp))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_v_tseg);
        __pyx_v_tseg = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L9;
      }

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":285
 *                 if method == self.adaptive:
 *                     tseg = adaptive_bezier(bezier_cp)
 *                 elif method == self.regular:             # <<<<<<<<<<<<<<
 *                     tseg = bezier(bezier_cp, res)
 *                 tess_segs.append(tseg)
 */
      __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__regular); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_method, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_5) {

        /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":286
 *                     tseg = adaptive_bezier(bezier_cp)
 *                 elif method == self.regular:
 *                     tseg = bezier(bezier_cp, res)             # <<<<<<<<<<<<<<
 *                 tess_segs.append(tseg)
 *                 num_verts += len(tseg)
 */
        if (!(likely(((__pyx_v_bezier_cp) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_bezier_cp, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_res); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_8.__pyx_n = 1;
        __pyx_t_8.steps = __pyx_t_7;
        __pyx_t_6 = ((PyObject *)__pyx_f_7potrace_6bezier_bezier(((PyArrayObject *)__pyx_v_bezier_cp), &__pyx_t_8)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_v_tseg);
        __pyx_v_tseg = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":287
 *                 elif method == self.regular:
 *                     tseg = bezier(bezier_cp, res)
 *                 tess_segs.append(tseg)             # <<<<<<<<<<<<<<
 *                 num_verts += len(tseg)
 *             start_point = seg.end_point
 */
      __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_tess_segs, __pyx_v_tseg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":288
 *                     tseg = bezier(bezier_cp, res)
 *                 tess_segs.append(tseg)
 *                 num_verts += len(tseg)             # <<<<<<<<<<<<<<
 *             start_point = seg.end_point
 *         # Create result buffer
 */
      __pyx_t_9 = PyObject_Length(__pyx_v_tseg); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_num_verts, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_v_num_verts);
      __pyx_v_num_verts = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_L8:;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":289
 *                 tess_segs.append(tseg)
 *                 num_verts += len(tseg)
 *             start_point = seg.end_point             # <<<<<<<<<<<<<<
 *         # Create result buffer
 *         ret = np.empty((num_verts, 2))
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_seg, __pyx_n_s__end_point); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_start_point);
    __pyx_v_start_point = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":291
 *             start_point = seg.end_point
 *         # Create result buffer
 *         ret = np.empty((num_verts, 2))             # <<<<<<<<<<<<<<
 *         cur_index = 0
 *         for seg in tess_segs:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_num_verts);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_num_verts);
  __Pyx_GIVEREF(__pyx_v_num_verts);
  __Pyx_INCREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_v_ret);
  __pyx_v_ret = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":292
 *         # Create result buffer
 *         ret = np.empty((num_verts, 2))
 *         cur_index = 0             # <<<<<<<<<<<<<<
 *         for seg in tess_segs:
 *             num_verts = len(seg)
 */
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_DECREF(__pyx_v_cur_index);
  __pyx_v_cur_index = __pyx_int_0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":293
 *         ret = np.empty((num_verts, 2))
 *         cur_index = 0
 *         for seg in tess_segs:             # <<<<<<<<<<<<<<
 *             num_verts = len(seg)
 *             ret[cur_index:cur_index + num_verts] = seg
 */
  if (PyList_CheckExact(__pyx_v_tess_segs) || PyTuple_CheckExact(__pyx_v_tess_segs)) {
    __pyx_t_4 = 0; __pyx_t_1 = __pyx_v_tess_segs; __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_tess_segs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_1))) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
    } else {
      __pyx_t_6 = PyIter_Next(__pyx_t_1);
      if (!__pyx_t_6) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_DECREF(__pyx_v_seg);
    __pyx_v_seg = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":294
 *         cur_index = 0
 *         for seg in tess_segs:
 *             num_verts = len(seg)             # <<<<<<<<<<<<<<
 *             ret[cur_index:cur_index + num_verts] = seg
 *             cur_index += num_verts
 */
    __pyx_t_9 = PyObject_Length(__pyx_v_seg); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_v_num_verts);
    __pyx_v_num_verts = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":295
 *         for seg in tess_segs:
 *             num_verts = len(seg)
 *             ret[cur_index:cur_index + num_verts] = seg             # <<<<<<<<<<<<<<
 *             cur_index += num_verts
 *         return ret
 */
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_cur_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = PyNumber_Add(__pyx_v_cur_index, __pyx_v_num_verts); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PySequence_SetSlice(__pyx_v_ret, __pyx_t_9, __pyx_t_10, __pyx_v_seg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":296
 *             num_verts = len(seg)
 *             ret[cur_index:cur_index + num_verts] = seg
 *             cur_index += num_verts             # <<<<<<<<<<<<<<
 *         return ret
 * 
 */
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_cur_index, __pyx_v_num_verts); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_v_cur_index);
    __pyx_v_cur_index = __pyx_t_6;
    __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":297
 *             ret[cur_index:cur_index + num_verts] = seg
 *             cur_index += num_verts
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("potrace._potrace.Curve.tesselate");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_num_verts);
  __Pyx_DECREF(__pyx_v_tess_segs);
  __Pyx_DECREF(__pyx_v_start_point);
  __Pyx_DECREF(__pyx_v_bezier_cp);
  __Pyx_DECREF(__pyx_v_seg);
  __Pyx_DECREF(__pyx_v_tseg);
  __Pyx_DECREF(__pyx_v_ret);
  __Pyx_DECREF(__pyx_v_cur_index);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_method);
  __Pyx_DECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":299
 *         return ret
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.segments)
 * 
 */

static PyObject *__pyx_pf_7potrace_8_potrace_5Curve___iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_5Curve___iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":300
 * 
 *     def __iter__(self):
 *         return iter(self.segments)             # <<<<<<<<<<<<<<
 * 
 *     cdef append_bezier(self, potrace_dpoint_s *c1, potrace_dpoint_s *c2,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_v_self)->segments)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.Curve.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":302
 *         return iter(self.segments)
 * 
 *     cdef append_bezier(self, potrace_dpoint_s *c1, potrace_dpoint_s *c2,             # <<<<<<<<<<<<<<
 *             potrace_dpoint_s *end_point):
 *         self.segments.append(BezierSegment((c1.x, c1.y), (c2.x, c2.y),
 */

static  PyObject *__pyx_f_7potrace_8_potrace_5Curve_append_bezier(struct __pyx_obj_7potrace_8_potrace_Curve *__pyx_v_self, struct potrace_dpoint_s *__pyx_v_c1, struct potrace_dpoint_s *__pyx_v_c2, struct potrace_dpoint_s *__pyx_v_end_point) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("append_bezier");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":304
 *     cdef append_bezier(self, potrace_dpoint_s *c1, potrace_dpoint_s *c2,
 *             potrace_dpoint_s *end_point):
 *         self.segments.append(BezierSegment((c1.x, c1.y), (c2.x, c2.y),             # <<<<<<<<<<<<<<
 *             (end_point.x, end_point.y)))
 * 
 */
  if (unlikely(__pyx_v_self->segments == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_c1->x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_c1->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_c2->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_c2->y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":305
 *             potrace_dpoint_s *end_point):
 *         self.segments.append(BezierSegment((c1.x, c1.y), (c2.x, c2.y),
 *             (end_point.x, end_point.y)))             # <<<<<<<<<<<<<<
 * 
 *     cdef append_corner(self, potrace_dpoint_s *c, potrace_dpoint_s *end_point):
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_end_point->x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_end_point->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7potrace_8_potrace_BezierSegment)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_self->segments), __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("potrace._potrace.Curve.append_bezier");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":307
 *             (end_point.x, end_point.y)))
 * 
 *     cdef append_corner(self, potrace_dpoint_s *c, potrace_dpoint_s *end_point):             # <<<<<<<<<<<<<<
 *         self.segments.append(CornerSegment((c.x, c.y), (end_point.x,
 *             end_point.y)))
 */

static  PyObject *__pyx_f_7potrace_8_potrace_5Curve_append_corner(struct __pyx_obj_7potrace_8_potrace_Curve *__pyx_v_self, struct potrace_dpoint_s *__pyx_v_c, struct potrace_dpoint_s *__pyx_v_end_point) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("append_corner");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":308
 * 
 *     cdef append_corner(self, potrace_dpoint_s *c, potrace_dpoint_s *end_point):
 *         self.segments.append(CornerSegment((c.x, c.y), (end_point.x,             # <<<<<<<<<<<<<<
 *             end_point.y)))
 * 
 */
  if (unlikely(__pyx_v_self->segments == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_c->x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_c->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_end_point->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":309
 *     cdef append_corner(self, potrace_dpoint_s *c, potrace_dpoint_s *end_point):
 *         self.segments.append(CornerSegment((c.x, c.y), (end_point.x,
 *             end_point.y)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_end_point->y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7potrace_8_potrace_CornerSegment)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_self->segments), __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("potrace._potrace.Curve.append_corner");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":317
 *     """
 * 
 *     cdef public list curves             # <<<<<<<<<<<<<<
 *     cdef public list curves_tree
 * 
 */

static PyObject *__pyx_pf_7potrace_8_potrace_4Path_6curves___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_4Path_6curves___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_4Path_6curves___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_4Path_6curves___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves));
  ((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.Path.curves.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":318
 * 
 *     cdef public list curves
 *     cdef public list curves_tree             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */

static PyObject *__pyx_pf_7potrace_8_potrace_4Path_11curves_tree___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_4Path_11curves_tree___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves_tree));
  __pyx_r = ((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves_tree);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7potrace_8_potrace_4Path_11curves_tree___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_7potrace_8_potrace_4Path_11curves_tree___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves_tree);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves_tree));
  ((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves_tree = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("potrace._potrace.Path.curves_tree.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":320
 *     cdef public list curves_tree
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.curves = []
 *         self.curves_tree = []
 */

static int __pyx_pf_7potrace_8_potrace_4Path___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_7potrace_8_potrace_4Path___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":321
 * 
 *     def __init__(self):
 *         self.curves = []             # <<<<<<<<<<<<<<
 *         self.curves_tree = []
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves));
  ((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":322
 *     def __init__(self):
 *         self.curves = []
 *         self.curves_tree = []             # <<<<<<<<<<<<<<
 * 
 *     cdef append_curve(self, potrace_curve_s *curve):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves_tree);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves_tree));
  ((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves_tree = __pyx_t_1;
  __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.Path.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":324
 *         self.curves_tree = []
 * 
 *     cdef append_curve(self, potrace_curve_s *curve):             # <<<<<<<<<<<<<<
 *         cdef potrace_dpoint_s *c1, *c2, *end_point
 *         cdef Curve new_curve = Curve()
 */

static  PyObject *__pyx_f_7potrace_8_potrace_4Path_append_curve(struct __pyx_obj_7potrace_8_potrace_Path *__pyx_v_self, struct potrace_curve_s *__pyx_v_curve) {
  struct potrace_dpoint_s *__pyx_v_c1;
  struct potrace_dpoint_s *__pyx_v_c2;
  struct potrace_dpoint_s *__pyx_v_end_point;
  struct __pyx_obj_7potrace_8_potrace_Curve *__pyx_v_new_curve = 0;
  PyObject *__pyx_v_i;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("append_curve");
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":326
 *     cdef append_curve(self, potrace_curve_s *curve):
 *         cdef potrace_dpoint_s *c1, *c2, *end_point
 *         cdef Curve new_curve = Curve()             # <<<<<<<<<<<<<<
 *         for i in range(curve.n):
 *             c1 = &curve.c[i][0]
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7potrace_8_potrace_Curve)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new_curve = ((struct __pyx_obj_7potrace_8_potrace_Curve *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":327
 *         cdef potrace_dpoint_s *c1, *c2, *end_point
 *         cdef Curve new_curve = Curve()
 *         for i in range(curve.n):             # <<<<<<<<<<<<<<
 *             c1 = &curve.c[i][0]
 *             c2 = &curve.c[i][1]
 */
  __pyx_t_1 = PyInt_FromLong(__pyx_v_curve->n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
    } else {
      __pyx_t_1 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_1) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":328
 *         cdef Curve new_curve = Curve()
 *         for i in range(curve.n):
 *             c1 = &curve.c[i][0]             # <<<<<<<<<<<<<<
 *             c2 = &curve.c[i][1]
 *             end_point = &curve.c[i][2]
 */
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c1 = (&((__pyx_v_curve->c[__pyx_t_4])[0]));

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":329
 *         for i in range(curve.n):
 *             c1 = &curve.c[i][0]
 *             c2 = &curve.c[i][1]             # <<<<<<<<<<<<<<
 *             end_point = &curve.c[i][2]
 *             if curve.tag[i] == POTRACE_CURVETO:
 */
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_c2 = (&((__pyx_v_curve->c[__pyx_t_4])[1]));

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":330
 *             c1 = &curve.c[i][0]
 *             c2 = &curve.c[i][1]
 *             end_point = &curve.c[i][2]             # <<<<<<<<<<<<<<
 *             if curve.tag[i] == POTRACE_CURVETO:
 *                 new_curve.append_bezier(c1, c2, end_point)
 */
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_end_point = (&((__pyx_v_curve->c[__pyx_t_4])[2]));

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":331
 *             c2 = &curve.c[i][1]
 *             end_point = &curve.c[i][2]
 *             if curve.tag[i] == POTRACE_CURVETO:             # <<<<<<<<<<<<<<
 *                 new_curve.append_bezier(c1, c2, end_point)
 *             elif curve.tag[i] == POTRACE_CORNER:
 */
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = ((__pyx_v_curve->tag[__pyx_t_4]) == POTRACE_CURVETO);
    if (__pyx_t_5) {

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":332
 *             end_point = &curve.c[i][2]
 *             if curve.tag[i] == POTRACE_CURVETO:
 *                 new_curve.append_bezier(c1, c2, end_point)             # <<<<<<<<<<<<<<
 *             elif curve.tag[i] == POTRACE_CORNER:
 *                 new_curve.append_corner(c2, end_point)
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_7potrace_8_potrace_Curve *)__pyx_v_new_curve->__pyx_vtab)->append_bezier(__pyx_v_new_curve, __pyx_v_c1, __pyx_v_c2, __pyx_v_end_point); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":333
 *             if curve.tag[i] == POTRACE_CURVETO:
 *                 new_curve.append_bezier(c1, c2, end_point)
 *             elif curve.tag[i] == POTRACE_CORNER:             # <<<<<<<<<<<<<<
 *                 new_curve.append_corner(c2, end_point)
 *         self.curves.append(new_curve)
 */
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = ((__pyx_v_curve->tag[__pyx_t_4]) == POTRACE_CORNER);
    if (__pyx_t_5) {

      /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":334
 *                 new_curve.append_bezier(c1, c2, end_point)
 *             elif curve.tag[i] == POTRACE_CORNER:
 *                 new_curve.append_corner(c2, end_point)             # <<<<<<<<<<<<<<
 *         self.curves.append(new_curve)
 *         return new_curve
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_7potrace_8_potrace_Curve *)__pyx_v_new_curve->__pyx_vtab)->append_corner(__pyx_v_new_curve, __pyx_v_c2, __pyx_v_end_point); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":335
 *             elif curve.tag[i] == POTRACE_CORNER:
 *                 new_curve.append_corner(c2, end_point)
 *         self.curves.append(new_curve)             # <<<<<<<<<<<<<<
 *         return new_curve
 * 
 */
  if (unlikely(__pyx_v_self->curves == Py_None)) {
    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_self->curves), ((PyObject *)__pyx_v_new_curve)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":336
 *                 new_curve.append_corner(c2, end_point)
 *         self.curves.append(new_curve)
 *         return new_curve             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_new_curve));
  __pyx_r = ((PyObject *)__pyx_v_new_curve);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("potrace._potrace.Path.append_curve");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new_curve);
  __Pyx_DECREF(__pyx_v_i);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":338
 *         return new_curve
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.curves)
 * 
 */

static PyObject *__pyx_pf_7potrace_8_potrace_4Path___iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_7potrace_8_potrace_4Path___iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__iter__");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":339
 * 
 *     def __iter__(self):
 *         return iter(self.curves)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_v_self)->curves)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.Path.__iter__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":342
 * 
 * 
 * def potracelib_version():             # <<<<<<<<<<<<<<
 *     """
 *     Return the potrace library version.
 */

static PyObject *__pyx_pf_7potrace_8_potrace_potracelib_version(PyObject *__pyx_self, PyObject *unused); /*proto*/
static char __pyx_doc_7potrace_8_potrace_potracelib_version[] = "\n    Return the potrace library version.\n    ";
static PyObject *__pyx_pf_7potrace_8_potrace_potracelib_version(PyObject *__pyx_self, PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("potracelib_version");
  __pyx_self = __pyx_self;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":346
 *     Return the potrace library version.
 *     """
 *     return PyString_FromString(potrace_version())             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyString_FromString(potrace_version()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.potracelib_version");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":351
 * # Utility functions
 * 
 * cdef void setpixel(potrace_bitmap_s *bmp, int x, int y, int on):             # <<<<<<<<<<<<<<
 *     """
 *     Set a pixel on or off in a potrace_bitmap_s.
 */

static  void __pyx_f_7potrace_8_potrace_setpixel(struct potrace_bitmap_s *__pyx_v_bmp, int __pyx_v_x, int __pyx_v_y, int __pyx_v_on) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("setpixel");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":355
 *     Set a pixel on or off in a potrace_bitmap_s.
 *     """
 *     if on:             # <<<<<<<<<<<<<<
 *         bmp.map[y*bmp.dy + x/N] |= 1 << (N - 1 - x % N)
 *     else:
 */
  __pyx_t_1 = __pyx_v_on;
  if (__pyx_t_1) {

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":356
 *     """
 *     if on:
 *         bmp.map[y*bmp.dy + x/N] |= 1 << (N - 1 - x % N)             # <<<<<<<<<<<<<<
 *     else:
 *         bmp.map[y*bmp.dy + x/N] &= ~(1 << (N - 1 - x % N))
 */
    if (unlikely(__pyx_v_7potrace_8_potrace_N == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (unlikely(__pyx_v_7potrace_8_potrace_N == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_7potrace_8_potrace_N == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_x))) {
      PyErr_Format(PyExc_OverflowError, "value too large to perform division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_bmp->map[((__pyx_v_y * __pyx_v_bmp->dy) + __Pyx_div_int(__pyx_v_x, __pyx_v_7potrace_8_potrace_N))]) |= (1 << ((__pyx_v_7potrace_8_potrace_N - 1) - __Pyx_mod_int(__pyx_v_x, __pyx_v_7potrace_8_potrace_N)));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":358
 *         bmp.map[y*bmp.dy + x/N] |= 1 << (N - 1 - x % N)
 *     else:
 *         bmp.map[y*bmp.dy + x/N] &= ~(1 << (N - 1 - x % N))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (unlikely(__pyx_v_7potrace_8_potrace_N == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (unlikely(__pyx_v_7potrace_8_potrace_N == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_7potrace_8_potrace_N == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_x))) {
      PyErr_Format(PyExc_OverflowError, "value too large to perform division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    (__pyx_v_bmp->map[((__pyx_v_y * __pyx_v_bmp->dy) + __Pyx_div_int(__pyx_v_x, __pyx_v_7potrace_8_potrace_N))]) &= (~(1 << ((__pyx_v_7potrace_8_potrace_N - 1) - __Pyx_mod_int(__pyx_v_x, __pyx_v_7potrace_8_potrace_N))));
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("potrace._potrace.setpixel");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":361
 * 
 * 
 * cdef State state_from_ptr(potrace_state_s *state):             # <<<<<<<<<<<<<<
 *     """
 *     Create a State wrapping a C potrace_state_s pointer.
 */

static  struct __pyx_obj_7potrace_8_potrace_State *__pyx_f_7potrace_8_potrace_state_from_ptr(struct potrace_state_s *__pyx_v_state) {
  struct __pyx_obj_7potrace_8_potrace_State *__pyx_v_ret = 0;
  struct __pyx_obj_7potrace_8_potrace_State *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("state_from_ptr");

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":365
 *     Create a State wrapping a C potrace_state_s pointer.
 *     """
 *     cdef State ret = State()             # <<<<<<<<<<<<<<
 *     ret.po_state = state
 *     return ret
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7potrace_8_potrace_State)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret = ((struct __pyx_obj_7potrace_8_potrace_State *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":366
 *     """
 *     cdef State ret = State()
 *     ret.po_state = state             # <<<<<<<<<<<<<<
 *     return ret
 * 
 */
  __pyx_v_ret->po_state = __pyx_v_state;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":367
 *     cdef State ret = State()
 *     ret.po_state = state
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_7potrace_8_potrace_State *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.state_from_ptr");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":370
 * 
 * 
 * cdef Path path_from_ptr(potrace_path_s *plist):             # <<<<<<<<<<<<<<
 *     """
 *     Create a Path instance containing a copy of the paths defined in *plist*.
 */

static  struct __pyx_obj_7potrace_8_potrace_Path *__pyx_f_7potrace_8_potrace_path_from_ptr(struct potrace_path_s *__pyx_v_plist) {
  struct potrace_path_s *__pyx_v_cur_path;
  struct __pyx_obj_7potrace_8_potrace_Path *__pyx_v_path = 0;
  PyObject *__pyx_v_curves_map;
  struct __pyx_obj_7potrace_8_potrace_Path *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("path_from_ptr");
  __pyx_v_curves_map = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":374
 *     Create a Path instance containing a copy of the paths defined in *plist*.
 *     """
 *     cdef potrace_path_s *cur_path = plist             # <<<<<<<<<<<<<<
 *     cdef Path path = Path()
 *     # Store linear structure
 */
  __pyx_v_cur_path = __pyx_v_plist;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":375
 *     """
 *     cdef potrace_path_s *cur_path = plist
 *     cdef Path path = Path()             # <<<<<<<<<<<<<<
 *     # Store linear structure
 *     curves_map = {}
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7potrace_8_potrace_Path)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_path = ((struct __pyx_obj_7potrace_8_potrace_Path *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":377
 *     cdef Path path = Path()
 *     # Store linear structure
 *     curves_map = {}             # <<<<<<<<<<<<<<
 *     while cur_path != NULL:
 *         curves_map[<int>cur_path] = path.append_curve(&cur_path.curve)
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_v_curves_map);
  __pyx_v_curves_map = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":378
 *     # Store linear structure
 *     curves_map = {}
 *     while cur_path != NULL:             # <<<<<<<<<<<<<<
 *         curves_map[<int>cur_path] = path.append_curve(&cur_path.curve)
 *         cur_path = cur_path.next
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_cur_path != NULL);
    if (!__pyx_t_2) break;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":379
 *     curves_map = {}
 *     while cur_path != NULL:
 *         curves_map[<int>cur_path] = path.append_curve(&cur_path.curve)             # <<<<<<<<<<<<<<
 *         cur_path = cur_path.next
 *     # Store tree structure
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_7potrace_8_potrace_Path *)__pyx_v_path->__pyx_vtab)->append_curve(__pyx_v_path, (&__pyx_v_cur_path->curve)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = ((int)__pyx_v_cur_path);
    if (__Pyx_SetItemInt(__pyx_v_curves_map, __pyx_t_3, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":380
 *     while cur_path != NULL:
 *         curves_map[<int>cur_path] = path.append_curve(&cur_path.curve)
 *         cur_path = cur_path.next             # <<<<<<<<<<<<<<
 *     # Store tree structure
 *     init_curves_tree(path.curves_tree, curves_map, plist)
 */
    __pyx_v_cur_path = __pyx_v_cur_path->next;
  }

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":382
 *         cur_path = cur_path.next
 *     # Store tree structure
 *     init_curves_tree(path.curves_tree, curves_map, plist)             # <<<<<<<<<<<<<<
 *     return path
 * 
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_curves_map))||((__pyx_v_curves_map) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_curves_map)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_f_7potrace_8_potrace_init_curves_tree(__pyx_v_path->curves_tree, ((PyObject *)__pyx_v_curves_map), __pyx_v_plist); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":383
 *     # Store tree structure
 *     init_curves_tree(path.curves_tree, curves_map, plist)
 *     return path             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_path));
  __pyx_r = __pyx_v_path;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_7potrace_8_potrace_Path *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("potrace._potrace.path_from_ptr");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_path);
  __Pyx_DECREF(__pyx_v_curves_map);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":386
 * 
 * 
 * cdef init_curves_tree(list child_list, dict curves_map, potrace_path_s *plist):             # <<<<<<<<<<<<<<
 *     """
 *     Init a curves tree structure.
 */

static  PyObject *__pyx_f_7potrace_8_potrace_init_curves_tree(PyObject *__pyx_v_child_list, PyObject *__pyx_v_curves_map, struct potrace_path_s *__pyx_v_plist) {
  struct potrace_path_s *__pyx_v_cur_path;
  PyObject *__pyx_v_cur_curve;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("init_curves_tree");
  __Pyx_INCREF(__pyx_v_child_list);
  __Pyx_INCREF(__pyx_v_curves_map);
  __pyx_v_cur_curve = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":390
 *     Init a curves tree structure.
 *     """
 *     cdef potrace_path_s *cur_path = plist             # <<<<<<<<<<<<<<
 *     if plist == NULL:
 *         return
 */
  __pyx_v_cur_path = __pyx_v_plist;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":391
 *     """
 *     cdef potrace_path_s *cur_path = plist
 *     if plist == NULL:             # <<<<<<<<<<<<<<
 *         return
 *     while cur_path != NULL:
 */
  __pyx_t_1 = (__pyx_v_plist == NULL);
  if (__pyx_t_1) {

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":392
 *     cdef potrace_path_s *cur_path = plist
 *     if plist == NULL:
 *         return             # <<<<<<<<<<<<<<
 *     while cur_path != NULL:
 *         cur_curve = curves_map[<int>cur_path]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":393
 *     if plist == NULL:
 *         return
 *     while cur_path != NULL:             # <<<<<<<<<<<<<<
 *         cur_curve = curves_map[<int>cur_path]
 *         child_list.append(cur_curve)
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_cur_path != NULL);
    if (!__pyx_t_1) break;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":394
 *         return
 *     while cur_path != NULL:
 *         cur_curve = curves_map[<int>cur_path]             # <<<<<<<<<<<<<<
 *         child_list.append(cur_curve)
 *         init_curves_tree(cur_curve.children, curves_map, cur_path.childlist)
 */
    __pyx_t_2 = ((int)__pyx_v_cur_path);
    __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_curves_map), __pyx_t_2, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_cur_curve);
    __pyx_v_cur_curve = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":395
 *     while cur_path != NULL:
 *         cur_curve = curves_map[<int>cur_path]
 *         child_list.append(cur_curve)             # <<<<<<<<<<<<<<
 *         init_curves_tree(cur_curve.children, curves_map, cur_path.childlist)
 *         cur_path = cur_path.sibling
 */
    if (unlikely(__pyx_v_child_list == Py_None)) {
      PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_2 = PyList_Append(((PyObject *)__pyx_v_child_list), __pyx_v_cur_curve); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":396
 *         cur_curve = curves_map[<int>cur_path]
 *         child_list.append(cur_curve)
 *         init_curves_tree(cur_curve.children, curves_map, cur_path.childlist)             # <<<<<<<<<<<<<<
 *         cur_path = cur_path.sibling
 * 
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_cur_curve, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_f_7potrace_8_potrace_init_curves_tree(((PyObject *)__pyx_t_3), __pyx_v_curves_map, __pyx_v_cur_path->childlist); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":397
 *         child_list.append(cur_curve)
 *         init_curves_tree(cur_curve.children, curves_map, cur_path.childlist)
 *         cur_path = cur_path.sibling             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_cur_path = __pyx_v_cur_path->sibling;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("potrace._potrace.init_curves_tree");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_cur_curve);
  __Pyx_DECREF(__pyx_v_child_list);
  __Pyx_DECREF(__pyx_v_curves_map);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":187
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_v_hasfields;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  char *__pyx_t_9;
  __Pyx_RefNannySetupContext("__getbuffer__");
  if (__pyx_v_info == NULL) return 0;
  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_info->obj);
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":193
 *             # of flags
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":194
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":196
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self));

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":198
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":199
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":201
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L5:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":203
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":204
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
    __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":205
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_11));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":207
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
  if (__pyx_t_3) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":208
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
    __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS));
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":209
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_12));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_12));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12));
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":211
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self));

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":212
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info. This is allocated
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":213
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info. This is allocated
 *                 # as one block, strides first.
 */
  __pyx_t_6 = __pyx_v_copy_shape;
  if (__pyx_t_6) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":216
 *                 # Allocate new buffer for strides and shape info. This is allocated
 *                 # as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2)));

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":217
 *                 # as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":218
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_6 = __pyx_v_ndim;
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
      __pyx_v_i = __pyx_t_7;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":219
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":220
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
    }
    goto __pyx_L8;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":222
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self)));

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":223
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self)));
  }
  __pyx_L8:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":224
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":225
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self));

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":226
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":229
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":230
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 *             cdef int offset
 */
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr));
  __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":234
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":236
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  __pyx_t_2 = (!__pyx_v_hasfields);
  if (__pyx_t_2) {
    __pyx_t_3 = (!__pyx_v_copy_shape);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":238
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":241
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = __pyx_v_self;
  }
  __pyx_L11:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":243
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 */
  __pyx_t_1 = (!__pyx_v_hasfields);
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":244
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 */
    __pyx_v_t = __pyx_v_descr->type_num;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":245
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
    if (__pyx_t_1) {
      __pyx_t_2 = __pyx_v_little_endian;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":246
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
      if (__pyx_t_1) {
        __pyx_t_3 = (!__pyx_v_little_endian);
        __pyx_t_8 = __pyx_t_3;
      } else {
        __pyx_t_8 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_8;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":247
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)__pyx_kp_u_13));
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_13));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13));
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":248
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__b;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":249
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__B;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":250
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__h;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":251
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__H;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":252
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_INT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__i;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":253
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__I;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":254
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__l;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":255
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__L;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":256
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__q;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":257
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Q;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":258
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__f;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":259
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__d;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":260
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__g;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":261
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zf;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":262
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zd;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":263
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zg;
      goto __pyx_L14;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":264
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__O;
      goto __pyx_L14;
    }
    /*else*/ {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":266
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L14:;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":267
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":268
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":270
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":271
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":272
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":275
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)             # <<<<<<<<<<<<<<
 *                 f[0] = 0 # Terminate format string
 * 
 */
    __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":276
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = 0;
  }
  __pyx_L12:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__");
  __pyx_r = -1;
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":278
 *                 f[0] = 0 # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":279
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self));
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":280
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":281
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":282
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L6;
  }
  __pyx_L6:;

  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":755
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1");

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":756
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":758
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2");

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":759
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":761
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3");

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":762
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":764
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4");

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":765
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":767
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5");

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":768
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":770
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields;
  PyObject *__pyx_v_childname;
  PyObject *__pyx_v_new_offset;
  PyObject *__pyx_v_t;
  char *__pyx_r;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  char *__pyx_t_10;
  __Pyx_RefNannySetupContext("_util_dtypestring");
  __Pyx_INCREF((PyObject *)__pyx_v_descr);
  __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":777
 *     cdef int delta_offset
 *     cdef tuple i
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":778
 *     cdef tuple i
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":781
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) {
    __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    __Pyx_DECREF(__pyx_v_childname);
    __pyx_v_childname = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":782
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_fields));
    __pyx_v_fields = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":783
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 */
    if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) {
      PyObject* tuple = ((PyObject *)__pyx_v_fields);
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_v_child));
      __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_new_offset);
      __pyx_v_new_offset = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2);
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":785
 *         child, new_offset = fields
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":786
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_kp_u_15));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_15));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15));
      __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":788
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_6 = (__pyx_v_child->byteorder == '>');
    if (__pyx_t_6) {
      __pyx_t_7 = __pyx_v_little_endian;
    } else {
      __pyx_t_7 = __pyx_t_6;
    }
    if (!__pyx_t_7) {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":789
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
      __pyx_t_6 = (__pyx_v_child->byteorder == '<');
      if (__pyx_t_6) {
        __pyx_t_8 = (!__pyx_v_little_endian);
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_6;
      }
      __pyx_t_6 = __pyx_t_9;
    } else {
      __pyx_t_6 = __pyx_t_7;
    }
    if (__pyx_t_6) {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":790
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_kp_u_13));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_13));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13));
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":800
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_6) break;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":801
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":802
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f += 1;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":803
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      (__pyx_v_offset[0]) += 1;
    }

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":805
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    (__pyx_v_offset[0]) += __pyx_v_child->elsize;

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":807
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child));
    if (__pyx_t_6) {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":808
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":809
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5);
      if (__pyx_t_6) {

        /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":810
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_kp_u_16));
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_16));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16));
        __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":813
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":814
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":815
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":816
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":817
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":818
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":819
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":820
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":821
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":822
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":823
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":824
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":825
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":826
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f += 1;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":827
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f += 1;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":828
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f += 1;
        goto __pyx_L11;
      }

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":829
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":831
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L11:;

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":832
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f += 1;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":836
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_10;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":837
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("numpy._util_dtypestring");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_child);
  __Pyx_DECREF(__pyx_v_fields);
  __Pyx_DECREF(__pyx_v_childname);
  __Pyx_DECREF(__pyx_v_new_offset);
  __Pyx_DECREF(__pyx_v_t);
  __Pyx_DECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":952
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("set_array_base");
  __Pyx_INCREF((PyObject *)__pyx_v_arr);
  __Pyx_INCREF(__pyx_v_base);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":954
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":955
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":957
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
    Py_INCREF(__pyx_v_base);

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":958
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":959
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":960
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  __Pyx_DECREF((PyObject *)__pyx_v_arr);
  __Pyx_DECREF(__pyx_v_base);
  __Pyx_RefNannyFinishContext();
}

/* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":962
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base");
  __Pyx_INCREF((PyObject *)__pyx_v_arr);

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":963
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_arr->base == NULL);
  if (__pyx_t_1) {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":964
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":966
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_7potrace_8_potrace_Bitmap __pyx_vtable_7potrace_8_potrace_Bitmap;

static PyObject *__pyx_tp_new_7potrace_8_potrace_Bitmap(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7potrace_8_potrace_Bitmap *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_7potrace_8_potrace_Bitmap *)o);
  p->__pyx_vtab = __pyx_vtabptr_7potrace_8_potrace_Bitmap;
  p->_data = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  if (__pyx_pf_7potrace_8_potrace_6Bitmap___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7potrace_8_potrace_Bitmap(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_Bitmap *p = (struct __pyx_obj_7potrace_8_potrace_Bitmap *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_7potrace_8_potrace_6Bitmap___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->_data));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7potrace_8_potrace_Bitmap(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7potrace_8_potrace_Bitmap *p = (struct __pyx_obj_7potrace_8_potrace_Bitmap *)o;
  if (p->_data) {
    e = (*v)(((PyObject*)p->_data), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7potrace_8_potrace_Bitmap(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_Bitmap *p = (struct __pyx_obj_7potrace_8_potrace_Bitmap *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_data);
  p->_data = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7potrace_8_potrace_6Bitmap_data(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_6Bitmap_4data___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_6Bitmap_data(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_6Bitmap_4data___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyMethodDef __pyx_methods_7potrace_8_potrace_Bitmap[] = {
  {__Pyx_NAMESTR("trace"), (PyCFunction)__pyx_pf_7potrace_8_potrace_6Bitmap_trace, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7potrace_8_potrace_6Bitmap_trace)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7potrace_8_potrace_Bitmap[] = {
  {(char *)"data", __pyx_getprop_7potrace_8_potrace_6Bitmap_data, __pyx_setprop_7potrace_8_potrace_6Bitmap_data, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Bitmap = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Bitmap = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Bitmap = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Bitmap = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_7potrace_8_potrace_Bitmap = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("potrace._potrace.Bitmap"), /*tp_name*/
  sizeof(struct __pyx_obj_7potrace_8_potrace_Bitmap), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7potrace_8_potrace_Bitmap, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Bitmap, /*tp_as_number*/
  &__pyx_tp_as_sequence_Bitmap, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Bitmap, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Bitmap, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Create a Bitmap instance.\n\n    The constructor *data* argument should be a 2D numpy array containing pixel\n    data. Pixels are only interpreted as zero or nonzero.\n    "), /*tp_doc*/
  __pyx_tp_traverse_7potrace_8_potrace_Bitmap, /*tp_traverse*/
  __pyx_tp_clear_7potrace_8_potrace_Bitmap, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7potrace_8_potrace_Bitmap, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7potrace_8_potrace_Bitmap, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_7potrace_8_potrace_6Bitmap___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7potrace_8_potrace_Bitmap, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_7potrace_8_potrace_Parameters(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  if (__pyx_pf_7potrace_8_potrace_10Parameters___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7potrace_8_potrace_Parameters(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_7potrace_8_potrace_10Parameters___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static struct PyMethodDef __pyx_methods_7potrace_8_potrace_Parameters[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Parameters = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Parameters = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Parameters = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Parameters = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_7potrace_8_potrace_Parameters = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("potrace._potrace.Parameters"), /*tp_name*/
  sizeof(struct __pyx_obj_7potrace_8_potrace_Parameters), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7potrace_8_potrace_Parameters, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Parameters, /*tp_as_number*/
  &__pyx_tp_as_sequence_Parameters, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Parameters, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Parameters, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  __Pyx_DOCSTR("\n    Stores parameters for the potrace_trace function.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7potrace_8_potrace_Parameters, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7potrace_8_potrace_Parameters, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_7potrace_8_potrace_State(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  if (__pyx_pf_7potrace_8_potrace_5State___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7potrace_8_potrace_State(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_7potrace_8_potrace_5State___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_7potrace_8_potrace_5State_ok(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_5State_2ok___get__(o);
}

static PyObject *__pyx_getprop_7potrace_8_potrace_5State_image(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_5State_5image___get__(o);
}

static struct PyMethodDef __pyx_methods_7potrace_8_potrace_State[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7potrace_8_potrace_State[] = {
  {(char *)"ok", __pyx_getprop_7potrace_8_potrace_5State_ok, 0, __Pyx_DOCSTR(__pyx_k_17), 0},
  {(char *)"image", __pyx_getprop_7potrace_8_potrace_5State_image, 0, __Pyx_DOCSTR(__pyx_k_18), 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_State = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_State = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_State = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_State = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_7potrace_8_potrace_State = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("potrace._potrace.State"), /*tp_name*/
  sizeof(struct __pyx_obj_7potrace_8_potrace_State), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7potrace_8_potrace_State, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_State, /*tp_as_number*/
  &__pyx_tp_as_sequence_State, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_State, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_State, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  __Pyx_DOCSTR("\n    Stores a potrace state struct.\n\n    Normally created with the :func:`state_from_ptr` function.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7potrace_8_potrace_State, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7potrace_8_potrace_State, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7potrace_8_potrace_State, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_7potrace_8_potrace_BezierSegment(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7potrace_8_potrace_BezierSegment *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_7potrace_8_potrace_BezierSegment *)o);
  p->c1 = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->c2 = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->end_point = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->is_corner = ((PyObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7potrace_8_potrace_BezierSegment(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_BezierSegment *p = (struct __pyx_obj_7potrace_8_potrace_BezierSegment *)o;
  Py_XDECREF(((PyObject *)p->c1));
  Py_XDECREF(((PyObject *)p->c2));
  Py_XDECREF(((PyObject *)p->end_point));
  Py_XDECREF(((PyObject *)p->is_corner));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7potrace_8_potrace_BezierSegment(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7potrace_8_potrace_BezierSegment *p = (struct __pyx_obj_7potrace_8_potrace_BezierSegment *)o;
  if (p->c1) {
    e = (*v)(p->c1, a); if (e) return e;
  }
  if (p->c2) {
    e = (*v)(p->c2, a); if (e) return e;
  }
  if (p->end_point) {
    e = (*v)(p->end_point, a); if (e) return e;
  }
  if (p->is_corner) {
    e = (*v)(p->is_corner, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7potrace_8_potrace_BezierSegment(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_BezierSegment *p = (struct __pyx_obj_7potrace_8_potrace_BezierSegment *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->c1);
  p->c1 = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->c2);
  p->c2 = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->end_point);
  p->end_point = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->is_corner);
  p->is_corner = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7potrace_8_potrace_13BezierSegment_c1(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_13BezierSegment_2c1___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_13BezierSegment_c1(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_13BezierSegment_2c1___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7potrace_8_potrace_13BezierSegment_c2(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_13BezierSegment_2c2___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_13BezierSegment_c2(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_13BezierSegment_2c2___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7potrace_8_potrace_13BezierSegment_end_point(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_13BezierSegment_9end_point___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_13BezierSegment_end_point(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_13BezierSegment_9end_point___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7potrace_8_potrace_13BezierSegment_is_corner(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_13BezierSegment_9is_corner___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_13BezierSegment_is_corner(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_13BezierSegment_9is_corner___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyMethodDef __pyx_methods_7potrace_8_potrace_BezierSegment[] = {
  {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_7potrace_8_potrace_13BezierSegment___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7potrace_8_potrace_BezierSegment[] = {
  {(char *)"c1", __pyx_getprop_7potrace_8_potrace_13BezierSegment_c1, __pyx_setprop_7potrace_8_potrace_13BezierSegment_c1, 0, 0},
  {(char *)"c2", __pyx_getprop_7potrace_8_potrace_13BezierSegment_c2, __pyx_setprop_7potrace_8_potrace_13BezierSegment_c2, 0, 0},
  {(char *)"end_point", __pyx_getprop_7potrace_8_potrace_13BezierSegment_end_point, __pyx_setprop_7potrace_8_potrace_13BezierSegment_end_point, 0, 0},
  {(char *)"is_corner", __pyx_getprop_7potrace_8_potrace_13BezierSegment_is_corner, __pyx_setprop_7potrace_8_potrace_13BezierSegment_is_corner, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_BezierSegment = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_BezierSegment = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_BezierSegment = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_BezierSegment = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_7potrace_8_potrace_BezierSegment = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("potrace._potrace.BezierSegment"), /*tp_name*/
  sizeof(struct __pyx_obj_7potrace_8_potrace_BezierSegment), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7potrace_8_potrace_BezierSegment, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  __pyx_pf_7potrace_8_potrace_13BezierSegment___repr__, /*tp_repr*/
  &__pyx_tp_as_number_BezierSegment, /*tp_as_number*/
  &__pyx_tp_as_sequence_BezierSegment, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BezierSegment, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_BezierSegment, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Represents a Bezier segment in a :class:`Curve` object.\n    "), /*tp_doc*/
  __pyx_tp_traverse_7potrace_8_potrace_BezierSegment, /*tp_traverse*/
  __pyx_tp_clear_7potrace_8_potrace_BezierSegment, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7potrace_8_potrace_BezierSegment, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7potrace_8_potrace_BezierSegment, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_7potrace_8_potrace_13BezierSegment___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7potrace_8_potrace_BezierSegment, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_7potrace_8_potrace_CornerSegment(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7potrace_8_potrace_CornerSegment *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_7potrace_8_potrace_CornerSegment *)o);
  p->c = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->end_point = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->is_corner = ((PyObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7potrace_8_potrace_CornerSegment(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_CornerSegment *p = (struct __pyx_obj_7potrace_8_potrace_CornerSegment *)o;
  Py_XDECREF(((PyObject *)p->c));
  Py_XDECREF(((PyObject *)p->end_point));
  Py_XDECREF(((PyObject *)p->is_corner));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7potrace_8_potrace_CornerSegment(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7potrace_8_potrace_CornerSegment *p = (struct __pyx_obj_7potrace_8_potrace_CornerSegment *)o;
  if (p->c) {
    e = (*v)(p->c, a); if (e) return e;
  }
  if (p->end_point) {
    e = (*v)(p->end_point, a); if (e) return e;
  }
  if (p->is_corner) {
    e = (*v)(p->is_corner, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7potrace_8_potrace_CornerSegment(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_CornerSegment *p = (struct __pyx_obj_7potrace_8_potrace_CornerSegment *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->c);
  p->c = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->end_point);
  p->end_point = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->is_corner);
  p->is_corner = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7potrace_8_potrace_13CornerSegment_c(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_13CornerSegment_1c___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_13CornerSegment_c(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_13CornerSegment_1c___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7potrace_8_potrace_13CornerSegment_end_point(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_13CornerSegment_9end_point___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_13CornerSegment_end_point(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_13CornerSegment_9end_point___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7potrace_8_potrace_13CornerSegment_is_corner(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_13CornerSegment_9is_corner___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_13CornerSegment_is_corner(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_13CornerSegment_9is_corner___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyMethodDef __pyx_methods_7potrace_8_potrace_CornerSegment[] = {
  {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_7potrace_8_potrace_13CornerSegment___repr__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7potrace_8_potrace_CornerSegment[] = {
  {(char *)"c", __pyx_getprop_7potrace_8_potrace_13CornerSegment_c, __pyx_setprop_7potrace_8_potrace_13CornerSegment_c, 0, 0},
  {(char *)"end_point", __pyx_getprop_7potrace_8_potrace_13CornerSegment_end_point, __pyx_setprop_7potrace_8_potrace_13CornerSegment_end_point, 0, 0},
  {(char *)"is_corner", __pyx_getprop_7potrace_8_potrace_13CornerSegment_is_corner, __pyx_setprop_7potrace_8_potrace_13CornerSegment_is_corner, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_CornerSegment = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_CornerSegment = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_CornerSegment = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_CornerSegment = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_7potrace_8_potrace_CornerSegment = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("potrace._potrace.CornerSegment"), /*tp_name*/
  sizeof(struct __pyx_obj_7potrace_8_potrace_CornerSegment), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7potrace_8_potrace_CornerSegment, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  __pyx_pf_7potrace_8_potrace_13CornerSegment___repr__, /*tp_repr*/
  &__pyx_tp_as_number_CornerSegment, /*tp_as_number*/
  &__pyx_tp_as_sequence_CornerSegment, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_CornerSegment, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_CornerSegment, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Represents a corner segment in a :class:`Curve` object.\n    "), /*tp_doc*/
  __pyx_tp_traverse_7potrace_8_potrace_CornerSegment, /*tp_traverse*/
  __pyx_tp_clear_7potrace_8_potrace_CornerSegment, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7potrace_8_potrace_CornerSegment, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7potrace_8_potrace_CornerSegment, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_7potrace_8_potrace_13CornerSegment___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7potrace_8_potrace_CornerSegment, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_7potrace_8_potrace_Curve __pyx_vtable_7potrace_8_potrace_Curve;

static PyObject *__pyx_tp_new_7potrace_8_potrace_Curve(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7potrace_8_potrace_Curve *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_7potrace_8_potrace_Curve *)o);
  p->__pyx_vtab = __pyx_vtabptr_7potrace_8_potrace_Curve;
  p->segments = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->children = ((PyObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7potrace_8_potrace_Curve(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_Curve *p = (struct __pyx_obj_7potrace_8_potrace_Curve *)o;
  Py_XDECREF(((PyObject *)p->segments));
  Py_XDECREF(((PyObject *)p->children));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7potrace_8_potrace_Curve(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7potrace_8_potrace_Curve *p = (struct __pyx_obj_7potrace_8_potrace_Curve *)o;
  if (p->segments) {
    e = (*v)(p->segments, a); if (e) return e;
  }
  if (p->children) {
    e = (*v)(p->children, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7potrace_8_potrace_Curve(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_Curve *p = (struct __pyx_obj_7potrace_8_potrace_Curve *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->segments);
  p->segments = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->children);
  p->children = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7potrace_8_potrace_5Curve_start_point(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_5Curve_11start_point___get__(o);
}

static PyObject *__pyx_getprop_7potrace_8_potrace_5Curve_segments(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_5Curve_8segments___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_5Curve_segments(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_5Curve_8segments___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7potrace_8_potrace_5Curve_children(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_5Curve_8children___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_5Curve_children(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_5Curve_8children___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyMethodDef __pyx_methods_7potrace_8_potrace_Curve[] = {
  {__Pyx_NAMESTR("tesselate"), (PyCFunction)__pyx_pf_7potrace_8_potrace_5Curve_tesselate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7potrace_8_potrace_5Curve_tesselate)},
  {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_7potrace_8_potrace_5Curve___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7potrace_8_potrace_Curve[] = {
  {(char *)"start_point", __pyx_getprop_7potrace_8_potrace_5Curve_start_point, 0, __Pyx_DOCSTR(__pyx_k_19), 0},
  {(char *)"segments", __pyx_getprop_7potrace_8_potrace_5Curve_segments, __pyx_setprop_7potrace_8_potrace_5Curve_segments, 0, 0},
  {(char *)"children", __pyx_getprop_7potrace_8_potrace_5Curve_children, __pyx_setprop_7potrace_8_potrace_5Curve_children, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Curve = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Curve = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Curve = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Curve = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_7potrace_8_potrace_Curve = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("potrace._potrace.Curve"), /*tp_name*/
  sizeof(struct __pyx_obj_7potrace_8_potrace_Curve), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7potrace_8_potrace_Curve, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Curve, /*tp_as_number*/
  &__pyx_tp_as_sequence_Curve, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Curve, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Curve, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Curve objects represent closed, non intersecting curves.\n\n    Curves are made of a list of :class:`BezierSegment` and\n    :class:`CornerSegment` objects connected to each other.\n    "), /*tp_doc*/
  __pyx_tp_traverse_7potrace_8_potrace_Curve, /*tp_traverse*/
  __pyx_tp_clear_7potrace_8_potrace_Curve, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_7potrace_8_potrace_5Curve___iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7potrace_8_potrace_Curve, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7potrace_8_potrace_Curve, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_7potrace_8_potrace_5Curve___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7potrace_8_potrace_Curve, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_7potrace_8_potrace_Path __pyx_vtable_7potrace_8_potrace_Path;

static PyObject *__pyx_tp_new_7potrace_8_potrace_Path(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7potrace_8_potrace_Path *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_7potrace_8_potrace_Path *)o);
  p->__pyx_vtab = __pyx_vtabptr_7potrace_8_potrace_Path;
  p->curves = ((PyObject *)Py_None); Py_INCREF(Py_None);
  p->curves_tree = ((PyObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_7potrace_8_potrace_Path(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_Path *p = (struct __pyx_obj_7potrace_8_potrace_Path *)o;
  Py_XDECREF(((PyObject *)p->curves));
  Py_XDECREF(((PyObject *)p->curves_tree));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7potrace_8_potrace_Path(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7potrace_8_potrace_Path *p = (struct __pyx_obj_7potrace_8_potrace_Path *)o;
  if (p->curves) {
    e = (*v)(p->curves, a); if (e) return e;
  }
  if (p->curves_tree) {
    e = (*v)(p->curves_tree, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7potrace_8_potrace_Path(PyObject *o) {
  struct __pyx_obj_7potrace_8_potrace_Path *p = (struct __pyx_obj_7potrace_8_potrace_Path *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->curves);
  p->curves = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->curves_tree);
  p->curves_tree = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_7potrace_8_potrace_4Path_curves(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_4Path_6curves___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_4Path_curves(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_4Path_6curves___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_7potrace_8_potrace_4Path_curves_tree(PyObject *o, void *x) {
  return __pyx_pf_7potrace_8_potrace_4Path_11curves_tree___get__(o);
}

static int __pyx_setprop_7potrace_8_potrace_4Path_curves_tree(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_7potrace_8_potrace_4Path_11curves_tree___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyMethodDef __pyx_methods_7potrace_8_potrace_Path[] = {
  {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pf_7potrace_8_potrace_4Path___iter__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_7potrace_8_potrace_Path[] = {
  {(char *)"curves", __pyx_getprop_7potrace_8_potrace_4Path_curves, __pyx_setprop_7potrace_8_potrace_4Path_curves, 0, 0},
  {(char *)"curves_tree", __pyx_getprop_7potrace_8_potrace_4Path_curves_tree, __pyx_setprop_7potrace_8_potrace_4Path_curves_tree, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Path = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Path = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Path = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Path = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_7potrace_8_potrace_Path = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("potrace._potrace.Path"), /*tp_name*/
  sizeof(struct __pyx_obj_7potrace_8_potrace_Path), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7potrace_8_potrace_Path, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Path, /*tp_as_number*/
  &__pyx_tp_as_sequence_Path, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Path, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Path, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Path objects store a list of :class:`Curve` objects.\n    "), /*tp_doc*/
  __pyx_tp_traverse_7potrace_8_potrace_Path, /*tp_traverse*/
  __pyx_tp_clear_7potrace_8_potrace_Path, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_7potrace_8_potrace_4Path___iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7potrace_8_potrace_Path, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_7potrace_8_potrace_Path, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_7potrace_8_potrace_4Path___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7potrace_8_potrace_Path, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static struct PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("potracelib_version"), (PyCFunction)__pyx_pf_7potrace_8_potrace_potracelib_version, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7potrace_8_potrace_potracelib_version)},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("_potrace"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
  {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0},
  {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0},
  {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0},
  {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  {&__pyx_n_s__BezierSegment, __pyx_k__BezierSegment, sizeof(__pyx_k__BezierSegment), 0, 0, 1, 1},
  {&__pyx_n_s__Bitmap, __pyx_k__Bitmap, sizeof(__pyx_k__Bitmap), 0, 0, 1, 1},
  {&__pyx_n_s__CornerSegment, __pyx_k__CornerSegment, sizeof(__pyx_k__CornerSegment), 0, 0, 1, 1},
  {&__pyx_n_s__Curve, __pyx_k__Curve, sizeof(__pyx_k__Curve), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__Path, __pyx_k__Path, sizeof(__pyx_k__Path), 0, 0, 1, 1},
  {&__pyx_n_s__PotraceError, __pyx_k__PotraceError, sizeof(__pyx_k__PotraceError), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__TURNPOLICY_BLACK, __pyx_k__TURNPOLICY_BLACK, sizeof(__pyx_k__TURNPOLICY_BLACK), 0, 0, 1, 1},
  {&__pyx_n_s__TURNPOLICY_LEFT, __pyx_k__TURNPOLICY_LEFT, sizeof(__pyx_k__TURNPOLICY_LEFT), 0, 0, 1, 1},
  {&__pyx_n_s__TURNPOLICY_MAJORITY, __pyx_k__TURNPOLICY_MAJORITY, sizeof(__pyx_k__TURNPOLICY_MAJORITY), 0, 0, 1, 1},
  {&__pyx_n_s__TURNPOLICY_MINORITY, __pyx_k__TURNPOLICY_MINORITY, sizeof(__pyx_k__TURNPOLICY_MINORITY), 0, 0, 1, 1},
  {&__pyx_n_s__TURNPOLICY_RANDOM, __pyx_k__TURNPOLICY_RANDOM, sizeof(__pyx_k__TURNPOLICY_RANDOM), 0, 0, 1, 1},
  {&__pyx_n_s__TURNPOLICY_RIGHT, __pyx_k__TURNPOLICY_RIGHT, sizeof(__pyx_k__TURNPOLICY_RIGHT), 0, 0, 1, 1},
  {&__pyx_n_s__TURNPOLICY_WHITE, __pyx_k__TURNPOLICY_WHITE, sizeof(__pyx_k__TURNPOLICY_WHITE), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s___data, __pyx_k___data, sizeof(__pyx_k___data), 0, 0, 1, 1},
  {&__pyx_n_s__adaptive, __pyx_k__adaptive, sizeof(__pyx_k__adaptive), 0, 0, 1, 1},
  {&__pyx_n_s__alphamax, __pyx_k__alphamax, sizeof(__pyx_k__alphamax), 0, 0, 1, 1},
  {&__pyx_n_s__append_bezier, __pyx_k__append_bezier, sizeof(__pyx_k__append_bezier), 0, 0, 1, 1},
  {&__pyx_n_s__append_corner, __pyx_k__append_corner, sizeof(__pyx_k__append_corner), 0, 0, 1, 1},
  {&__pyx_n_s__append_curve, __pyx_k__append_curve, sizeof(__pyx_k__append_curve), 0, 0, 1, 1},
  {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
  {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1},
  {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1},
  {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
  {&__pyx_n_s__c1, __pyx_k__c1, sizeof(__pyx_k__c1), 0, 0, 1, 1},
  {&__pyx_n_s__c2, __pyx_k__c2, sizeof(__pyx_k__c2), 0, 0, 1, 1},
  {&__pyx_n_s__childlist, __pyx_k__childlist, sizeof(__pyx_k__childlist), 0, 0, 1, 1},
  {&__pyx_n_s__children, __pyx_k__children, sizeof(__pyx_k__children), 0, 0, 1, 1},
  {&__pyx_n_s__curve, __pyx_k__curve, sizeof(__pyx_k__curve), 0, 0, 1, 1},
  {&__pyx_n_s__curves, __pyx_k__curves, sizeof(__pyx_k__curves), 0, 0, 1, 1},
  {&__pyx_n_s__curves_tree, __pyx_k__curves_tree, sizeof(__pyx_k__curves_tree), 0, 0, 1, 1},
  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
  {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1},
  {&__pyx_n_s__dy, __pyx_k__dy, sizeof(__pyx_k__dy), 0, 0, 1, 1},
  {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1},
  {&__pyx_n_s__end_point, __pyx_k__end_point, sizeof(__pyx_k__end_point), 0, 0, 1, 1},
  {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1},
  {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
  {&__pyx_n_s__free_bitmap, __pyx_k__free_bitmap, sizeof(__pyx_k__free_bitmap), 0, 0, 1, 1},
  {&__pyx_n_s__h, __pyx_k__h, sizeof(__pyx_k__h), 0, 0, 1, 1},
  {&__pyx_n_s__image, __pyx_k__image, sizeof(__pyx_k__image), 0, 0, 1, 1},
  {&__pyx_n_s__is_corner, __pyx_k__is_corner, sizeof(__pyx_k__is_corner), 0, 0, 1, 1},
  {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
  {&__pyx_n_s__map, __pyx_k__map, sizeof(__pyx_k__map), 0, 0, 1, 1},
  {&__pyx_n_s__method, __pyx_k__method, sizeof(__pyx_k__method), 0, 0, 1, 1},
  {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
  {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1},
  {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1},
  {&__pyx_n_s__next, __pyx_k__next, sizeof(__pyx_k__next), 0, 0, 1, 1},
  {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1},
  {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
  {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
  {&__pyx_n_s__ok, __pyx_k__ok, sizeof(__pyx_k__ok), 0, 0, 1, 1},
  {&__pyx_n_s__opticurve, __pyx_k__opticurve, sizeof(__pyx_k__opticurve), 0, 0, 1, 1},
  {&__pyx_n_s__opttolerance, __pyx_k__opttolerance, sizeof(__pyx_k__opttolerance), 0, 0, 1, 1},
  {&__pyx_n_s__plist, __pyx_k__plist, sizeof(__pyx_k__plist), 0, 0, 1, 1},
  {&__pyx_n_s__po_bitmap, __pyx_k__po_bitmap, sizeof(__pyx_k__po_bitmap), 0, 0, 1, 1},
  {&__pyx_n_s__po_params, __pyx_k__po_params, sizeof(__pyx_k__po_params), 0, 0, 1, 1},
  {&__pyx_n_s__po_state, __pyx_k__po_state, sizeof(__pyx_k__po_state), 0, 0, 1, 1},
  {&__pyx_n_s__potracelib_version, __pyx_k__potracelib_version, sizeof(__pyx_k__potracelib_version), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1},
  {&__pyx_n_s__regular, __pyx_k__regular, sizeof(__pyx_k__regular), 0, 0, 1, 1},
  {&__pyx_n_s__res, __pyx_k__res, sizeof(__pyx_k__res), 0, 0, 1, 1},
  {&__pyx_n_s__segments, __pyx_k__segments, sizeof(__pyx_k__segments), 0, 0, 1, 1},
  {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
  {&__pyx_n_s__sibling, __pyx_k__sibling, sizeof(__pyx_k__sibling), 0, 0, 1, 1},
  {&__pyx_n_s__start_point, __pyx_k__start_point, sizeof(__pyx_k__start_point), 0, 0, 1, 1},
  {&__pyx_n_s__status, __pyx_k__status, sizeof(__pyx_k__status), 0, 0, 1, 1},
  {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1},
  {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1},
  {&__pyx_n_s__tag, __pyx_k__tag, sizeof(__pyx_k__tag), 0, 0, 1, 1},
  {&__pyx_n_s__turdsize, __pyx_k__turdsize, sizeof(__pyx_k__turdsize), 0, 0, 1, 1},
  {&__pyx_n_s__turnpolicy, __pyx_k__turnpolicy, sizeof(__pyx_k__turnpolicy), 0, 0, 1, 1},
  {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1},
  {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1},
  {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
  {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1},
  {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_30 = PyInt_FromLong(30); if (unlikely(!__pyx_int_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_potrace(void); /*proto*/
PyMODINIT_FUNC init_potrace(void)
#else
PyMODINIT_FUNC PyInit__potrace(void); /*proto*/
PyMODINIT_FUNC PyInit__potrace(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #if CYTHON_REFNANNY
  void* __pyx_refnanny = NULL;
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__potrace(void)", __LINE__, __FILE__);
  #endif
  __pyx_init_filenames();
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3
  __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #else
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_potrace"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_potrace___potrace) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_7potrace_8_potrace_Bitmap = &__pyx_vtable_7potrace_8_potrace_Bitmap;
  #if PY_MAJOR_VERSION >= 3
  __pyx_vtable_7potrace_8_potrace_Bitmap.free_bitmap = (PyObject *(*)(struct __pyx_obj_7potrace_8_potrace_Bitmap *))__pyx_f_7potrace_8_potrace_6Bitmap_free_bitmap;
  #else
  *(void(**)(void))&__pyx_vtable_7potrace_8_potrace_Bitmap.free_bitmap = (void(*)(void))__pyx_f_7potrace_8_potrace_6Bitmap_free_bitmap;
  #endif
  if (PyType_Ready(&__pyx_type_7potrace_8_potrace_Bitmap) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_7potrace_8_potrace_Bitmap.tp_dict, __pyx_vtabptr_7potrace_8_potrace_Bitmap) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Bitmap", (PyObject *)&__pyx_type_7potrace_8_potrace_Bitmap) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7potrace_8_potrace_Bitmap = &__pyx_type_7potrace_8_potrace_Bitmap;
  if (PyType_Ready(&__pyx_type_7potrace_8_potrace_Parameters) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Parameters", (PyObject *)&__pyx_type_7potrace_8_potrace_Parameters) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7potrace_8_potrace_Parameters = &__pyx_type_7potrace_8_potrace_Parameters;
  if (PyType_Ready(&__pyx_type_7potrace_8_potrace_State) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "State", (PyObject *)&__pyx_type_7potrace_8_potrace_State) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7potrace_8_potrace_State = &__pyx_type_7potrace_8_potrace_State;
  if (PyType_Ready(&__pyx_type_7potrace_8_potrace_BezierSegment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BezierSegment", (PyObject *)&__pyx_type_7potrace_8_potrace_BezierSegment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7potrace_8_potrace_BezierSegment = &__pyx_type_7potrace_8_potrace_BezierSegment;
  if (PyType_Ready(&__pyx_type_7potrace_8_potrace_CornerSegment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "CornerSegment", (PyObject *)&__pyx_type_7potrace_8_potrace_CornerSegment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7potrace_8_potrace_CornerSegment = &__pyx_type_7potrace_8_potrace_CornerSegment;
  __pyx_vtabptr_7potrace_8_potrace_Curve = &__pyx_vtable_7potrace_8_potrace_Curve;
  #if PY_MAJOR_VERSION >= 3
  __pyx_vtable_7potrace_8_potrace_Curve.append_bezier = (PyObject *(*)(struct __pyx_obj_7potrace_8_potrace_Curve *, struct potrace_dpoint_s *, struct potrace_dpoint_s *, struct potrace_dpoint_s *))__pyx_f_7potrace_8_potrace_5Curve_append_bezier;
  __pyx_vtable_7potrace_8_potrace_Curve.append_corner = (PyObject *(*)(struct __pyx_obj_7potrace_8_potrace_Curve *, struct potrace_dpoint_s *, struct potrace_dpoint_s *))__pyx_f_7potrace_8_potrace_5Curve_append_corner;
  #else
  *(void(**)(void))&__pyx_vtable_7potrace_8_potrace_Curve.append_bezier = (void(*)(void))__pyx_f_7potrace_8_potrace_5Curve_append_bezier;
  *(void(**)(void))&__pyx_vtable_7potrace_8_potrace_Curve.append_corner = (void(*)(void))__pyx_f_7potrace_8_potrace_5Curve_append_corner;
  #endif
  if (PyType_Ready(&__pyx_type_7potrace_8_potrace_Curve) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_7potrace_8_potrace_Curve.tp_dict, __pyx_vtabptr_7potrace_8_potrace_Curve) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Curve", (PyObject *)&__pyx_type_7potrace_8_potrace_Curve) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7potrace_8_potrace_Curve = &__pyx_type_7potrace_8_potrace_Curve;
  __pyx_vtabptr_7potrace_8_potrace_Path = &__pyx_vtable_7potrace_8_potrace_Path;
  #if PY_MAJOR_VERSION >= 3
  __pyx_vtable_7potrace_8_potrace_Path.append_curve = (PyObject *(*)(struct __pyx_obj_7potrace_8_potrace_Path *, struct potrace_curve_s *))__pyx_f_7potrace_8_potrace_4Path_append_curve;
  #else
  *(void(**)(void))&__pyx_vtable_7potrace_8_potrace_Path.append_curve = (void(*)(void))__pyx_f_7potrace_8_potrace_4Path_append_curve;
  #endif
  if (PyType_Ready(&__pyx_type_7potrace_8_potrace_Path) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_7potrace_8_potrace_Path.tp_dict, __pyx_vtabptr_7potrace_8_potrace_Path) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Path", (PyObject *)&__pyx_type_7potrace_8_potrace_Path) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7potrace_8_potrace_Path = &__pyx_type_7potrace_8_potrace_Path;
  /*--- Type import code ---*/
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Function import code ---*/
  __pyx_t_1 = __Pyx_ImportModule("potrace.bezier"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "bezier", (void (**)(void))&__pyx_f_7potrace_6bezier_bezier, "PyArrayObject *(PyArrayObject *, struct __pyx_opt_args_7potrace_6bezier_bezier *__pyx_optional_args)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "adaptive_bezier", (void (**)(void))&__pyx_f_7potrace_6bezier_adaptive_bezier, "PyArrayObject *(PyArrayObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*--- Execution code ---*/

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":6
 * from potrace.bezier cimport adaptive_bezier, bezier
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":10
 * 
 * # Number of pixels in a word
 * cdef int N = sizeof(potrace_word) * 8             # <<<<<<<<<<<<<<
 * 
 * # Constants
 */
  __pyx_v_7potrace_8_potrace_N = ((sizeof(potrace_word)) * 8);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":13
 * 
 * # Constants
 * TURNPOLICY_BLACK = POTRACE_TURNPOLICY_BLACK             # <<<<<<<<<<<<<<
 * TURNPOLICY_WHITE = POTRACE_TURNPOLICY_WHITE
 * TURNPOLICY_LEFT = POTRACE_TURNPOLICY_LEFT
 */
  __pyx_t_2 = PyInt_FromLong(POTRACE_TURNPOLICY_BLACK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TURNPOLICY_BLACK, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":14
 * # Constants
 * TURNPOLICY_BLACK = POTRACE_TURNPOLICY_BLACK
 * TURNPOLICY_WHITE = POTRACE_TURNPOLICY_WHITE             # <<<<<<<<<<<<<<
 * TURNPOLICY_LEFT = POTRACE_TURNPOLICY_LEFT
 * TURNPOLICY_RIGHT = POTRACE_TURNPOLICY_RIGHT
 */
  __pyx_t_2 = PyInt_FromLong(POTRACE_TURNPOLICY_WHITE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TURNPOLICY_WHITE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":15
 * TURNPOLICY_BLACK = POTRACE_TURNPOLICY_BLACK
 * TURNPOLICY_WHITE = POTRACE_TURNPOLICY_WHITE
 * TURNPOLICY_LEFT = POTRACE_TURNPOLICY_LEFT             # <<<<<<<<<<<<<<
 * TURNPOLICY_RIGHT = POTRACE_TURNPOLICY_RIGHT
 * TURNPOLICY_MINORITY = POTRACE_TURNPOLICY_MINORITY
 */
  __pyx_t_2 = PyInt_FromLong(POTRACE_TURNPOLICY_LEFT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TURNPOLICY_LEFT, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":16
 * TURNPOLICY_WHITE = POTRACE_TURNPOLICY_WHITE
 * TURNPOLICY_LEFT = POTRACE_TURNPOLICY_LEFT
 * TURNPOLICY_RIGHT = POTRACE_TURNPOLICY_RIGHT             # <<<<<<<<<<<<<<
 * TURNPOLICY_MINORITY = POTRACE_TURNPOLICY_MINORITY
 * TURNPOLICY_MAJORITY = POTRACE_TURNPOLICY_MAJORITY
 */
  __pyx_t_2 = PyInt_FromLong(POTRACE_TURNPOLICY_RIGHT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TURNPOLICY_RIGHT, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":17
 * TURNPOLICY_LEFT = POTRACE_TURNPOLICY_LEFT
 * TURNPOLICY_RIGHT = POTRACE_TURNPOLICY_RIGHT
 * TURNPOLICY_MINORITY = POTRACE_TURNPOLICY_MINORITY             # <<<<<<<<<<<<<<
 * TURNPOLICY_MAJORITY = POTRACE_TURNPOLICY_MAJORITY
 * TURNPOLICY_RANDOM = POTRACE_TURNPOLICY_RANDOM
 */
  __pyx_t_2 = PyInt_FromLong(POTRACE_TURNPOLICY_MINORITY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TURNPOLICY_MINORITY, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":18
 * TURNPOLICY_RIGHT = POTRACE_TURNPOLICY_RIGHT
 * TURNPOLICY_MINORITY = POTRACE_TURNPOLICY_MINORITY
 * TURNPOLICY_MAJORITY = POTRACE_TURNPOLICY_MAJORITY             # <<<<<<<<<<<<<<
 * TURNPOLICY_RANDOM = POTRACE_TURNPOLICY_RANDOM
 * 
 */
  __pyx_t_2 = PyInt_FromLong(POTRACE_TURNPOLICY_MAJORITY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TURNPOLICY_MAJORITY, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":19
 * TURNPOLICY_MINORITY = POTRACE_TURNPOLICY_MINORITY
 * TURNPOLICY_MAJORITY = POTRACE_TURNPOLICY_MAJORITY
 * TURNPOLICY_RANDOM = POTRACE_TURNPOLICY_RANDOM             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyInt_FromLong(POTRACE_TURNPOLICY_RANDOM); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TURNPOLICY_RANDOM, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":22
 * 
 * 
 * class PotraceError(Exception): pass             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  __pyx_t_4 = __Pyx_CreateClass(__pyx_t_3, ((PyObject *)__pyx_t_2), __pyx_n_s__PotraceError, "potrace._potrace"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PotraceError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":45
 *         self.free_bitmap()
 * 
 *     def trace(self, turdsize=2, turnpolicy=POTRACE_TURNPOLICY_MINORITY,             # <<<<<<<<<<<<<<
 *             alphamax=1.0, opticurve=1, opttolerance=0.2):
 *         """
 */
  __pyx_t_2 = PyInt_FromLong(POTRACE_TURNPOLICY_MINORITY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_k_1 = __pyx_t_2;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":46
 * 
 *     def trace(self, turdsize=2, turnpolicy=POTRACE_TURNPOLICY_MINORITY,
 *             alphamax=1.0, opticurve=1, opttolerance=0.2):             # <<<<<<<<<<<<<<
 *         """
 *         Trace the bitmap and wrap the result in a :class:`Path` instance.
 */
  __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_k_2 = __pyx_t_2;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(0.20000000000000001); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_k_3 = __pyx_t_2;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":142
 * 
 *     def __cinit__(self, int turdsize=2,
 *             int turnpolicy=POTRACE_TURNPOLICY_MINORITY, double alphamax=1.0,             # <<<<<<<<<<<<<<
 *             int opticurve=1, double opttolerance=0.2, *args, **kwargs):
 *         self.po_params = potrace_param_default()
 */
  __pyx_k_5 = POTRACE_TURNPOLICY_MINORITY;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":242
 * 
 *     # Bezier tesselation methods constants
 *     regular = 0             # <<<<<<<<<<<<<<
 *     adaptive = 1
 * 
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7potrace_8_potrace_Curve->tp_dict, __pyx_n_s__regular, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_7potrace_8_potrace_Curve);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":243
 *     # Bezier tesselation methods constants
 *     regular = 0
 *     adaptive = 1             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7potrace_8_potrace_Curve->tp_dict, __pyx_n_s__adaptive, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_7potrace_8_potrace_Curve);

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":256
 *             return self.segments[-1].end_point
 * 
 *     def tesselate(self, method=adaptive, res=30):             # <<<<<<<<<<<<<<
 *         """
 *         Tesselate the curve.
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_7potrace_8_potrace_Curve, __pyx_n_s__adaptive); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_k_10 = __pyx_t_2;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/home/flupke/source/pypotrace/potrace/_potrace.pyx":400
 * 
 * 
 * __all__ = ["TURNPOLICY_BLACK", "TURNPOLICY_WHITE", "TURNPOLICY_LEFT",             # <<<<<<<<<<<<<<
 *     "TURNPOLICY_RIGHT", "TURNPOLICY_MINORITY", "TURNPOLICY_MAJORITY",
 *     "TURNPOLICY_RANDOM", "Bitmap", "Path", "Curve", "BezierSegment",
 */
  __pyx_t_2 = PyList_New(13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__TURNPOLICY_BLACK));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__TURNPOLICY_BLACK));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TURNPOLICY_BLACK));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__TURNPOLICY_WHITE));
  PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__TURNPOLICY_WHITE));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TURNPOLICY_WHITE));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__TURNPOLICY_LEFT));
  PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__TURNPOLICY_LEFT));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TURNPOLICY_LEFT));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__TURNPOLICY_RIGHT));
  PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__TURNPOLICY_RIGHT));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TURNPOLICY_RIGHT));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__TURNPOLICY_MINORITY));
  PyList_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_n_s__TURNPOLICY_MINORITY));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TURNPOLICY_MINORITY));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__TURNPOLICY_MAJORITY));
  PyList_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_n_s__TURNPOLICY_MAJORITY));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TURNPOLICY_MAJORITY));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__TURNPOLICY_RANDOM));
  PyList_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_n_s__TURNPOLICY_RANDOM));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TURNPOLICY_RANDOM));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Bitmap));
  PyList_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_n_s__Bitmap));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Bitmap));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Path));
  PyList_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_n_s__Path));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Path));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Curve));
  PyList_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_n_s__Curve));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Curve));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__BezierSegment));
  PyList_SET_ITEM(__pyx_t_2, 10, ((PyObject *)__pyx_n_s__BezierSegment));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__BezierSegment));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__CornerSegment));
  PyList_SET_ITEM(__pyx_t_2, 11, ((PyObject *)__pyx_n_s__CornerSegment));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CornerSegment));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__potracelib_version));
  PyList_SET_ITEM(__pyx_t_2, 12, ((PyObject *)__pyx_n_s__potracelib_version));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__potracelib_version));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "/usr/local/lib/python2.6/dist-packages/Cython-0.12.1-py2.6-linux-i686.egg/Cython/Includes/python_ref.pxd":1
 * cdef extern from "Python.h":             # <<<<<<<<<<<<<<
 *     ctypedef struct PyTypeObject
 *     ctypedef struct PyObject:
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  if (__pyx_m) {
    __Pyx_AddTraceback("init potrace._potrace");
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init potrace._potrace");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static const char *__pyx_filenames[] = {
  "_potrace.pyx",
  "numpy.pxd",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *number, *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #else
        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
        #endif
            goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}


static CYTHON_INLINE int __Pyx_mod_int(int a, int b) {
    int r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

static CYTHON_INLINE int __Pyx_div_int(int a, int b) {
    int q = a / b;
    int r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}


static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
                 "need more than %d value%s to unpack", (int)index,
        #else
                 "need more than %zd value%s to unpack", index,
        #endif
                 (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) {
    PyErr_SetString(PyExc_ValueError, "too many values to unpack");
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            __Pyx_RaiseNeedMoreValuesError(index);
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_RaiseTooManyValuesError();
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError();
    }
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!__import__)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunctionObjArgs(__import__,
        name, global_dict, empty_dict, list, NULL);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static PyObject *__Pyx_CreateClass(
    PyObject *bases, PyObject *dict, PyObject *name, const char *modname)
{
    PyObject *py_modname;
    PyObject *result = 0;

    #if PY_MAJOR_VERSION < 3
    py_modname = PyString_FromString(modname);
    #else
    py_modname = PyUnicode_FromString(modname);
    #endif
    if (!py_modname)
        goto bad;
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    result = PyClass_New(bases, dict, name);
    #else
    result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL);
    #endif
bad:
    Py_XDECREF(py_modname);
    return result;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;

    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (!PyExceptionClass_Check(type)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        float denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
/*
    static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
#if HAVE_HYPOT
        return hypotf(z.real, z.imag);
#else
        return sqrtf(z.real*z.real + z.imag*z.imag);
#endif
    }
*/
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        double denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
/*
    static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
#if HAVE_HYPOT
        return hypot(z.real, z.imag);
#else
        return sqrt(z.real*z.real + z.imag*z.imag);
#endif
    }
*/
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX < 0x03010000
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#else
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    long size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];

    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(class_name);
    #else
    py_name = PyUnicode_FromString(class_name);
    #endif
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError, 
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning), 
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        PyErr_WarnEx(NULL, warning, 0);
    }
    else if (((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError, 
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;

    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(name);
    #else
    py_name = PyUnicode_FromString(name);
    #endif
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
#if PY_VERSION_HEX < 0x03010000
    const char *desc, *s1, *s2;
#endif

    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%s does not export expected C function %s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX < 0x03010000
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %s.%s has wrong signature (expected %s, got %s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);
#else
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %s.%s has wrong signature (expected %s, got %s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   if (x == Py_True) return 1;
   else if ((x == Py_False) | (x == Py_None)) return 0;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
