Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def gravity(self, value):
assertions.string_in_list(GRAVITY_TYPES,
'wand.drawing.GRAVITY_TYPES',
gravity=value)
library.DrawSetGravity(self.resource, GRAVITY_TYPES.index(value))
This method has been replace by :meth:`alpha()` in ImageMagick
version 7. An :class:`AttributeError` will be raised if attempting
to call on a library without ``DrawMatte`` support.
.. versionadded:: 0.4.0
"""
if library.DrawMatte is None:
raise AttributeError(
'Method removed from ImageMagick version. ' +
'Please use `wand.drawing.Drawing.alpha()\' instead.'
)
if x is None or y is None:
raise TypeError('Both x & y coordinates need to be defined')
assertions.string_in_list(PAINT_METHOD_TYPES,
'wand.drawing.PAINT_METHOD_TYPES',
paint_method=paint_method)
library.DrawMatte(self.resource, float(x), float(y),
PAINT_METHOD_TYPES.index(paint_method))
def text_direction(self, direction):
if library.DrawGetTextDirection is None: # pragma: no cover
raise WandLibraryVersionError(
'The installed version of ImageMagick does not support '
'this feature'
)
assertions.string_in_list(TEXT_DIRECTION_TYPES,
'wand.drawing.TEXT_DIRECTION_TYPES',
text_direction=direction)
library.DrawSetTextDirection(self.resource,
TEXT_DIRECTION_TYPES.index(direction))
def text_alignment(self, align):
assertions.string_in_list(TEXT_ALIGN_TYPES,
'wand.drawing.TEXT_ALIGN_TYPES',
text_alignment=align)
library.DrawSetTextAlignment(self.resource,
TEXT_ALIGN_TYPES.index(align))
def font_style(self, style):
assertions.string_in_list(STYLE_TYPES,
'wand.drawing.STYLE_TYPES',
font_style=style)
library.DrawSetFontStyle(self.resource,
STYLE_TYPES.index(style))
def fill_rule(self, fill_rule):
assertions.string_in_list(FILL_RULE_TYPES,
'wand.drawing.FILL_RULE_TYPES',
fill_rule=fill_rule)
library.DrawSetFillRule(self.resource,
FILL_RULE_TYPES.index(fill_rule))
def font_stretch(self, stretch):
assertions.string_in_list(STRETCH_TYPES,
'wand.drawing.STRETCH_TYPES',
font_stretch=stretch)
library.DrawSetFontStretch(self.resource,
STRETCH_TYPES.index(stretch))
def clip_units(self, clip_unit):
assertions.string_in_list(CLIP_PATH_UNITS,
'wand.drawing.CLIP_PATH_UNITS',
clip_unit=clip_unit)
library.DrawSetClipUnits(self.resource,
CLIP_PATH_UNITS.index(clip_unit))
def stroke_line_cap(self, line_cap):
assertions.string_in_list(LINE_CAP_TYPES,
'wand.drawing.LINE_CAP_TYPES',
stroke_line_cap=line_cap)
library.DrawSetStrokeLineCap(self.resource,
LINE_CAP_TYPES.index(line_cap))