
    lh8                    :   d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZmZmZmZmZmZ dd	lmZ dd
lmZmZ ddlmZ ddlmZ dZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ) G d de          Z* G d d ej+        de$                    Z,d Z-dS )z:mod:`wand.drawing` --- Drawings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The module provides some vector drawing functions.

.. versionadded:: 0.3.0

    N   )
assertions)library)AffineMatrix	PointInfo)Color)abcbinarystring_typetext	text_typexrange)WandLibraryVersionError)COMPOSITE_OPERATORS	BaseImage)Resource)SingleImage)CLIP_PATH_UNITSFILL_RULE_TYPESFONT_METRICS_ATTRIBUTESGRAVITY_TYPESLINE_CAP_TYPESLINE_JOIN_TYPESPAINT_METHOD_TYPESSTRETCH_TYPESSTYLE_TYPESTEXT_ALIGN_TYPESTEXT_DECORATION_TYPESTEXT_DIRECTION_TYPESDrawingFontMetrics)undefined_path_units
user_spaceuser_space_on_useobject_bounding_box)	undefinedleftcenterright)r&   no	underlineoverlineline_through)r&   right_to_leftleft_to_right)forget
north_westnorth
north_eastwestr(   east
south_westsouth
south_eaststatic)r&   evenoddnonzero)character_widthcharacter_heightascender	descender
text_widthtext_heightmaximum_horizontal_advancex1y1x2y2xy)r&   normalultra_condensedextra_condensed	condensedsemi_condensedsemi_expandedexpandedextra_expandedultra_expandedany)r&   rI   italicobliquerR   )r&   buttroundsquare)r&   miterrV   bevel)r&   pointreplace	floodfillfilltoborderresetc                    	   e Zd ZdZej        Zej        Zej	        Z
ej        Zd|dZed             Zej        d             Zed             Zej        d             Zed             Zej        d	             Zed
             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed             Zej        d             Zed              Zej        d!             Zed"             Zej        d#             Zed$             Z e j        d%             Z ed&             Z!e!j        d'             Z!ed(             Z"e"j        d)             Z"ed*             Z#e#j        d+             Z#ed,             Z$e$j        d-             Z$ed.             Z%e%j        d/             Z%ed0             Z&e&j        d1             Z&ed2             Z'e'j        d3             Z'ed4             Z(e(j        d5             Z(ed6             Z)e)j        d7             Z)ed8             Z*e*j        d9             Z*ed:             Z+e+j        d;             Z+ed<             Z,e,j        d=             Z,ed>             Z-e-j        d?             Z-ed@             Z.e.j        dA             Z.edB             Z/e/j        dC             Z/edD             Z0e0j        dE             Z0edF             Z1e1j        dG             Z1edH             Z2e2j        dI             Z2dJ Z3d}dLZ4dM Z5d|dNZ6dO Z7dP Z8dQ Z9d~dSZ:d|dTZ;dU Z<dV Z=d|dWZ>ddYZ?dZ Z@d~d[ZAd\ ZBdd]ZC	 	 dd^ZD	 	 dd_ZEd` ZFddaZGddbZHddcZIdd ZJddeZKd|dfZLd|dgZMdh ZNdi ZOdj ZPdk ZQdl ZRdm ZSdn ZTdo ZUdp ZV	 	 	 ddqZWddrZXddtZYdu ZZdv Z[ddwZ\dx Z]ddyZ^dz Z_d{ Z`dS )r    a  Drawing object.  It maintains several vector drawing instructions
    and can get drawn into zero or more :class:`~wand.image.Image` objects
    by calling it.

    For example, the following code draws a diagonal line to the ``image``::

        with Drawing() as draw:
            draw.line((0, 0), image.size)
            draw(image)

    :param drawing: an optional drawing object to clone.
                    use :meth:`clone()` method rather than this parameter
    :type drawing: :class:`Drawing`

    .. versionadded:: 0.3.0

    Nc                 D   |                                  5  |st          j                    }nUt          |t	          |                     st          dt          |          z             t          j        |j                  }|| _        d d d            d S # 1 swxY w Y   d S )Nz5drawing must be a wand.drawing.Drawing instance, not )	allocater   NewDrawingWand
isinstancetype	TypeErrorreprCloneDrawingWandresource)selfdrawingwands      O/var/www/html/research.buxo.ca/env/lib/python3.11/site-packages/wand/drawing.py__init__zDrawing.__init__   s    ]]__ 	! 	! B-//d44 B !137==!A B B B /0@AA DM	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s   A3BBBc                     t          j                    }t          j        | j        |           t	          j        |          }t          j        |          }|S )z(:class:`~wand.color.Color`) the current border color. It also can
        be set. This attribute controls the behavior of
        :meth:`~wand.drawing.Drawing.color()` during ``'filltoborder'``
        operation.

        .. versionadded:: 0.4.0
        )r   NewPixelWandDrawGetBorderColorrh   r   from_pixelwandDestroyPixelWand)ri   	pixelwandcolors      rl   border_colorzDrawing.border_color   sL     (**	"4=)<<<$Y//,Y77	    c                     t          |t                    rt          |          }t          j        |           |5  t          j        | j        |j                   d d d            d S # 1 swxY w Y   d S )N)ru   )rc   r   r   r   assert_colorr   DrawSetBorderColorrh   ri   rt   s     rl   ru   zDrawing.border_color       e[)) 	!%LLEU3333 	F 	F&t}enEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F    A))A-0A-c                     d}t          j        | j                  }|r5t          t	          j        |                    }t          j        |          }|S )a	  (:class:`basestring`) The current clip path. It also can be set.

        .. versionadded:: 0.4.0

        .. versionchanged: 0.4.1
           Safely release allocated memory with
           :c:func:`MagickRelinquishMemory` instead of :c:func:`libc.free`.

        N)r   DrawGetClipPathrh   r   ctypes	string_atMagickRelinquishMemory)ri   clip_path_strclip_path_ps      rl   	clip_pathzDrawing.clip_path   sR     -dm<< 	F !1+!>!>??M!8EEKrv   c                 ~    t          j        |           t          j        | j        t          |                     d S )N)r   )r   assert_stringr   DrawSetClipPathrh   r
   )ri   paths     rl   r   zDrawing.clip_path   s7     40000vd||<<<<<rv   c                 N    t          j        | j                  }t          |         S )z(:class:`basestring`) The current clip rule. It also can be set.
        It's a string value from :const:`FILL_RULE_TYPES` list.

        .. versionadded:: 0.4.0
        )r   DrawGetClipRulerh   r   ri   	clip_rules     rl   r   zDrawing.clip_rule   s!     +DM::	y))rv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nwand.drawing.FILL_RULE_TYPES)r   )r   string_in_listr   r   DrawSetClipRulerh   indexr   s     rl   r   zDrawing.clip_rule   _    !/"@,5	7 	7 	7 	7 	 / 5 5i @ @	B 	B 	B 	B 	Brv   c                 N    t          j        | j                  }t          |         S )z(:class:`basestring`) The current clip units. It also can be set.
        It's a string value from :const:`CLIP_PATH_UNITS` list.

        .. versionadded:: 0.4.0
        )r   DrawGetClipUnitsrh   r   ri   	clip_units     rl   
clip_unitszDrawing.clip_units   s!     ,T];;	y))rv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nzwand.drawing.CLIP_PATH_UNITS)r   )r   r   r   r   DrawSetClipUnitsrh   r   r   s     rl   r   zDrawing.clip_units  s_    !/"@,5	7 	7 	7 	7 	 !0!6!6y!A!A	C 	C 	C 	C 	Crv   c                     t          j                    }t          j        | j        |           t	          j        |          }t          j        |          }|S )z](:class:`~wand.color.Color`) The current color to fill.
        It also can be set.

        )r   ro   DrawGetFillColorrh   r   rq   rr   ri   pixelrt   s      rl   
