
     h)                         d dl mZ d dl mZ ddddZddd	d
Z G d de      Z G d de      Z G d de      Z G d de      Z	 G d de      Z
 G d de      Z G d de      Zy)    strlist	is_stringxMidxMinxMax)centerleftrightYMidYMinYMax)middletopbottomc                   &    e Zd ZdZddZd ZddZy)ViewBoxa   The **ViewBox** mixin provides the ability to specify that a
    given set of graphics stretch to fit a particular container element.

    The value of the **viewBox** attribute is a list of four numbers
    **min-x**, **min-y**, **width** and **height**, separated by whitespace
    and/or a comma, which specify a rectangle in **user space** which should
    be mapped to the bounds of the viewport established by the given element,
    taking into account attribute **preserveAspectRatio**.

    c                 (    t        ||||g      | d<   y)a~   Specify a rectangle in **user space** (no units allowed) which
        should be mapped to the bounds of the viewport established by the
        given element.

        :param number minx: left border of the viewBox
        :param number miny: top border of the viewBox
        :param number width: width of the viewBox
        :param number height: height of the viewBox

        viewBoxNr   )selfminxminywidthheights        k/home/developers/rajanand/mypropertyqr-fmb-refixing-v2/venv/lib/python3.12/site-packages/svgwrite/mixins.pyviewboxzViewBox.viewbox   s     "D$v#>@Y    c                     d| d<   y)zh Stretch viewBox in x and y direction to fill viewport, does not
        preserve aspect ratio.
        nonepreserveAspectRatioN )r   s    r   stretchzViewBox.stretch'   s     '-"#r   c                 t    | j                   r|dvrt        d|z        t        |   t        |   d|| d<   y)a   Set the **preserveAspectRatio** attribute.

        :param string horiz: horizontal alignment ``'left | center | right'``
        :param string vert: vertical alignment ``'top | middle | bottom'``
        :param string scale: scale method ``'meet | slice'``

        ============= =======================================================
        Scale methods Description
        ============= =======================================================
        ``'meet'``    preserve aspect ration and zoom to limits of viewBox
        ``'slice'``   preserve aspect ration and viewBox touch viewport on
                      all bounds, viewBox will extend beyond the bounds of
                      the viewport
        ============= =======================================================

        )meetslicezInvalid scale parameter '%s' r!   N)debug
ValueError_horiz_vert)r   horizvertscales       r   fitzViewBox.fit-   s>    " ::%'88;eCDD39%=te&T"#r   N)r   r   r   r   )r
   r   r%   )__name__
__module____qualname____doc__r   r#   r/   r"   r   r   r   r      s    	A-Ur   r   c                   D    e Zd ZdZdZddZddZddZd Zd Z	d	 Z
d
 Zy)	Transforma|   The **Transform** mixin operates on the **transform** attribute.
    The value of the **transform** attribute is a `<transform-list>`, which
    is defined as a list of transform definitions, which are applied in the
    order provided. The individual transform definitions are separated by
    whitespace and/or a comma. All coordinates are **user
    space coordinates**.

    	transformNc                 B    | j                  dt        ||g      z         y)z
        Specifies a translation by **tx** and **ty**. If **ty** is not provided,
        it is assumed to be zero.

        :param number tx: user coordinate - no units allowed
        :param number ty: user coordinate - no units allowed
        ztranslate(%s)N_add_transformationr   )r   txtys      r   	translatezTransform.translateL   s      	  7RH3F!FGr   c                 B    | j                  dt        ||g      z         y)ac  
        Specifies a rotation by **angle** degrees about a given point.
        If optional parameter **center** are not supplied, the rotate is
        about the origin of the current user coordinate system.

        :param number angle: rotate-angle in degrees
        :param 2-tuple center: rotate-center as user coordinate - no units allowed

        z
rotate(%s)Nr8   )r   angler
   s      r   rotatezTransform.rotateV   s      	  %0J!JKr   c                 B    | j                  dt        ||g      z         y)a  
        Specifies a scale operation by **sx** and **sy**. If **sy** is not
        provided, it is assumed to be equal to **sx**.

        :param number sx: scalar factor x-axis, no units allowed
        :param number sy: scalar factor y-axis, no units allowed

        z	scale(%s)Nr8   )r   sxsys      r   r.   zTransform.scaleb   s      	  wBx/@!@Ar   c                 ,    | j                  d|z         y)z Specifies a skew transformation along the x-axis.

        :param number angle: skew-angle in degrees, no units allowed

        z	skewX(%s)Nr9   r   r>   s     r   skewXzTransform.skewXm        	  u!45r   c                 ,    | j                  d|z         y)z Specifies a skew transformation along the y-axis.

        :param number angle: skew-angle in degrees, no units allowed

        z	skewY(%s)NrD   rE   s     r   skewYzTransform.skewYu   rG   r   c                 J    | j                  dt        ||||||g      z         y )Nz
matrix(%s)r8   )r   abcdefs          r   matrixzTransform.matrix}   s'      !Q1a9K0M!MNr   c                     | j                   j                  | j                  d      }|d|j                         | | j                  <   y )N r'   )attribsgettransformnamestrip)r   new_transformold_transforms      r   r9   zTransform._add_transformation   s<    ((););R@/<m$L#S#S#UT r   )N)r0   r1   r2   r3   rV   r<   r?   r.   rF   rI   rQ   r9   r"   r   r   r5   r5   B   s6      MH
L	B66OVr   r5   c                   $    e Zd ZdZd ZddZd Zy)XLinkz XLink mixin c                 2    || _         | j                          y)a
  
        Create a reference to **element**.

        :param element: if element is a `string` its the **id** name of the
          referenced element, if element is a **BaseElement** class the **id**
          SVG Attribute is used to create the reference.

        N)href	update_id)r   elements     r   set_hrefzXLink.set_href   s     	r   Nc                 >    ||| d<   ||| d<   ||| d<   ||| d<   yy)zA Set XLink attributes (for `href` use :meth:`set_href`).
        Nz
