How to use the wand.assertions.assert_real function in Wand

To help you get started, we’ve selected a few Wand examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emcconville / wand / wand / drawing.py View on Github external
def text_kerning(self, kerning):
        assertions.assert_real(text_kerning=kerning)
        library.DrawSetTextKerning(self.resource, kerning)
github emcconville / wand / wand / font.py View on Github external
def __new__(cls, path, size=0, color=None, antialias=True,
                stroke_color=None, stroke_width=None):
        assertions.assert_string(path=path)
        assertions.assert_real(size=size)
        if color is None:
            color = Color('black')
        elif isinstance(color, string_type):
            color = Color(color)
        assertions.assert_color(color=color)
        if stroke_color:
            if isinstance(stroke_color, string_type):
                stroke_color = Color(stroke_color)
            assertions.assert_color(stroke_color=stroke_color)
        if stroke_width is not None:
            assertions.assert_real(stroke_width=stroke_width)
        path = text(path)
        return tuple.__new__(cls, (path, size, color, bool(antialias),
                                   stroke_color, stroke_width))
github emcconville / wand / wand / font.py View on Github external
def __new__(cls, path, size=0, color=None, antialias=True,
                stroke_color=None, stroke_width=None):
        assertions.assert_string(path=path)
        assertions.assert_real(size=size)
        if color is None:
            color = Color('black')
        elif isinstance(color, string_type):
            color = Color(color)
        assertions.assert_color(color=color)
        if stroke_color:
            if isinstance(stroke_color, string_type):
                stroke_color = Color(stroke_color)
            assertions.assert_color(stroke_color=stroke_color)
        if stroke_width is not None:
            assertions.assert_real(stroke_width=stroke_width)
        path = text(path)
        return tuple.__new__(cls, (path, size, color, bool(antialias),
                                   stroke_color, stroke_width))
github emcconville / wand / wand / drawing.py View on Github external
def text_interline_spacing(self, spacing):
        if library.DrawSetTextInterlineSpacing is None:  # pragma: no cover
            raise WandLibraryVersionError('The installed version of '
                                          'ImageMagick does not support '
                                          'this feature')
        assertions.assert_real(text_interline_spacing=spacing)
        library.DrawSetTextInterlineSpacing(self.resource, spacing)
github emcconville / wand / wand / drawing.py View on Github external
list
        :param type: :const:`COMPOSITE_OPERATORS`
        :param left: the column offset of the composited drawing source
        :type left: :class:`numbers.Real`
        :param top: the row offset of the composited drawing source
        :type top: :class:`numbers.Real`
        :param width: the total columns to include in the composited source
        :type width: :class:`numbers.Real`
        :param height: the total rows to include in the composited source
        :type height: :class:`numbers.Real`

        .. versionadded:: 0.4.0

        """
        assertions.assert_string(operator=operator)
        assertions.assert_real(left=left, top=top, width=width, height=height)
        try:
            op = COMPOSITE_OPERATORS.index(operator)
        except IndexError:
            raise IndexError(repr(operator) + ' is an invalid composite '
                             'operator type; see wand.image.COMPOSITE_'
                             'OPERATORS dictionary')
        okay = library.DrawComposite(self.resource, op, left, top, width,
                                     height, image.wand)
        if okay == 0:
            self.raise_exception()
github emcconville / wand / wand / drawing.py View on Github external
:param left: x ordinate of top left corner.
        :type left: :class:`numbers.Real`
        :param top: y ordinate of top left corner.
        :type top: :class:`numbers.Real`
        :param width: width of pattern space.
        :type width: :class:`numbers.Real`
        :param height: height of pattern space.
        :type height: :class:`numbers.Real`
        :returns: success of push operation
        :rtype: `bool`

        .. versionadded:: 0.4.0

        """
        assertions.assert_string(pattern_id=pattern_id)
        assertions.assert_real(left=left, top=top, width=width, height=height)
        okay = library.DrawPushPattern(self.resource, binary(pattern_id),
                                       left, top,
                                       width, height)
        return bool(okay)
github emcconville / wand / wand / drawing.py View on Github external
def opacity(self, opaque):
        assertions.assert_real(opacity=opaque)
        library.DrawSetOpacity(self.resource, opaque)
github emcconville / wand / wand / drawing.py View on Github external
def fill_opacity(self, opacity):
        assertions.assert_real(fill_opacity=opacity)
        library.DrawSetFillOpacity(self.resource, opacity)