fill_colorzDrawing.fill_color
  sL     $&& 666$U++(//rv   c                     t          |t                    rt          |          }t          j        |           |5  t          j        | j        |j                   d d d            d S # 1 swxY w Y   d S )N)r   )rc   r   r   r   rx   r   DrawSetFillColorrh   rz   s     rl   r   zDrawing.fill_color  s    e[)) 	!%LLE51111 	D 	D$T]ENCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Dr|   c                 4    t          j        | j                  S )zx(:class:`~numbers.Real`) The current fill opacity.
        It also can be set.

        .. versionadded:: 0.4.0
        )r   DrawGetFillOpacityrh   ri   s    rl   fill_opacityzDrawing.fill_opacity       )$-888rv   c                 d    t          j        |           t          j        | j        |           d S )N)r   )r   assert_realr   DrawSetFillOpacityrh   ri   opacitys     rl   r   zDrawing.fill_opacity'  1    G4444"4=':::::rv   c                     t          j        | j                  }|t          vr|                                  t          t          |                   S )z(:class:`basestring`) The current fill rule. It can also be set.
        It's a string value from :const:`FILL_RULE_TYPES` list.

        .. versionadded:: 0.4.0
        )r   DrawGetFillRulerh   r   raise_exceptionr   )ri   fill_rule_indexs     rl   	fill_rulezDrawing.fill_rule,  sF     "1$-@@/11  """OO4555rv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nr   )r   )r   r   r   r   DrawSetFillRulerh   r   )ri   r   s     rl   r   zDrawing.fill_rule8  r   rv   c                     d}t          j        | j                  }|r5t          t	          j        |                    }t          j        |          }|S )z(:class:`basestring`) The current font name.  It also can be set.

        .. versionchanged: 0.4.1
           Safely release allocated memory with
           :c:func:`MagickRelinquishMemory` instead of :c:func:`libc.free`.

        N)r   DrawGetFontrh   r   r   r   r   )ri   font_strfont_ps      rl   fontzDrawing.font@  sP     $T]33 	<F,V4455H3F;;Frv   c                 ~    t          j        |           t          j        | j        t          |                     d S )N)r   )r   r   r   DrawSetFontrh   r
   )ri   r   s     rl   r   zDrawing.fontP  s7     d++++DM6$<<88888rv   c                     d}t          j        | j                  }|r5t          t	          j        |                    }t          j        |          }|S )a  (:class:`basestring`) The current font family. It also can be set.

        .. versionadded:: 0.4.0

        .. versionchanged: 0.4.1
           Safely release allocated memory with
           :c:func:`MagickRelinquishMemory` instead of :c:func:`libc.free`.

        N)r   DrawGetFontFamilyrh   r   r   r   r   )ri   font_family_strfont_family_ps      rl   font_familyzDrawing.font_familyU  sR     1$-@@ 	J"6#3M#B#BCCO#:=IIMrv   c                 ~    t          j        |           t          j        | j        t          |                     d S )N)r   )r   r   r   DrawSetFontFamilyrh   r
   )ri   familys     rl   r   zDrawing.font_familyg  s7     V4444!$-@@@@@rv   c                     t          j        d          t          j        d          }}t          j        | j        t          j        |          t          j        |                     |j        |j        fS )z(:class:`~collections.abc.Sequence`) The current font resolution.
        It also can be set.

        .. versionadded:: 0.4.0
                )r   c_doubler   DrawGetFontResolutionrh   byrefvalueri   rG   rH   s      rl   font_resolutionzDrawing.font_resolutionl  sa     s##V_S%9%91%dm&,l1oo&,l1oo	7 	7 	7 wrv   c                 ^    t          j        |           t          j        | j        g|R   d S )N)r   )r   assert_coordinater   DrawSetFontResolutionrh   )ri   
resolutions     rl   r   zDrawing.font_resolutiony  s7    $Z@@@@%dmAjAAAAAArv   c                 4    t          j        | j                  S )z;(:class:`numbers.Real`) The font size.  It also can be set.)r   DrawGetFontSizerh   r   s    rl   	font_sizezDrawing.font_size~  s     &t}555rv   c                     t          j        |           |dk     rt          dt          |          z             t	          j        | j        |           d S )N)r   r   !cannot be less than 0.0, but got )r   r   
ValueErrorrf   r   DrawSetFontSizerh   )ri   sizes     rl   r   zDrawing.font_size  sT    ....#::@4::MNNNt44444rv   c                 h    t          j        | j                  }t          t          |                   S )z(:class:`basestring`) The current font stretch variation.
        It also can be set, but will only apply if the font-family or encoder
        supports the stretch type.

        .. versionadded:: 0.4.0
        )r   DrawGetFontStretchrh   r   r   )ri   stretch_indexs     rl   font_stretchzDrawing.font_stretch  s)      24=AAM-0111rv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nzwand.drawing.STRETCH_TYPES)r   )r   r   r   r   DrawSetFontStretchrh   r   )ri   stretchs     rl   r   zDrawing.font_stretch  s_    !-">/6	8 	8 	8 	8 	"4=#0#6#6w#?#?	A 	A 	A 	A 	Arv   c                 h    t          j        | j                  }t          t          |                   S )z(:class:`basestring`) The current font style.
        It also can be set, but will only apply if the font-family
        supports the style.

        .. versionadded:: 0.4.0
        )r   DrawGetFontStylerh   r   r   )ri   style_indexs     rl   
font_stylezDrawing.font_style  s)     .t}==K,---rv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nzwand.drawing.STYLE_TYPES)r   )r   r   r   r   DrawSetFontStylerh   r   )ri   styles     rl   r   zDrawing.font_style  sZ    !+"<-2	4 	4 	4 	4 	 !,!2!25!9!9	; 	; 	; 	; 	;rv   c                 4    t          j        | j                  S )z{(:class:`~numbers.Integral`) The current font weight.
        It also can be set.

        .. versionadded:: 0.4.0
        )r   DrawGetFontWeightrh   r   s    rl   font_weightzDrawing.font_weight  s     (777rv   c                 d    t          j        |           t          j        | j        |           d S )N)r   )r   assert_integerr   DrawSetFontWeightrh   )ri   weights     rl   r   zDrawing.font_weight  s1    !f5555!$-88888rv   c                     t          j        | j                  }|s|                                  t	          t
          |                   S )z(:class:`basestring`) The text placement gravity used when
        annotating with text.  It's a string from :const:`GRAVITY_TYPES`
        list.  It also can be set.

        )r   DrawGetGravityrh   r   r   r   )ri   gravity_indexs     rl   gravityzDrawing.gravity  sC      .t}== 	#  """M-0111rv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nzwand.drawing.GRAVITY_TYPES)r   )r   r   r   r   DrawSetGravityrh   r   ri   r   s     rl   r   zDrawing.gravity  sO    !-">*/	1 	1 	1 	1 	t}m.A.A%.H.HIIIIIrv   c                 4    t          j        | j                  S )ai  (:class:`~numbers.Real`) returns the opacity used when drawing with
        the fill or stroke color or texture. Fully opaque is 1.0. This method
        only affects vector graphics, and is experimental. To set the opacity
        of a drawing, use
        :attr:`Drawing.fill_opacity` & :attr:`Drawing.stroke_opacity`

        .. versionadded:: 0.4.0
        )r   DrawGetOpacityrh   r   s    rl   r   zDrawing.opacity  s     %dm444rv   c                 d    t          j        |           t          j        | j        |           d S )N)r   )r   r   r   DrawSetOpacityrh   )ri   opaques     rl   r   zDrawing.opacity  s1    v....t}f55555rv   c                 R    t          j        | j                  }t          |          S )aX  (:class:`bool`) Controls whether stroked outlines are antialiased.
        Stroked outlines are antialiased by default. When antialiasing is
        disabled stroked pixels are thresholded to determine if the stroke
        color or underlying canvas color should be used.

        It also can be set.

        .. versionadded:: 0.4.0

        )r   DrawGetStrokeAntialiasrh   boolri   stroke_antialiass     rl   r   zDrawing.stroke_antialias  s&     #9$-HH$%%%rv   c                 d    t          j        |           t          j        | j        |           d S )N)r   )r   assert_boolr   DrawSetStrokeAntialiasrh   r   s     rl   r   zDrawing.stroke_antialias  s3    0@AAAA&t}6FGGGGGrv   c                     t          j                    }t          j        | j        |           t	          j        |          }t          j        |          }|S )z(:class:`~wand.color.Color`) The current color of stroke.
        It also can be set.

        .. versionadded:: 0.3.3

        )r   ro   DrawGetStrokeColorrh   r   rq   rr   r   s      rl   stroke_colorzDrawing.stroke_color  sL     $&&"4=%888$U++(//rv   c                     t          |t                    rt          |          }t          j        |           |5  t          j        | j        |j                   d d d            d S # 1 swxY w Y   d S )N)r  )rc   r   r   r   rx   r   DrawSetStrokeColorrh   rz   s     rl   r  zDrawing.stroke_color  r{   r|   c                     t          j        d          }t          j        | j        t          j        |                    g }r4fdt          |j                  D             }t          j                  |S )at  (:class:`~collections.abc.Sequence`) - (:class:`numbers.Real`) An
        array representing the pattern of dashes & gaps used to stroke paths.
        It also can be set.

        .. versionadded:: 0.4.0

        .. versionchanged: 0.4.1
           Safely release allocated memory with
           :c:func:`MagickRelinquishMemory` instead of :c:func:`libc.free`.

        r   c                 :    g | ]}t          |                   S  )float).0idash_array_ps     rl   
