summaryrefslogtreecommitdiffstats
path: root/libdimension-python
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension-python')
-rw-r--r--libdimension-python/dimension.pxd8
-rw-r--r--libdimension-python/dimension.pyx10
2 files changed, 7 insertions, 11 deletions
diff --git a/libdimension-python/dimension.pxd b/libdimension-python/dimension.pxd
index 61b5060..f6333cc 100644
--- a/libdimension-python/dimension.pxd
+++ b/libdimension-python/dimension.pxd
@@ -227,11 +227,11 @@ cdef extern from "../libdimension/dimension.h":
ctypedef struct dmnsn_pattern:
pass
- void dmnsn_delete_pattern(dmnsn_pattern *pattern)
+ void dmnsn_new_pattern(dmnsn_pool *pool)
- dmnsn_pattern *dmnsn_new_checker_pattern()
- dmnsn_pattern *dmnsn_new_gradient_pattern(dmnsn_vector orientation)
- dmnsn_pattern *dmnsn_new_leopard_pattern()
+ dmnsn_pattern *dmnsn_new_checker_pattern(dmnsn_pool *pool)
+ dmnsn_pattern *dmnsn_new_gradient_pattern(dmnsn_pool *pool, dmnsn_vector orientation)
+ dmnsn_pattern *dmnsn_new_leopard_pattern(dmnsn_pool *pool)
########
# Maps #
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index 7466b9e..534781c 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -744,13 +744,10 @@ cdef class Pattern:
def __cinit__(self):
self._pattern = NULL
- def __dealloc__(self):
- dmnsn_delete_pattern(self._pattern)
-
cdef class Checker(Pattern):
"""A checkerboard pattern."""
def __init__(self):
- self._pattern = dmnsn_new_checker_pattern()
+ self._pattern = dmnsn_new_checker_pattern(_get_pool())
Pattern.__init__(self)
cdef class Gradient(Pattern):
@@ -762,13 +759,13 @@ cdef class Gradient(Pattern):
Keyword arguments:
orientation -- The direction of the linear gradient.
"""
- self._pattern = dmnsn_new_gradient_pattern(Vector(orientation)._v)
+ self._pattern = dmnsn_new_gradient_pattern(_get_pool(), Vector(orientation)._v)
Pattern.__init__(self)
cdef class Leopard(Pattern):
"""A leopard pattern."""
def __init__(self):
- self._pattern = dmnsn_new_leopard_pattern()
+ self._pattern = dmnsn_new_leopard_pattern(_get_pool())
Pattern.__init__(self)
############
@@ -875,7 +872,6 @@ cdef class PigmentMap(Pigment):
else:
flags = DMNSN_PIGMENT_MAP_REGULAR
- DMNSN_INCREF(pattern._pattern)
self._pigment = dmnsn_new_pigment_map_pigment(pattern._pattern, pigment_map,
flags)
Pigment.__init__(self, *args, **kwargs)