Skip to content

Commit

Permalink
Fix modulate segfault #158
Browse files Browse the repository at this point in the history
  • Loading branch information
fungt committed Mar 31, 2014
1 parent 701c386 commit 9476146
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 9 additions & 4 deletions wand/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class MagickPixelPacket(ctypes.Structure):

library.MagickSampleImage.argtypes = [ctypes.c_void_p, ctypes.c_size_t,
ctypes.c_size_t]

library.MagickResizeImage.argtypes = [ctypes.c_void_p, ctypes.c_size_t,
ctypes.c_size_t, ctypes.c_int,
ctypes.c_double]
Expand Down Expand Up @@ -625,10 +625,10 @@ class MagickPixelPacket(ctypes.Structure):
library.DrawSetFillColor.argtypes = [ctypes.c_void_p,
ctypes.c_void_p]

library.DrawSetStrokeColor.argtypes = [ctypes.c_void_p,
library.DrawSetStrokeColor.argtypes = [ctypes.c_void_p,
ctypes.c_void_p]

library.DrawSetStrokeWidth.argtypes = [ctypes.c_void_p,
library.DrawSetStrokeWidth.argtypes = [ctypes.c_void_p,
ctypes.c_double]

library.DrawSetTextAlignment.argtypes = [ctypes.c_void_p,
Expand Down Expand Up @@ -661,7 +661,7 @@ class MagickPixelPacket(ctypes.Structure):
library.DrawGetFillColor.argtypes = [ctypes.c_void_p,
ctypes.c_void_p]

library.DrawGetStrokeColor.argtypes = [ctypes.c_void_p,
library.DrawGetStrokeColor.argtypes = [ctypes.c_void_p,
ctypes.c_void_p]

library.DrawGetStrokeWidth.argtypes = [ctypes.c_void_p]
Expand Down Expand Up @@ -753,6 +753,11 @@ class MagickPixelPacket(ctypes.Structure):
library.MagickQueryMultilineFontMetrics.restype = ctypes.POINTER(
ctypes.c_double
)

library.MagickModulateImage.argtypes = [ctypes.c_void_p,
ctypes.c_double,
ctypes.c_double,
ctypes.c_double]
except AttributeError:
raise ImportError('MagickWand shared library not found or incompatible\n'
'Original exception was raised in:\n' +
Expand Down
6 changes: 3 additions & 3 deletions wand/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1704,9 +1704,9 @@ def modulate(self, brightness=100.0, saturation=100.0, hue=100.0):
repr(hue))
r = library.MagickModulateImage(
self.wand,
ctypes.c_double(brightness),
ctypes.c_double(saturation),
ctypes.c_double(hue)
brightness,
saturation,
hue
)
if not r:
self.raise_exception()
Expand Down

0 comments on commit 9476146

Please sign in to comment.