<listcomp>z-Drawing.stroke_dash_array.<locals>.<listcomp>  s;     B B B  Q00 B B Brv   )	r   c_size_tr   DrawGetStrokeDashArrayrh   r   r   r   r   )ri   number_elements
dash_arrayr
  s      @rl   stroke_dash_arrayzDrawing.stroke_dash_array  s     !/!,,5M6<88
 
 
 	HB B B B#)/*?#@#@B B BJ"9,GGLrv   c                 |    t          |          }t          j        |z  | }t          j        | j        ||           d S N)lenr   r   r   DrawSetStrokeDashArrayrh   )ri   r  dash_array_lr
  s       rl   r  zDrawing.stroke_dash_array$  sG    :,6D&t}'3'3	5 	5 	5 	5 	5rv   c                 4    t          j        | j                  S )zm(:class:`numbers.Real`) The stroke dash offset. It also can be set.

        .. versionadded:: 0.4.0
        )r   DrawGetStrokeDashOffsetrh   r   s    rl   stroke_dash_offsetzDrawing.stroke_dash_offset,  s     .t}===rv   c                 d    t          j        |           t          j        | j        |           d S )N)r  )r   r   r   DrawSetStrokeDashOffsetrh   )ri   offsets     rl   r  zDrawing.stroke_dash_offset4  s1    &9999'v>>>>>rv   c                     t          j        | j                  }|t          vr|                                  t          t          |                   S )zh(:class:`basestring`) The stroke line cap. It also can be set.

        .. versionadded:: 0.4.0
        )r   DrawGetStrokeLineCaprh   r   r   r   )ri   line_cap_indexs     rl   stroke_line_capzDrawing.stroke_line_cap9  sF     !5dmDD//  """N>2333rv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nzwand.drawing.LINE_CAP_TYPES)r  )r   r   r   r   DrawSetStrokeLineCaprh   r   )ri   line_caps     rl   r  zDrawing.stroke_line_capD  s_    !."?2:	< 	< 	< 	< 	$T]%3%9%9(%C%C	E 	E 	E 	E 	Erv   c                     t          j        | j                  }|t          vr|                                  t          t          |                   S )zi(:class:`basestring`) The stroke line join. It also can be set.

        .. versionadded:: 0.4.0
        )r   DrawGetStrokeLineJoinrh   r   r   r   )ri   line_join_indexs     rl   stroke_line_joinzDrawing.stroke_line_joinL  sF     "7FF/11  """OO4555rv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nzwand.drawing.LINE_JOIN_TYPES)r&  )r   r   r   r   DrawSetStrokeLineJoinrh   r   )ri   	line_joins     rl   r&  zDrawing.stroke_line_joinW  s_    !/"@3<	> 	> 	> 	> 	%dm&5&;&;I&F&F	H 	H 	H 	H 	Hrv   c                 4    t          j        | j                  S )z{(:class:`~numbers.Integral`) The current miter limit.
        It also can be set.

        .. versionadded:: 0.4.0
        )r   DrawGetStrokeMiterLimitrh   r   s    rl   stroke_miter_limitzDrawing.stroke_miter_limit_  s     .t}===rv   c                 d    t          j        |           t          j        | j        |           d S )N)r,  )r   r   r   DrawSetStrokeMiterLimitrh   )ri   miter_limits     rl   r,  zDrawing.stroke_miter_limith  s1    ![AAAA'{CCCCCrv   c                 4    t          j        | j                  S )zz(:class:`~numbers.Real`) The current stroke opacity.
        It also can be set.

        .. versionadded:: 0.4.0
        )r   DrawGetStrokeOpacityrh   r   s    rl   stroke_opacityzDrawing.stroke_opacitym  s     +DM:::rv   c                 d    t          j        |           t          j        | j        |           d S )N)r2  )r   r   r   DrawSetStrokeOpacityrh   r   s     rl   r2  zDrawing.stroke_opacityv  s1    g6666$T]G<<<<<rv   c                 4    t          j        | j                  S )zi(:class:`numbers.Real`) The stroke width.  It also can be set.

        .. versionadded:: 0.3.3

        )r   DrawGetStrokeWidthrh   r   s    rl   stroke_widthzDrawing.stroke_width{  r   rv   c                     t          j        |           |dk     rt          dt          |          z             t	          j        | j        |           d S )N)r7  r   r   )r   r   r   rf   r   DrawSetStrokeWidthrh   )ri   widths     rl   r7  zDrawing.stroke_width  sT    E22223;;@4;;NOOO"4=%88888rv   c                     t          j        | j                  }|s|                                  t	          t
          |                   S )z(:class:`basestring`) The current text alignment setting.
        It's a string value from :const:`TEXT_ALIGN_TYPES` list.
        It also can be set.

        )r   DrawGetTextAlignmentrh   r   r   r   )ri   text_alignment_indexs     rl   text_alignmentzDrawing.text_alignment  sF      ';DMJJ# 	#  """$%9:;;;rv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nzwand.drawing.TEXT_ALIGN_TYPES)r>  )r   r   r   r   DrawSetTextAlignmentrh   r   )ri   aligns     rl   r>  zDrawing.text_alignment  s`    !"2"A16	8 	8 	8 	8 	$T]%5%;%;E%B%B	D 	D 	D 	D 	Drv   c                 R    t          j        | j                  }t          |          S )z(:class:`bool`) The boolean value which represents whether
        antialiasing is used for text rendering.  It also can be set to
        ``True`` or ``False`` to switch the setting.

        )r   DrawGetTextAntialiasrh   r   )ri   results     rl   text_antialiaszDrawing.text_antialias  s"     -dm<<F||rv   c                 d    t          j        |           t          j        | j        |           d S )N)rE  )r   r   r   DrawSetTextAntialiasrh   r   s     rl   rE  zDrawing.text_antialias  s1    e4444$T]E:::::rv   c                     t          j        | j                  }|s|                                  t	          t
          |                   S )z(:class:`basestring`) The text decoration setting, a string
        from :const:`TEXT_DECORATION_TYPES` list.  It also can be set.

        )r   DrawGetTextDecorationrh   r   r   r   )ri   text_decoration_indexs     rl   text_decorationzDrawing.text_decoration  sF     !( =dm L L$ 	#  """)*?@AAArv   c                     t          j        t          d|           t          j        | j        t                              |                     d S )Nz"wand.drawing.TEXT_DECORATION_TYPES)rK  )r   r   r   r   DrawSetTextDecorationrh   r   )ri   
decorations     rl   rK  zDrawing.text_decoration  s`    !"7"F2<	> 	> 	> 	> 	%dm&;&A&A*&M&M	O 	O 	O 	O 	Orv   c                     t           j        t          d          t          j        | j                  }|s|                                  t          t          |                   S )z(:class:`basestring`) The text direction setting. a string
        from :const:`TEXT_DIRECTION_TYPES` list. It also can be set.NzBthe installed version of ImageMagick does not support this feature)r   DrawGetTextDirectionr   rh   r   r   r   )ri   text_direction_indexs     rl   text_directionzDrawing.text_direction  sh     '/)    ';DMJJ# 	#  """()=>???rv   c                     t           j        t          d          t          j        t
          d|           t          j        | j        t
                              |                     d S )NBThe installed version of ImageMagick does not support this featurez!wand.drawing.TEXT_DIRECTION_TYPES)rR  )	r   rP  r   r   r   r   DrawSetTextDirectionrh   r   )ri   	directions     rl   rR  zDrawing.text_direction  s    '/)   	!"6"E1:	< 	< 	< 	< 	$T]%9%?%?	%J%J	L 	L 	L 	L 	Lrv   c                     d}t          j        | j                  }|r5t          t	          j        |                    }t          j        |          }|S )a&  (:class:`basestring`) The internally used text encoding setting.
        Although it also can be set, but it's not encouraged.

        .. versionchanged: 0.4.1
           Safely release allocated memory with
           :c:func:`MagickRelinquishMemory` instead of :c:func:`libc.free`.

        N)r   DrawGetTextEncodingrh   r   r   r   r   )ri   text_encoding_strtext_encoding_ps      rl   text_encodingzDrawing.text_encoding  sT     !!5dmDD 	N $V%5o%F%F G G%<_MMO  rv   c                     |d}n$t          j        |           t          |          }t          j        | j        |           d S )Nrv   )r[  )r   r   r
   r   DrawSetTextEncodingrh   )ri   encodings     rl   r[  zDrawing.text_encoding  sM     HH$8<<<<h''H#DM8<<<<<rv   c                 j    t           j        t          d          t          j        | j                  S )zc(:class:`numbers.Real`) The setting of the text line spacing.
        It also can be set.

        NrT  )r   DrawGetTextInterlineSpacingr   rh   r   s    rl   text_interline_spacingzDrawing.text_interline_spacing  s9     .6) +9 : : : 24=AAArv   c                     t           j        t          d          t          j        |           t          j        | j        |           d S )NrT  )ra  )r   DrawSetTextInterlineSpacingr   r   r   rh   ri   spacings     rl   ra  zDrawing.text_interline_spacing  sS    .6) +9 : : : 	g>>>>+DM7CCCCCrv   c                 4    t          j        | j                  S )z^(:class:`numbers.Real`) The setting of the word spacing.
        It also can be set.

        )r   DrawGetTextInterwordSpacingrh   r   s    rl   text_interword_spacingzDrawing.text_interword_spacing  s     24=AAArv   c                 d    t          j        |           t          j        | j        |           d S )N)rh  )r   r   r   DrawSetTextInterwordSpacingrh   rd  s     rl   rh  zDrawing.text_interword_spacing  s1    g>>>>+DM7CCCCCrv   c                 4    t          j        | j                  S )z^(:class:`numbers.Real`) The setting of the text kerning.
        It also can be set.

        )r   DrawGetTextKerningrh   r   s    rl   text_kerningzDrawing.text_kerning  s     )$-888rv   c                 d    t          j        |           t          j        | j        |           d S )N)rm  )r   r   r   DrawSetTextKerningrh   )ri   kernings     rl   rm  zDrawing.text_kerning"  r   rv   c                     t          j                    }t          j        | j        |           t	          j        |          }t          j        |          }|S )z(:class:`~wand.color.Color`) The color of a background rectangle
        to place under text annotations.  It also can be set.

        )r   ro   DrawGetTextUnderColorrh   r   rq   rr   r   s      rl   text_under_colorzDrawing.text_under_color'  sL     $&&%dmU;;;$U++(//rv   c                     t          |t                    rt          |          }t          j        |           |5  t          j        | j        |j                   d d d            d S # 1 swxY w Y   d S )N)rs  )rc   r   r   r   rx   r   DrawSetTextUnderColorrh   rz   s     rl   rs  zDrawing.text_under_color3  s    e[)) 	!%LLE7777 	I 	I)$-HHH	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	Ir|   c                     t          j        | j                  }|r)t          j        |          }t          j        |          }nd}dt          |          z   dz   S )a  (:class:`basestring`) The XML text of the Vector Graphics.
        It also can be set.  The drawing-wand XML is experimental,
        and subject to change.

        Setting this property to None will reset all vector graphic properties
        to the default state.

        .. versionadded:: 0.4.0

        .. versionchanged: 0.4.1
           Safely release allocated memory with
           :c:func:`MagickRelinquishMemory` instead of :c:func:`libc.free`.

        rv   z<wand>z</wand>)r   DrawGetVectorGraphicsrh   r   r   r   r   )ri   vg_pvg_strs      rl   vector_graphicszDrawing.vector_graphics;  s[      ,T];; 	%d++F1$77DDF$v,,&22rv   c                 (   |4t          |t                    st          dt          |          z             |t	          j        | j                   d S t          |          }t	          j        | j        |          }|dk    rt          d          d S )Nzexpected a string, not r   zVector graphic not understood.)
rc   r   re   rf   r   DrawResetVectorGraphicsrh   r
   DrawSetVectorGraphicsr   )ri   rz  okays      rl   rz  zDrawing.vector_graphicsS  s    &z/:E0G 0G&5_8M8MMNNN$+DM:::::$_55O01@B BDqyy !ABBB yrv   c           	         t          |t          j                  rt          |          dk    rt	          d          t          |          D ]>\  }}t          |t          j                  st          dt          |          z             ?t          |d         |d         |d         |d         |d         |d	         
          }t          j        | j        t          j        |                     dS )au  Adjusts the current affine transformation matrix with the specified
        affine transformation matrix. Note that the current affine transform is
        adjusted rather than replaced.

        .. sourcecode:: text

                                              | sx  rx  0 |
            | x', y', 1 |  =  | x, y, 1 |  *  | ry  sy  0 |
                                              | tx  ty  1 |

        :param matrix: a list of :class:`~numbers.Real` to define affine
                       matrix ``[sx, rx, ry, sy, tx, ty]``
        :type matrix: :class:`collections.abc.Sequence`

        .. versionadded:: 0.4.0

           z*matrix must be a list of size Real numbersz$expecting numbers.Real in position #r   r               )sxrxrysytxtyN)rc   r	   Sequencer  r   	enumeratenumbersRealre   rf   r   r   
DrawAffinerh   r   r   )ri   matrixidxvalamxs        rl   affinezDrawing.affineb  s    $ &#,// 	K3v;;!3C3CIJJJ!&)) 	+ 	+HCc7<00 + F $S		!* + + ++ fQiF1I$QiF1I$QiF1I7 7 7 	4=&,s*;*;<<<<<rv   r&   c                    t           j        t          d          t          j        ||           t          j        t          d|           t                              |          }t          j        | j        |||           dS )aJ  Paints on the image's opacity channel in order to set effected
        pixels to transparent.

         To influence the opacity of pixels. The available methods are:

        - ``'undefined'``
        - ``'point'``
        - ``'replace'``
        - ``'floodfill'``
        - ``'filltoborder'``
        - ``'reset'``

        .. note::

            This method replaces :meth:`matte()` in ImageMagick version 7.
            An :class:`AttributeError` will be raised if attempting
            to call on a library without ``DrawAlpha`` support.

        .. versionadded:: 0.5.0

        Nz[Method added with ImageMagick version 7. Please use `wand.drawing.Drawing.matte()' instead.rG   rH   wand.drawing.PAINT_METHOD_TYPESpaint_method)	r   	DrawAlphaAttributeErrorr   r   r   r   r   rh   ri   rG   rH   r  ops        rl   alphazDrawing.alpha      , $ F   	a((((!"4"C/;	= 	= 	= 	=  %%l33$-Ar22222rv   c                 ,   t          j        |||           |\  }}|\  }}|\  }}	t          j        | j        t          |          t          |          t          |          t          |          t          |          t          |	                     dS )a  Draws a arc using the current :attr:`stroke_color`,
        :attr:`stroke_width`, and :attr:`fill_color`.

        :param start: (:class:`~numbers.Real`, :class:`numbers.Real`)
                      pair which represents starting x and y of the arc
        :type start: :class:`~collections.abc.Sequence`
        :param end: (:class:`~numbers.Real`, :class:`numbers.Real`)
                      pair which represents ending x and y of the arc
        :type end: :class:`~collections.abc.Sequence`
        :param degree: (:class:`~numbers.Real`, :class:`numbers.Real`)
                      pair which represents starting degree, and ending degree
        :type degree: :class:`~collections.abc.Sequence`

        .. versionadded:: 0.4.0

        )startenddegreeN)r   r   r   DrawArcrh   r  )
