
    p"h)                         S SK Jr  S SK Jr  SSSS.rSSS	S
.r " S S\5      r " S S\5      r " S S\5      r " S S\5      r	 " S S\5      r
 " S S\5      r " S S\5      rg)    strlist	is_stringxMidxMinxMax)centerleftrightYMidYMinYMax)middletopbottomc                   2    \ rS rSrSrSS jrS rS	S jrSrg)
ViewBox   a  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                 $    [        XX4/5      U S'   g)aE  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        A/var/www/html/env/lib/python3.13/site-packages/svgwrite/mixins.pyviewboxViewBox.viewbox   s     "D#>@Y    c                     SU S'   g)zWStretch viewBox in x and y direction to fill viewport, does not
preserve aspect ratio.
nonepreserveAspectRatioN )r   s    r   stretchViewBox.stretch'   s     '-"#r    c                     U R                   (       a  US;  a  [        SU-  5      e[        U   < [        U   < SU< 3U S'   g)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   fitViewBox.fit-   s>    " ::%'88;eCDD39%=te&T"#r    r$   N)r   r   r   r   )r
   r   r(   )	__name__
__module____qualname____firstlineno____doc__r   r%   r2   __static_attributes__r$   r    r   r   r      s    	A-Ur    r   c                   R    \ rS rSrSrSrSS jrSS jrSS jrS r	S	 r
S
 rS rSrg)	TransformB   ac  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                 @    U R                  S[        X/5      -  5        g)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   	translateTransform.translateL   s     	  7RH3F!FGr    c                 @    U R                  S[        X/5      -  5        g)a3  
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)Nr?   )r   angler
   s      r   rotateTransform.rotateV   s     	  %0J!JKr    c                 @    U R                  S[        X/5      -  5        g)z
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)Nr?   )r   sxsys      r   r1   Transform.scaleb   s     	  wx/@!@Ar    c                 ,    U R                  SU-  5        g)zqSpecifies a skew transformation along the x-axis.

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

z	skewX(%s)Nr@   r   rF   s     r   skewXTransform.skewXm        	  u!45r    c                 ,    U R                  SU-  5        g)zqSpecifies a skew transformation along the y-axis.

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

z	skewY(%s)NrN   rO   s     r   skewYTransform.skewYu   rR   r    c                 D    U R                  S[        XX4XV/5      -  5        g )Nz
matrix(%s)r?   )r   abcdefs          r   matrixTransform.matrix}   s!      !a9K0M!MNr    c                     U R                   R                  U R                  S5      nU< SU< 3R                  5       X R                  '   g )N r*   )attribsgettransformnamestrip)r   new_transformold_transforms      r   r@   Transform._add_transformation   s:    ((););R@/<m$L#S#S#U r    r$   )N)r4   r5   r6   r7   r8   rc   rC   rG   r1   rP   rT   r]   r@   r9   r$   r    r   r;   r;   B   s6      MH
L	B66OVr    r;   c                   .    \ rS rSrSrS rSS jrS rSrg)	XLink   zXLink mixin c                 0    Xl         U R                  5         g)z
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_hrefXLink.set_href   s     	r    Nc                 >    Ub  X0S'   Ub  X@S'   Ub  XS'   Ub  X S'   gg)z@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_xlinkXLink.set_xlink   sA     !%$+!"'!% r    c                     [        U S5      (       d  g [        U R                  5      (       a  U R                  nOU R                  R                  5       nXR                  S'   g )Nrl   z
xlink:href)hasattrr   rl   get_irira   )r   idstrs     r   rm   XLink.update_id   sH    tV$$TYYIIEII%%'E%*\"r    )rl   )NNNN)	r4   r5   r6   r7   r8   ro   rv   rm   r9   r$   r    r   ri   ri      s    

&+r    ri   c                   :    \ rS rSrSrSS jr  S	S jrS
S jrSrg)Presentation   z0
Helper methods to set presentation attributes.
Nc                 x    Ub(  [        U5      (       a  XS'   OUR                  5       U S'   Ub  X S'   Ub  X0S'   U $ )zC
Set SVG Properties **fill**, **fill-rule** and **fill-opacity**.

fillz	fill-rulezfill-opacityr   get_paint_server)r   colorruleopacitys       r   r   Presentation.fill   sO    
 $V$557V $#* r    c                     Ub(  [        U5      (       a  XS'   OUR                  5       U S'   Ub  X S'   Ub  X0S'   Ub  X@S'   Ub  XPS'   Ub  X`S'   U $ )zu
Set SVG Properties **stroke**, **stroke-width**, **stroke-opacity**,
**stroke-linecap** and **stroke-miterlimit**.

strokezstroke-widthzstroke-opacityzstroke-linecapzstroke-linejoinzstroke-miterlimitr   )r   r   r   r   linecaplinejoin
miterlimits          r   r   Presentation.stroke   s}     !&X!&!7!7!9X#( %,!"%,!"&."#!(2$%r    c                 8    Ub  [        US5      U S'   Ub  X S'   U $ )aD  
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   r   Presentation.dasharray   s0      '.y#'>D#$(.$%r    r$   )NNN)NNNNNNNN)	r4   r5   r6   r7   r8   r   r   r   r9   r$   r    r   r~   r~      s       DH)-2r    r~   c                   "    \ rS rSrSrSS jrSrg)
MediaGroup   z0
Helper methods to set media group attributes.

Nc                 "    Ub  XS'   Ub  X S'   U $ )zF
Set SVG Properties **viewport-fill** and **viewport-fill-opacity**.

zviewport-fillzviewport-fill-opacityr$   )r   r   r   s      r   viewport_fillMediaGroup.viewport_fill   s&    
 $)!,3()r    r$   r   )r4   r5   r6   r7   r8   r   r9   r$   r    r   r   r      s    
	r    r   c                       \ rS rSrSrS rSrg)Markers   z+
Helper methods to set marker attributes.

c                     S n[        U5      (       a  U" U5      U S'   g Uu  p4nU(       a  U" U5      U S'   U(       a  U" U5      U S'   U(       a  U" U5      U S'   gg! [        [        4 a    U" U5      U S'    gf = f)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                 <    [        U 5      (       a  SU -  $ SU S   -  $ )Nzurl(%s)zurl(#%s)idr   )values    r   get_funciri(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_markersMarkers.set_markers   s     	0 W(1DN	67>4*+6|+DD()4Z)@D&)4Z)@D& x( 6!,W!5X6s   ;A A<;A<r$   N)r4   r5   r6   r7   r8   r   r9   r$   r    r   r   r      s    $6r    r   c                       \ rS rSrSS jrSrg)Clippingi$  c           	      0    SU< SU< SU< SU< S3	U S'   g)z
Set SVG Property **clip**.

zrect(,)clipNr$   )r   r   r   r   r   s        r   	clip_rectClipping.clip_rect%  s    
 /25&$GVr    r$   N)autor   r   r   )r4   r5   r6   r7   r   r9   r$   r    r   r   r   $  s    Hr    r   N)svgwrite.utilsr   r   r-   r.   objectr   r;   ri   r~   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    