xlink:rolezxlink:arcrolezxlink:titlez
xlink:showr"   )r   titleshowrolearcroles        r   	set_xlinkzXLink.set_xlink   sI     !%D$+D!"'D!%D r   c                     t        | d      sy t        | j                        r| j                  }n| j                  j                         }|| j                  d<   y )Nr]   z
xlink:href)hasattrr   r]   get_irirT   )r   idstrs     r   r^   zXLink.update_id   sD    tV$TYYIIEII%%'E%*\"r   )NNNN)r0   r1   r2   r3   r`   rf   r^   r"   r   r   r[   r[      s    

&+r   r[   c                   ,    e Zd ZdZddZ	 	 ddZddZy)	Presentationz8
    Helper methods to set presentation attributes.
    Nc                 n    |$t        |      r|| d<   n|j                         | d<   ||| d<   ||| d<   | S )zS
        Set SVG Properties **fill**, **fill-rule** and **fill-opacity**.

        fillz	fill-rulezfill-opacityr   get_paint_server)r   colorruleopacitys       r   rn   zPresentation.fill   sR    
 $V$557V $D#*D r   c                     |$t        |      r|| d<   n|j                         | d<   ||| d<   ||| d<   ||| d<   ||| d<   ||| d<   | S )z
        Set SVG Properties **stroke**, **stroke-width**, **stroke-opacity**,
        **stroke-linecap** and **stroke-miterlimit**.

        strokezstroke-widthzstroke-opacityzstroke-linecapzstroke-linejoinzstroke-miterlimitro   )r   rq   r   rs   linecaplinejoin
miterlimits          r   ru   zPresentation.stroke   s     !&X!&!7!7!9X#(D %,D!"%,D!"&.D"#!(2D$%r   c                 6    |t        |d      | d<   ||| d<   | S )at  
        Set SVG Properties **stroke-dashoffset** and **stroke-dasharray**.

        Where *dasharray* specify the lengths of alternating dashes and gaps as
        <list> of <int> or <float> values or a <string> of comma and/or white
        space separated <lengths> or <percentages>. (e.g. as <list> dasharray=[1, 0.5]
        or as <string> dasharray='1 0.5')
        r'   zstroke-dasharrayzstroke-dashoffsetr   )r   	dasharrayoffsets      r   rz   zPresentation.dasharray   s2      '.y#'>D#$(.D$%r   )NNN)NNNNNNNN)r0   r1   r2   r3   rn   ru   rz   r"   r   r   rl   rl      s       DH)-2r   rl   c                       e Zd ZdZddZy)
MediaGroupz8
    Helper methods to set media group attributes.

    Nc                 "    ||| d<   ||| d<   | S )zV
        Set SVG Properties **viewport-fill** and **viewport-fill-opacity**.

        zviewport-fillzviewport-fill-opacityr"   )r   rq   rs   s      r   viewport_fillzMediaGroup.viewport_fill   s*    
 $)D!,3D()r   r|   )r0   r1   r2   r3   r   r"   r   r   r~   r~      s    
	r   r~   c                       e Zd ZdZd Zy)Markersz3
    Helper methods to set marker attributes.

    c                     d }t        |      r ||      | d<   y	 |\  }}}|r ||      | d<   |r ||      | d<   |r ||      | d<   yy# t        t        f$ r  ||      | d<   Y yw xY w)a  
        Set markers for line elements (line, polygon, polyline, path) to
        values specified by  `markers`.

        * if `markers` is a 3-tuple:

          * attribute 'marker-start' = markers[0]
          * attribute 'marker-mid' = markers[1]
          * attribute 'marker-end' = markers[2]

        * `markers` is a `string` or a `Marker` class:

          * attribute 'marker' = `FuncIRI` of markers

        c                 2    t        |       rd| z  S d| d   z  S )Nzurl(%s)zurl(#%s)idr   )values    r   get_funciriz(Markers.set_markers.<locals>.get_funciri  s&     5(( "E$K//r   markerzmarker-startz
marker-midz
marker-endN)r   	TypeErrorKeyError)r   markersr   start_marker
mid_marker
end_markers         r   set_markerszMarkers.set_markers   s     	0 W(1DN	67>4j*+6|+DD()4Z)@D&)4Z)@D& x( 6!,W!5X6s   -A A('A(N)r0   r1   r2   r3   r   r"   r   r   r   r      s    $6r   r   c                       e Zd ZddZy)Clippingc           	      (    d|d|d|d|d	| d<   y)z-
        Set SVG Property **clip**.

        zrect(,)clipNr"   )r   r   r   r   r   s        r   	clip_rectzClipping.clip_rect%  s    
 /25&$GVr   N)autor   r   r   )r0   r1   r2   r   r"   r   r   r   r   $  s    Hr   r   N)svgwrite.utilsr   r   r*   r+   objectr   r5   r[   rl   r~   r   r   r"   r   r   <module>r      s    # $FV	<6F	;1Uf 1Uf@V @VF!+F !+H:6 :z $)6f )6XHv Hr   