ri   r  r  r  start_xstart_yend_xend_ydegree_start
degree_ends
             rl   arczDrawing.arc  s    " 	$5c&IIII u#) jggeeElll++U:->->	@ 	@ 	@ 	@ 	@rv   c           
          t          |          \  }}t          j        | j        |t	          j        |t	          j        t                                         dS )ao  Draws a bezier curve through a set of points on the image, using
        the specified array of coordinates.

        At least four points should be given to complete a bezier path.
        The first & forth point being the start & end point, and the second
        & third point controlling the direction & curve.

        Example bezier on ``image`` ::

            with Drawing() as draw:
                points = [(40,10), # Start point
                          (20,50), # First control
                          (90,10), # Second control
                          (70,40)] # End point
                draw.stroke_color = Color('#000')
                draw.fill_color = Color('#fff')
                draw.bezier(points)
                draw.draw(image)

        :param points: list of x,y tuples
        :type points: :class:`list`

        .. versionadded:: 0.4.0

        N)_list_to_point_infor   
DrawBezierrh   r   castPOINTERr   ri   pointspoints_lpoints_ps       rl   bezierzDrawing.bezier  sY    6  36::84=(!;x	1J1JKK	M 	M 	M 	M 	Mrv   c                     t          j        ||           |\  }}|\  }}t          j        | j        ||||           dS )a  Draws a circle from ``origin`` to ``perimeter``

        :param origin: (:class:`~numbers.Real`, :class:`numbers.Real`)
                       pair which represents origin x and y of circle
        :type origin: :class:`collections.abc.Sequence`
        :param perimeter: (:class:`~numbers.Real`, :class:`numbers.Real`)
                       pair which represents perimeter x and y of circle
        :type perimeter: :class:`collections.abc.Sequence`

        .. versionadded:: 0.4.0

        )origin	perimeterN)r   r   r   
DrawCirclerh   )ri   r  r  origin_xorigin_yperimeter_xperimeter_ys          rl   circlezDrawing.circle  sZ     	$FiHHHH#(#, [4=(H&	5 	5 	5 	5 	5rv   c                 8    t          j        | j                   d S r  )r   ClearDrawingWandrh   r   s    rl   clearzDrawing.clear  s     /////rv   c                 4     t          |           |           S )zdCopies a drawing object.

        :returns: a duplication
        :rtype: :class:`Drawing`

        )rj   )rd   r   s    rl   clonezDrawing.clone  s     tDzz$''''rv   r   c                     t          j        ||           t          j        t          d|           t                              |          }t          j        | j        |||           dS )an  Draws a color on the image using current fill color, starting
        at specified position & method.

        Available methods in :class:`wand.drawing.PAINT_METHOD_TYPES`:

        - ``'undefined'``
        - ``'point'``
        - ``'replace'``
        - ``'floodfill'``
        - ``'filltoborder'``
        - ``'reset'``

        .. versionadded:: 0.4.0

        r  r  r  N)r   r   r   r   r   r   	DrawColorrh   r  s        rl   rt   zDrawing.color  sq      	a((((!"4"C/;	= 	= 	= 	=  %%l33$-Ar22222rv   c                     |d}n$t          j        |           t          |          }t          j        | j        |           dS )zAdds a comment to the vector stream.

        :param message: the comment to set.
        :type message: :class:`basestring`

        .. versionadded:: 0.4.0
        Nrv   )message)r   r   r
   r   DrawCommentrh   )ri   r  s     rl   commentzDrawing.comment  sJ     ?GG$W5555WooGDM733333rv   c           	      0   t          j        |           t          j        ||||           t          j        t          d|           t	          j        |          }t          j        | j        ||||||j	                   | 
                                 dS )a  Composites an image onto the current image, using the specified
        composition operator, specified position, and at the specified size.

        :param operator: the operator that affects how the composite
                         is applied to the image.  available values
                         can be found in the :const:`COMPOSITE_OPERATORS`
                         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

        )operatorr'   topr:  heightz wand.drawing.COMPOSITE_OPERATORSN)r   r   r   r   r   r   r   DrawCompositerh   rk   r   )ri   r  r'   r  r:  r  imager  s           rl   	compositezDrawing.composite  s    * 	 (3333DcvNNNN!"5"D+3	5 	5 	5 	5 !&x00dmRsE$ej	2 	2 	2rv   c                    t          |t                    st          dt          |          z             t          |t                    rt          j        |j        j                  }t          j	        |j        j        |j
                   t          j        |j        j        | j                  }t          j	        |j        j        |           nt          j        |j        | j                  }|s|                                  dS dS )a  Renders the current drawing into the ``image``.  You can simply
        call :class:`Drawing` instance rather than calling this method.
        That means the following code which calls :class:`Drawing` object
        itself::

            drawing(image)

        is equivalent to the following code which calls :meth:`draw()` method::

            drawing.draw(image)

        :param image: the image to be drawn
        :type image: :class:`~wand.image.BaseImage`

        3image must be a wand.image.BaseImage instance, not N)rc   r   re   rf   r   r   MagickGetIteratorIndex	containerrk   MagickSetIteratorIndexr   MagickDrawImagerh   r   )ri   r  previousress       rl   drawzDrawing.draw>  s      %++ 	3 $&*5kk2 3 3 3e[)) 	E5eo6JKKH*5?+?MMM)%/*>NNC*5?+?JJJJ)%*dmDDC 	#  """""	# 	#rv   c           	          |d}t          j        |||           |\  }}|\  }}|\  }}	t          j        | j        ||||||	           dS )a6  Draws a ellipse at ``origin`` with independent x & y ``radius``.
        Ellipse can be partial by setting start & end ``rotation``.

        :param origin: (:class:`~numbers.Real`, :class:`numbers.Real`)
                       pair which represents origin x and y of circle
        :type origin: :class:`collections.abc.Sequence`
        :param radius: (:class:`~numbers.Real`, :class:`numbers.Real`)
                       pair which represents radius x and radius y of circle
        :type radius: :class:`collections.abc.Sequence`
        :param rotation: (:class:`~numbers.Real`, :class:`numbers.Real`)
                         pair which represents start and end of ellipse.
                         Default (0,360)
        :type rotation: :class:`collections.abc.Sequence`

        .. versionadded:: 0.4.0

        N)r   ih  )r  radiusrotation)r   r   r   DrawEllipserh   )
ri   r  r  r  r  r  radius_xradius_yrotation_startrotation_ends
             rl   ellipsezDrawing.ellipse[  s    $ H$F6.6	8 	8 	8 	8#(#('/$DM$h$h*L	: 	: 	: 	: 	:rv   Fc                 ^   t          |t                    st          dt          |          z             t	          j        |           |rt          j        }nt          j        }t          |t                    r,| j
        r |j        | j
                  }nt          |          } ||j        | j        |          s7|                                  |                                 t!          d          fdt#          d          D             }t          j                  t'          | S )a^  Queries font metrics by cloning the ``image``, and rendering
        the ``text`` with the font properties defined on :class:`Drawing`.

        This is useful for determining the size of the rendered text. Set
        ``multiline`` to ``True`` if the given ``text`` contains line-breaks.

        The return value is an instance of :class:`FontMetrics` which
        has the attributes of the text's rendered size, max horizontal advance,
        and distance of ascent & descent from the baseline.

        :param image: the image to be drawn
        :type image: :class:`~wand.image.BaseImage`
        :param text: the text string for get font metrics.
        :type text: :class:`basestring`
        :param multiline: text is multiline or not
        :type multiline: `boolean`
        :returns: :class:`FontMetrics`

        .. versionadded:: 0.3.0
        r  )r   z(Unable to render text with current font.c                      g | ]
}|         S r  r  )r  r	  rD  s     rl   r  z,Drawing.get_font_metrics.<locals>.<listcomp>  s    ...aq	...rv      )rc   r   re   rf   r   r   r   MagickQueryMultilineFontMetricsMagickQueryFontMetricsr   r[  encoder
   rk   rh   r   r   r   r   r!   )ri   r  r   	multilinefont_metrics_fargsrD  s         @rl   get_font_metricszDrawing.get_font_metricsy  s5   * %++ 	3 $&*5kk2 3 3 3 d++++ 	<$DNN$;NdI&& 	$! $"t{4#566d||
DM4@@ 	I  """!!###GHHH....6"::.../77D!!rv   c           	          |\  }}|\  }}t          j        | j        t          |          t          |          t          |          t          |                     dS )a  Draws a line ``start`` to ``end``.

        :param start: (:class:`~numbers.Integral`, :class:`numbers.Integral`)
                      pair which represents starting x and y of the line
        :type start: :class:`collections.abc.Sequence`
        :param end: (:class:`~numbers.Integral`, :class:`numbers.Integral`)
                    pair which represents ending x and y of the line
        :type end: :class:`collections.abc.Sequence`

        N)r   DrawLinerh   int)ri   r  r  r  r  r  r  s          rl   linezDrawing.line  s\     !uWs7||USZZ	1 	1 	1 	1 	1rv   c                    t           j        t          d          t          j        ||           t          j        t          d|           t                              |          }t          j        | j        |||           dS )aU  Paints on the image's opacity channel in order to set effected
        pixels to transparent.

         To influence the opacity of pixels. The available methods are:

        - ``'undefined'``
        - ``'point'``
        - ``'replace'``
        - ``'floodfill'``
        - ``'filltoborder'``
        - ``'reset'``

        .. note::

            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

        Nz[Method removed from ImageMagick version. Please use `wand.drawing.Drawing.alpha()' instead.r  r  r  )	r   	DrawMatter  r   r   r   r   r   rh   r  s        rl   mattezDrawing.matte  r  rv   c                 8    t          j        | j                   | S )zAdds a path element to the current path which closes
        the current subpath by drawing a straight line from the current point
        to the current subpath's most recent starting point.

        .. versionadded:: 0.4.0

        )r   DrawPathCloserh   r   s    rl   
path_closezDrawing.path_close  s     	dm,,,rv   c           	      |   |t          d          |t          d          |\  }}|r|\  }}n|\  \  }	}
\  }}|r>|rt          j        | j        ||||           n_t          j        | j        ||||           nA|r t          j        | j        |	|
||||           nt          j        | j        |	|
||||           | S )a4  Draws a cubic Bezier curve from the current point to given ``to``
        (x,y) coordinate using ``controls`` points at the beginning and
        the end of the curve.
        If ``smooth`` is set to True, only one ``controls`` is expected
        and the previous control is used, else two pair of coordinates are
        expected to define the control points. The ``to`` coordinate then
        becomes the new current point.

        :param to: (:class:`~numbers.Real`, :class:`numbers.Real`)
                   pair which represents coordinates to draw to
        :type to: :class:`collections.abc.Sequence`
        :param controls: (:class:`~numbers.Real`, :class:`numbers.Real`)
                         coordinate to used to influence curve
        :type controls: :class:`collections.abc.Sequence`
        :param smooth: :class:`bool` assume last defined control coordinate
        :type smooth: :class:`bool`
        :param relative: treat given coordinates as relative to current point
        :type relative: :class:`bool`

        .. versionadded:: 0.4.0

        Nto is missingzcontrols is missing)re   r   DrawPathCurveToSmoothRelativerh   DrawPathCurveToSmoothAbsoluteDrawPathCurveToRelativeDrawPathCurveToAbsolute)ri   tocontrolssmoothrelativerG   rH   rE   rF   rC   rD   s              rl   
path_curvezDrawing.path_curve  s.   . :O,,,12221 	*FB!)HRhr2 	F D5dm68"aD D D D 5dm68"aD D D D  F/02BB1F F F F /02BB1F F Frv   c           	         |t          d          |\  }}|rn|r6t          j        | j        t	          |          t	          |                     nt          j        | j        t	          |          t	          |                     n|t          d          |\  }}|rRt          j        | j        t	          |          t	          |          t	          |          t	          |                     nQt          j        | j        t	          |          t	          |          t	          |          t	          |                     | S )a  Draws a quadratic Bezier curve from the current point to given
        ``to`` coordinate. The control point is assumed to be the reflection of
        the control point on the previous command if ``smooth`` is True, else a
        pair of ``control`` coordinates must be given. Each coordinates can be
        relative, or absolute, to the current point by setting the ``relative``
        flag. The ``to`` coordinate then becomes the new current point, and the
        ``control`` coordinate will be assumed when called again
        when ``smooth`` is set to true.

        :param to: (:class:`~numbers.Real`, :class:`numbers.Real`)
                   pair which represents coordinates to draw to
        :type to: :class:`collections.abc.Sequence`
        :param control: (:class:`~numbers.Real`, :class:`numbers.Real`)
                        coordinate to used to influence curve
        :type control: :class:`collections.abc.Sequence`
        :param smooth: assume last defined control coordinate
        :type smooth: :class:`bool`
        :param relative: treat given coordinates as relative to current point
        :type relative: :class:`bool`

        .. versionadded:: 0.4.0

        Nr  zcontrol is missing)re   r   ,DrawPathCurveToQuadraticBezierSmoothRelativerh   r  ,DrawPathCurveToQuadraticBezierSmoothAbsolute&DrawPathCurveToQuadraticBezierRelative&DrawPathCurveToQuadraticBezierAbsolute)	ri   r  controlr   r  rG   rH   rC   rD   s	            rl   path_curve_to_quadratic_bezierz&Drawing.path_curve_to_quadratic_bezier  sH   2 :O,,,1 	I DM588U1XX    DM588U1XX     4555FB I>t}?DRyy?DRyy?DQxx?DQxx	I I I I >t}?DRyy?DRyy?DQxx?DQxx	I I I
 rv   c                 P   |t          d          |t          d          |\  }}|\  }	}
|r|t          j        | j        t	          |	          t	          |
          t	          |          t          |          t          |          t	          |          t	          |                     n{t          j        | j        t	          |	          t	          |
          t	          |          t          |          t          |          t	          |          t	          |                     | S )a  Draws an elliptical arc from the current point to given ``to``
        coordinates. The ``to`` coordinates can be relative, or absolute,
        to the current point by setting the ``relative`` flag.
        The size and orientation of the ellipse are defined by
        two radii (rx, ry) in ``radius`` and an ``rotation`` parameters,
        which indicates how the ellipse as a whole is
        rotated relative to the current coordinate system. The center of the
        ellipse is calculated automagically to satisfy the constraints imposed
        by the other parameters. ``large_arc`` and ``clockwise`` contribute to
        the automatic calculations and help determine how the arc is drawn.
        If ``large_arc`` is True then draw the larger of the available arcs.
        If ``clockwise`` is true, then draw the arc matching a clock-wise
        rotation.

        :param to: (:class:`~numbers.Real`, :class:`numbers.Real`)
                   pair which represents coordinates to draw to
        :type to: :class:`collections.abc.Sequence`
        :param radius: (:class:`~numbers.Real`, :class:`numbers.Real`)
                       pair which represents the radii of the ellipse to draw
        :type radius: :class:`collections.abc.Sequence`
        :param rotate: degree to rotate ellipse on x-axis
        :type rotate: :class:`~numbers.Real`
        :param large_arc: draw largest available arc
        :type large_arc: :class:`bool`
        :param clockwise: draw arc path clockwise from start to target
        :type clockwise: :class:`bool`
        :param relative: treat given coordinates as relative to current point
        :type relative: :class:`bool`

        .. versionadded:: 0.4.0

        Nr  zradius is missing)re   r   DrawPathEllipticArcRelativerh   r  r   DrawPathEllipticArcAbsolute)ri   r  r  r  	large_arc	clockwiser  rG   rH   r  r  s              rl   path_elliptic_arczDrawing.path_elliptic_arcN  s   D :O,,,>/0001B 	D/05b		59905h04Y04Y05a%((D D D D /05b		59905h04Y04Y05a%((D D D rv   c                 8    t          j        | j                   | S )zGTerminates the current path.

        .. versionadded:: 0.4.0

        )r   DrawPathFinishrh   r   s    rl   path_finishzDrawing.path_finish  s     	t}---rv   c                     t          j        |           |rt          j        | j        |           nt          j        | j        |           | S )a<  Draws a horizontal line path from the current point to the target
        point. Given ``x`` parameter can be relative, or absolute, to the
        current point by setting the ``relative`` flag. The target point then
        becomes the new current point.

        :param x: :class:`~numbers.Real`
                      x-axis point to draw to.
        :type x: :class:`~numbers.Real`
        :param relative: :class:`bool`
                    treat given point as relative to current point
        :type relative: :class:`bool`

        .. versionadded:: 0.4.0

        rG   )r   r   r    DrawPathLineToHorizontalRelativerh    DrawPathLineToHorizontalAbsolute)ri   rG   r  s      rl   path_horizontal_linezDrawing.path_horizontal_line  sS      	#### 	G4T]AFFFF4T]AFFFrv   c                     t          j        |           |\  }}|rt          j        | j        ||           nt          j        | j        ||           | S )a|  Draws a line path from the current point to the given ``to``
        coordinate. The ``to`` coordinates can be relative, or absolute, to the
        current point by setting the ``relative`` flag. The coordinate then
        becomes the new current point.

        :param to: (:class:`~numbers.Real`, :class:`numbers.Real`)
                      pair which represents coordinates to draw to.
        :type to: :class:`collections.abc.Sequence`
        :param relative: :class:`bool`
                    treat given coordinates as relative to current point
        :type relative: :class:`bool`

        .. versionadded:: 0.4.0

        r  )r   r   r   DrawPathLineToRelativerh   DrawPathLineToAbsoluteri   r  r  rG   rH   s        rl   	path_linezDrawing.path_line  s`      	$++++1 	@*4=!Q????*4=!Q???rv   c                     t          j        |           |\  }}|rt          j        | j        ||           nt          j        | j        ||           | S )a  Starts a new sub-path at the given coordinates. Given ``to``
        parameter can be relative, or absolute, by setting the ``relative``
        flag.

        :param to: (:class:`~numbers.Real`, :class:`numbers.Real`)
                      pair which represents coordinates to draw to.
        :type to: :class:`collections.abc.Sequence`
        :param relative: :class:`bool`
                    treat given coordinates as relative to current point
        :type relative: :class:`bool`

        .. versionadded:: 0.4.0

        r  )r   r   r   DrawPathMoveToRelativerh   DrawPathMoveToAbsoluter  s        rl   	path_movezDrawing.path_move  s`     	$++++1 	@*4=!Q????*4=!Q???rv   c                 8    t          j        | j                   | S )a  Declares the start of a path drawing list which is terminated by a
        matching :meth:`path_finish()` command. All other `path_*` commands
        must be enclosed between a :meth:`path_start()` and a
        :meth:`path_finish()` command. This is because path drawing commands
        are subordinate commands and they do not function by themselves.

        .. versionadded:: 0.4.0

        )r   DrawPathStartrh   r   s    rl   
path_startzDrawing.path_start  s     	dm,,,rv   c                     t          j        |           |rt          j        | j        |           nt          j        | j        |           | S )a:  Draws a vertical line path from the current point to the target
        point. Given ``y`` parameter can be relative, or absolute, to the
        current point by setting the ``relative`` flag. The target point then
        becomes the new current point.

        :param y: :class:`~numbers.Real`
                      y-axis point to draw to.
        :type y: :class:`~numbers.Real`
        :param relative: :class:`bool`
                    treat given point as relative to current point
        :type relative: :class:`bool`

        .. versionadded:: 0.4.0

        rH   )r   r   r   DrawPathLineToVerticalRelativerh   DrawPathLineToVerticalAbsolute)ri   rH   r  s      rl   path_vertical_linezDrawing.path_vertical_line  sS      	#### 	E24=!DDDD24=!DDDrv   c           
          t          |          \  }}t          j        | j        |t	          j        |t	          j        t                                         dS )a  Draws a polygon using the current :attr:`stroke_color`,
        :attr:`stroke_width`, and :attr:`fill_color`, using the specified
        array of coordinates.

        Example polygon on ``image`` ::

            with Drawing() as draw:
                points = [(40,10), (20,50), (90,10), (70,40)]
                draw.polygon(points)
                draw.draw(image)

        :param points: list of x,y tuples
        :type points: :class:`list`

        .. versionadded:: 0.4.0

        N)r  r   DrawPolygonrh   r   r  r  r   r  s       rl   polygonzDrawing.polygon  sY    &  36::8DM8"K&.2K2KLL	N 	N 	N 	N 	Nrv   c           
          t          |          \  }}t          j        | j        |t	          j        |t	          j        t                                         dS )a  Draws a polyline using the current :attr:`stroke_color`,
        :attr:`stroke_width`, and :attr:`fill_color`, using the specified
        array of coordinates.

        Identical to :class:`~wand.drawing.Drawing.polygon`, but without closed
        stroke line.

        :param points: list of x,y tuples
        :type points: :class:`list`

        .. versionadded:: 0.4.0

        N)r  r   DrawPolylinerh   r   r  r  r   r  s       rl   polylinezDrawing.polyline  sY      36::8T]H#[6>)3L3LMM	O 	O 	O 	O 	Orv   c                 h    t          j        ||           t          j        | j        ||           dS )a
  Draws a point at given ``x`` and ``y``

        :param x: :class:`~numbers.Real` x of point
        :type x: :class:`~numbers.Real`
        :param y: :class:`~numbers.Real` y of point
        :type y: :class:`~numbers.Real`

        .. versionadded:: 0.4.0

        r  N)r   r   r   	DrawPointrh   r   s      rl   rZ   zDrawing.point#  s7     	a(((($-A.....rv   c                 ~    t          t          j        | j                            }|s|                                  |S )a  Pop destroys the current tip of the drawing context stack,
        and restores the parent style context.
        See :meth:`push()` method for an example.

        .. note::

            Popping the graphical context stack will not erase,
            or alter, any previously executed drawing commands.

        :returns: success of pop operation.
        :rtype: :class:`bool`

        .. versionadded:: 0.4.0

        )r   r   PopDrawingWandrh   r   ri   oks     rl   popzDrawing.pop1  s=      '(7788 	#  """	rv   c                 8    t          j        | j                   dS )zMTerminates a clip path definition.

        .. versionadded:: 0.4.0

        N)r   DrawPopClipPathrh   r   s    rl   pop_clip_pathzDrawing.pop_clip_pathF  s     	.....rv   c                 8    t          j        | j                   dS )zHTerminates a definition list.

        .. versionadded:: 0.4.0

        N)r   DrawPopDefsrh   r   s    rl   pop_defszDrawing.pop_defsN  s     	DM*****rv   c                 8    t          j        | j                   dS )zKTerminates a pattern definition.

        .. versionadded:: 0.4.0

        N)r   DrawPopPatternrh   r   s    rl   pop_patternzDrawing.pop_patternV  s     	t}-----rv   c                 ~    t          t          j        | j                            }|s|                                  |S )a$  Grows the current drawing context stack by one, and inherits
        the previous style attributes. Use :class:`Drawing.pop` to return
        to restore previous style attributes.

        This is useful for drawing shapes with different styles
        without repeatedly setting the similar
        :meth:`fill_color <wand.drawing.Drawing.fill_color>` &
        :meth:`stroke_color <wand.drawing.Drawing.stroke_color>` properties.

        For example::

            with Drawing() as ctx:
                ctx.fill_color = Color('GREEN')
                ctx.stroke_color = Color('ORANGE')
                ctx.push()
                ctx.fill_color = Color('RED')
                ctx.text(x1, y1, 'this is RED with ORANGE outline')
                ctx.push()
                ctx.stroke_color = Color('BLACK')
                ctx.text(x2, y2, 'this is RED with BLACK outline')
                ctx.pop()
                ctx.pop()
                ctx.text(x3, y3, 'this is GREEN with ORANGE outline')

        Which translate to the following MVG::

            push graphic-context
                fill "GREEN"
                stroke "ORANGE"
                push graphic-context
                    fill "RED"
                    text x1,y1 "this is RED with ORANGE outline"
                    push graphic-context
                        stroke "BLACK"
                        text x2,y2 "this is RED with BLACK outline"
                    pop graphic-context
                pop graphic-context
                text x3,y3 "this is GREEN with ORANGE outline"
            pop graphic-context

        .. note::

            Pushing graphical context does not reset any previously
            drawn artifacts.

        :returns: success of push operation.
        :rtype: :class:`bool`

        .. versionadded:: 0.4.0

        )r   r   PushDrawingWandrh   r   r4  s     rl   pushzDrawing.push^  s>    h ')$-8899 	#  """	rv   c                 T    t          j        | j        t          |                     dS )aJ  Starts a clip path definition which is comprised of any number of
        drawing commands and terminated by a :class:`Drawing.pop_clip_path`
        command.

        :param clip_mask_id: string identifier to associate with the clip path.
        :type clip_mask_id: :class:`basestring`

        .. versionadded:: 0.4.0

        N)r   DrawPushClipPathrh   r
   )ri   clip_mask_ids     rl   push_clip_pathzDrawing.push_clip_path  s'     	 |0D0DEEEEErv   c                 8    t          j        | j                   dS )a
  Indicates that commands up to a terminating
        :class:`Drawing.pop_defs` command create named elements (e.g.
        clip-paths, textures, etc.) which may safely be processed earlier for
        the sake of efficiency.

        .. versionadded:: 0.4.0

        N)r   DrawPushDefsrh   r   s    rl   	push_defszDrawing.push_defs  s     	T]+++++rv   c                     t          j        |           t          j        ||||           t          j        | j        t          |          ||||          }|s|                                  t          |          S )a  Indicates that subsequent commands up to a
        :class:`Drawing.pop_pattern` command comprise the definition of a named
        pattern. The pattern space is assigned top left corner coordinates, a
        width and height, and becomes its own drawing space. Anything which can
        be drawn may be used in a pattern definition.
        Named patterns may be used as stroke or brush definitions.

        :param pattern_id: a unique identifier for the pattern.
        :type pattern_id: :class:`basestring`
        :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: :class:`bool`

        .. versionadded:: 0.4.0

        )
pattern_idr  )	r   r   r   r   DrawPushPatternrh   r
   r   r   )ri   rK  r'   r  r:  r  r~  s          rl   push_patternzDrawing.push_pattern  s    0 	 J7777DcvNNNN&t}fZ6H6H'+S',f6 6  	#  """Dzzrv   c
           	         |t          d          |t          d          ||t          d          ||t          d          ||t          d          ||t          d          t          |t          j                  st          dt	          |          z             t          |t          j                  st          d	t	          |          z             |9t          |t          j                  st          d
t	          |          z             |9t          |t          j                  st          dt	          |          z             |9t          |t          j                  st          dt	          |          z             |9t          |t          j                  st          dt	          |          z             |+|dk     rt          dt	          |          z             ||z   }n)||k     r#t          d                    ||                    |+|dk     rt          dt	          |          z             ||z   }n)||k     r#t          d                    ||                    ||x}}	||	>|d}|	d}	t          j        ||	           t          j
        | j        ||||||	           nt          j        | j        ||||           |                                  dS )a
  Draws a rectangle using the current :attr:`stroke_color`,
        :attr:`stroke_width`, and :attr:`fill_color`.

        .. sourcecode:: text

           +--------------------------------------------------+
           |              ^                         ^         |
           |              |                         |         |
           |             top                        |         |
           |              |                         |         |
           |              v                         |         |
           | <-- left --> +-------------------+  bottom       |
           |              |             ^     |     |         |
           |              | <-- width --|---> |     |         |
           |              |           height  |     |         |
           |              |             |     |     |         |
           |              |             v     |     |         |
           |              +-------------------+     v         |
           | <--------------- right ---------->               |
           +--------------------------------------------------+

        :param left: x-offset of the rectangle to draw
        :type left: :class:`numbers.Real`
        :param top: y-offset of the rectangle to draw
        :type top: :class:`numbers.Real`
        :param right: second x-offset of the rectangle to draw.
                      this parameter and ``width`` parameter are exclusive
                      each other
        :type right: :class:`numbers.Real`
        :param bottom: second y-offset of the rectangle to draw.
                       this parameter and ``height`` parameter are exclusive
                       each other
        :type bottom: :class:`numbers.Real`
        :param width: the :attr:`width` of the rectangle to draw.
                      this parameter and ``right`` parameter are exclusive
                      each other
        :type width: :class:`numbers.Real`
        :param height: the :attr:`height` of the rectangle to draw.
                       this parameter and ``bottom`` parameter are exclusive
                       each other
        :type height: :class:`numbers.Real`
        :param radius: the corner rounding. this is a short-cut for setting
                       both :attr:`xradius`, and :attr:`yradius`
        :type radius: :class:`numbers.Real`
        :param xradius: the :attr:`xradius` corner in horizontal direction.
        :type xradius: :class:`numbers.Real`
        :param yradius: the :attr:`yradius` corner in vertical direction.
        :type yradius: :class:`numbers.Real`

        .. versionadded:: 0.3.6

        .. versionchanged:: 0.4.0
           Radius keywords added to create rounded rectangle.

        Nzleft is missingztop is missingzright/width is missingzbottom/height is missingzFparameters right and width are exclusive each other; use one at a timezHparameters bottom and height are exclusive each other; use one at a timezleft must be numbers.Real, not ztop must be numbers.Real, not z right must be numbers.Real, not z!bottom must be numbers.Real, not z width must be numbers.Real, not z!height must be numbers.Real, not r   zwidth must be positive, not z0right must be more than left ({0!r}), not {1!r})zheight must be positive, not z0bottom must be more than top ({0!r}), not {1!r})r   )xradiusyradius)re   rc   r  r  rf   r   formatr   r   r   DrawRoundRectanglerh   DrawRectangler   )
ri   r'   r  r)   bottomr:  r  r  rO  rP  s
             rl   	rectanglezDrawing.rectangle  s)   t <-...[,---]u}4555^6777-5= 7 8 8 8.FN 7 8 8 8D',// 	P=T

JKKKC.. 		P<tCyyHIII-:eW\#B#B->eLMMM.Jvw|$D$D.?$v,,NOOO-:eW\#B#B->eLMMM.Jvw|$D$D.?$v,,NOOO=qyy !?$u++!MNNN5LEET\\ **0&u*=*=? ? ?>zz !@!%f". / / /6\FFc\\ **0&f*=*=? ? ? &&Gg'"5"7GDDDD&t}dC'.9 9 9 9 !$-sE6JJJrv   c                 d    t          j        |           t          j        | j        |           dS )zApplies the specified rotation to the current coordinate space.

        :param degree: degree to rotate
        :type degree: :class:`~numbers.Real`

        .. versionadded:: 0.4.0

        )r  N)r   r   r   
DrawRotaterh   )ri   r  s     rl   rotatezDrawing.rotateA  s3     	f----4=&11111rv         ?c                 h    t          j        ||           t          j        | j        ||           dS )ak  
        Adjusts the scaling factor to apply in the horizontal and vertical
        directions to the current coordinate space.

        :param x: Horizontal scale factor. Default `1.0`
        :type x: :class:`~numbers.Real`
        :param y: Vertical scale factor. Default `1.0`
        :type y: :class:`~numbers.Real`

        .. versionadded:: 0.4.0

        r  N)r   r   r   	DrawScalerh   r   s      rl   scalezDrawing.scaleM  s7     	a(((($-A.....rv   c                     t          j        |           |d         dk    rt          d          t          j        | j        t          |                     |                                  dS )a  Sets the URL to use as a fill pattern for filling objects. Only
        local URLs ("#identifier") are supported at this time. These local URLs
        are normally created by defining a named fill pattern with
        Drawing.push_pattern & Drawing.pop_pattern.

        :param url: URL to use to obtain fill pattern.
        :type url: :class:`basestring`

        .. versionadded:: 0.4.0

        urlr   #1value not a relative URL, expecting "#identifier"N)r   r   r   r   DrawSetFillPatternURLrh   r
   r   ri   r_  s     rl   set_fill_pattern_urlzDrawing.set_fill_pattern_url]  so     	 S))))q6S== 7 8 8 8%dmVC[[AAArv   c                     t          j        |           |d         dk    rt          d          t          j        | j        t          |                     |                                  dS )a  Sets the pattern used for stroking object outlines. Only local
        URLs ("#identifier") are supported at this time. These local URLs are
        normally created by defining a named stroke pattern with
        Drawing.push_pattern & Drawing.pop_pattern.

        :param url: URL to use to obtain stroke pattern.
        :type url: :class:`basestring`

        .. versionadded:: 0.4.0

        r^  r   r`  ra  N)r   r   r   r   DrawSetStrokePatternURLrh   r
   r   rc  s     rl   set_stroke_pattern_urlzDrawing.set_stroke_pattern_urlp  so     	 S))))q6S== 7 8 8 8'vc{{CCCrv   c                     |/t          j        |           t          j        | j        |           |1t          j        |           t          j        | j        |           dS dS )aV  Skews the current coordinate system in the horizontal direction if
        ``x`` is given, and vertical direction if ``y`` is given.

        :param x: Skew horizontal direction
        :type x: :class:`~numbers.Real`
        :param y: Skew vertical direction
        :type y: :class:`~numbers.Real`

        .. versionadded:: 0.4.0

        Nr  r&  )r   r   r   	DrawSkewXrh   	DrawSkewYr   s      rl   skewzDrawing.skew  sm     ="Q''''dmQ///="Q''''dmQ///// =rv   c                    t          j        ||           t          j        |           |st          d          t	          |t
                    r(| j        sd| _        |                    | j                  }t          j	        |          }t          j        | j        ||t          j        |t          j        t          j                                       dS )a]  Writes a text ``body`` into (``x``, ``y``).

        :param x: the left offset where to start writing a text
        :type x: :class:`numbers.Integral`
        :param y: the baseline where to start writing text
        :type y: :class:`numbers.Integral`
        :param body: the body string to write
        :type body: :class:`basestring`

        r  )bodyzbody string cannot be emptyzUTF-8N)r   assert_unsigned_integerr   r   rc   r   r[  r  r   create_string_bufferr   DrawAnnotationrh   r  r  c_ubyte)ri   rG   rH   rm  body_ps        rl   r   zDrawing.text  s     	*Q!4444 d++++ 	<:;;;dI&& 	3 % -%,";;t122D,T22M1aKv~ > >??	
 	
 	
 	
 	
rv   c                 h    t          j        ||           t          j        | j        ||           dS )aU  Applies a translation to the current coordinate system which moves
        the coordinate system origin to the specified coordinate.

        :param x: Skew horizontal direction
        :type x: :class:`~numbers.Real`
        :param y: Skew vertical direction
        :type y: :class:`~numbers.Real`

        .. versionadded:: 0.4.0
        r  N)r   r   r   DrawTranslaterh   r   s      rl   	translatezDrawing.translate  s7     	a((((dmQ22222rv   c                 p    t          j        ||||           t          j        | j        ||||           dS )a)  Viewbox sets the overall canvas size to be recorded with the drawing
        vector data. Usually this will be specified using the same size as the
        canvas image. When the vector data is saved to SVG or MVG formats, the
        viewbox is use to specify the size of the canvas image that a viewer
        will render the vector data on.

        :param left: the left most point of the viewbox.
        :type left: :class:`~numbers.Integral`
        :param top: the top most point of the viewbox.
        :type top: :class:`~numbers.Integral`
        :param right: the right most point of the viewbox.
        :type right: :class:`~numbers.Integral`
        :param bottom: the bottom most point of the viewbox.
        :type bottom: :class:`~numbers.Integral`

        .. versionadded:: 0.4.0

        )r'   r  r)   rT  N)r   r   r   DrawSetViewboxrh   )ri   r'   r  r)   rT  s        rl   viewboxzDrawing.viewbox  sH    & 	!t(-f	> 	> 	> 	>t}dCGGGGGrv   c                 ,    |                      |          S r  )r  )ri   r  s     rl   __call__zDrawing.__call__  s    yyrv   r  )NNr&   )r   r   r&   )F)NNFF)NNr   FFF)NF)	NNNNNNNNN)r   )rY  rY  )NN)r   r   )a__name__
__module____qualname____doc__r   IsDrawingWandc_is_resourceDestroyDrawingWandc_destroy_resourceDrawGetExceptionc_get_exceptionDrawClearExceptionc_clear_exceptionrm   propertyru   setterr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r&  r,  r2  r7  r>  rE  rK  rR  r[  ra  rh  rm  rs  rz  r  r  r  r  r  r  r  rt   r  r  r  r  r  r  r  r  r  r	  r  r  r  r  r!  r$  r)  r,  r/  rZ   r6  r9  r<  r?  rB  rF  rI  rM  rU  rX  r\  rd  rg  rk  r   ru  rx  rz  r  rv   rl   r    r       s        $ )M 3.O2	! 	! 	! 	!   X F F F   X" = = = * * X* B B B * * X* C C C 	 	 X	 D D D 9 9 X9 ; ; ; 	6 	6 X	6 B B B   X 
[9 9 [9   X" A A A 
  
  X
  B B B 6 6 X6 5 5 5 2 2 X2 A A A . . X. ; ; ; 8 8 X8 9 9 9 	2 	2 X	2 ^J J ^J 	5 	5 X	5 ^6 6 ^6 & & X& H H H   X F F F   X. 5 5 5 > > X> ? ? ? 4 4 X4 E E E 6 6 X6 H H H > > X> D D D ; ; X; = = = 9 9 X9 9 9 9 	< 	< X	< D D D   X ; ; ; B B XB O O O @ @ X@ 
L 
L 
L ! ! X!  = = = 	B 	B X	B "D D #"D B B XB "D D #"D 9 9 X9 ; ; ; 	 	 X	 I I I 3 3 X3. C C C= = =: 3  3  3  3D@ @ @4M M M M>5 5 5&0 0 0( ( (3 3 3 3.4 4 4 4  ># # #:: : : :<," ," ," ,"\1 1 1" 3  3  3  3D	 	 	/ / / /b ?C>C6 6 6 6p @CEJ6 6 6 6p     .   0   .     .N N N N.O O O O&/ / /  */ / /+ + +. . .7 7 7rF F F	, 	, 	,  B AE@Do o o ob
2 
2 
2 
2/ / / /   &  &0 0 0 0&
 
 
83 3 3 3H H H.         rv   r    c                       e Zd ZdZd ZdS )r!   a	  
    The tuple subtype which consists of font metrics data.

    Pixel values can be converted to points by the following:

    .. math::

        points = \frac{pixels \ast 72}{resolution}

    .. py:attribute:: character_width

        (:class:`numbers.Real`) The horizontal value of the ``x`` in pixels.

    .. py:attribute:: character_height

        (:class:`numbers.Real`) The vertical value of the ``x`` in pixels.

    .. py:attribute:: ascender

        (:class:`numbers.Real`) The largest distance from the text baseline
        to the highest point above the x-height. This value should always be
        positive.

    .. py:attribute:: descender

        (:class:`numbers.Real`) The farthest distance from the text baseline
        to the lowest point below the x-height. This value should always be
        negative.

    .. py:attribute:: text_width

        (:class:`numbers.Real`) The full width of the text.

    .. py:attribute:: text_height

        (:class:`numbers.Real`) The full height of the text.

    .. py:attribute:: maximum_horizontal_advance

        (:class:`numbers.Real`) The largest distance from the start of one
        character to the start of the following character.

    .. py:attribute:: x1

        (:class:`numbers.Real`) The horizontal value of the bounding box's
        starting corner.

    .. py:attribute:: y1

        (:class:`numbers.Real`) The vertical value of the bounding box's
        starting corner.

    .. py:attribute:: x2

        (:class:`numbers.Real`) The horizontal value of the bounding box's
        ending corner.

    .. py:attribute:: y2

        (:class:`numbers.Real`) The vertical value of the bounding box's
        ending corner.

    .. py:attribute:: x

        (:class:`numbers.Real`) The horizontal value of the origin.

    .. py:attribute:: y

        (:class:`numbers.Real`) The vertical value of the origin.

    .. note::

        When using :meth:`~wand.drawing.Drawing.get_font_metrics`, the returned
        attributes ``x1``, ``y1``, ``x2``, ``y2``, ``x`` and ``y`` can be
        ignored as they are used for internal FreeType rendering, and have no
        meaningful context.

    .. versionadded:: 0.3.0

    .. versionchanged:: 0.6.8
       Created sub-class of the namedtuple to improve auto-documentation.
    c                     | j         | j        fS )zShort-cut method for the width & height of the rendered text.

        :returns: (width, height)

        .. versionadded:: 0.6.8
        )r@   rA   r   s    rl   r   zFontMetrics.size/  s      000rv   N)r{  r|  r}  r~  r   r  rv   rl   r!   r!     s0        Q Qd1 1 1 1 1rv   r!   c                 H   t          | t                    st          dt          |           z             t	          |           }d}||z  }t          j        |z              }t          |          D ]/}||z  }||z  }t          j        | |         |                   ||<   0||fS )a  
    Helper method to convert a list of tuples to ``const * PointInfo``

    :param points: a list of tuples
    :type points: `list`
    :returns: tuple of point length and c_double array
    :rtype: `tuple`
    :raises: `TypeError`

    .. versionadded:: 0.4.0

    zpoints must be a list, not r  )rc   listre   rf   r  r   r   r   )r  point_length
tuple_sizepoint_info_size
point_infodouble_indextuple_indextuple_offsets           rl   r  r  9  s     fd## F5VDEEEv;;LJ"Z/O/O366J// 
 
"j0#j0#)?;-$
 $

<   *%%rv   ).r~  collectionsr   r   r   apir   cdefs.structuresr   r   rt   r   compatr	   r
   r   r   r   r   
exceptionsr   r  r   r   rh   r   sequencer   __all__r   r   r   r   r   r   r   r   r   r   r   r   r    
namedtupler!   r  r  rv   rl   <module>r     s                      5 5 5 5 5 5 5 5       E E E E E E E E E E E E E E E E / / / / / / 1 1 1 1 1 1 1 1       ! ! ! ! ! !=* : )  G  6+ $< B : ;< C  C  C  C  C h C  C  C L:[1 [1 [1 [1 [1(+()@B B [1 [1 [1|& & & & &rv   