Ë
    ‹`g^  ã                   óŒ   — d Z ddlmZ ddlmZmZ ddlmZ  G d„ de«      Z G d„ deee«      Z	 G d	„ d
e	«      Z
 G d„ de	«      Zy)a	  
Gradients consist of continuously smooth color transitions along a vector
from one color to another, possibly followed by additional transitions along
the same vector to other colors. SVG provides for two types of gradients:
linear gradients and radial gradients.
é    )ÚBaseElement)Ú	TransformÚXLink)Ú	is_stringc                   ó$   ‡ — e Zd ZdZdˆ fd„	Zˆ xZS )Ú_GradientStopÚstopc                 óX   •— t        t        | �
  di |¤Ž |�|| d<   |�|| d<   |�|| d<   y y )NÚoffsetz
stop-colorzstop-opacity© )Úsuperr   Ú__init__)Úselfr   ÚcolorÚopacityÚextraÚ	__class__s        €úc/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/svgwrite/gradients.pyr   z_GradientStop.__init__   sI   ø€ ÜŒm˜TÑ+Ñ4¨eÒ4àÐØ#ˆD�‰NØÐØ!&ˆD�ÑØÐØ#*ˆD�Ò ð ó    ©NNN)Ú__name__Ú
__module__Ú__qualname__Úelementnamer   Ú__classcell__©r   s   @r   r   r      s   ø„ Ø€K÷+ñ +r   r   c                   óF   ‡ — e Zd ZdZdˆ fd„	Zdd„Zd	d„Zd
d„Zˆ fd„Zˆ xZ	S )Ú_AbstractGradientÚgradientTransformc                 óª   •— t        t        | �
  di |¤Ž |�=t        |«      r| j	                  |«       y | j	                  |j                  «       «       y y )Nr   )r   r   r   r   Úset_hrefÚget_iri)r   Úinheritr   r   s      €r   r   z_AbstractGradient.__init__%   sH   ø€ ÜÔ Ñ/Ñ8°%Ò8ØÐÜ˜Ô!Ø—‘˜gÕ&à—‘˜gŸo™oÓ/Õ0ð	 r   c                 ó,   — | j                  «       ›d|›�S )z( Returns the <FuncIRI> of the gradient. Ú )Úget_funciri)r   Údefaults     r   Úget_paint_serverz"_AbstractGradient.get_paint_server-   s   € à×*Ñ*Õ,©gÐ6Ð6r   c                 óB   — | j                  t        |||| ¬«      «       | S )a:   Adds a stop-color to the gradient.

        :param offset: is either a <number> (usually ranging from 0 to 1) or
          a `<percentage>` (usually ranging from 0% to 100%) which indicates where
          the gradient stop is placed. Represents a location along the gradient
          vector. For radial gradients, it represents a percentage distance from
          (fx,fy) to the edge of the outermost/largest circle.
        :param color: indicates what color to use at that gradient stop
        :param opacity: defines the opacity of a given gradient stop
        )Úfactory)Úaddr   )r   r   r   r   s       r   Úadd_stop_colorz _AbstractGradient.add_stop_color1   s    € ð 	�‰”˜v u¨g¸tÔDÔEØˆr   c                 ó–   — |d   |d   z
  t        |«      dz
  z  }|d   }|D ]$  }| j                  t        |d«      ||«       ||z  }Œ& | S )zô Add stop-colors from colors with linear offset distributuion
        from sweep[0] to sweep[1].

        i.e. colors=['white', 'red', 'blue']
          'white': offset = 0.0
          'red': offset = 0.5
          'blue': offset = 1.0
        é   r   é   )Úlenr,   Úround)r   ÚcolorsÚsweepr   Údeltar   r   s          r   Ú
add_colorsz_AbstractGradient.add_colors?   s_   € ð �q‘˜E !™HÑ$¬¨V«°q©Ñ9ˆØ�q‘ˆÛˆEØ×Ñ¤ f¨aÓ 0°%¸ÔAØ�e‰O‰Fð ð ˆr   c                 ó`   •— t        | d«      r| j                  «        t        t        | �  «       S )NÚhref)ÚhasattrÚ	update_idr   r   Úget_xml)r   r   s    €r   r:   z_AbstractGradient.get_xmlO   s(   ø€ Ü�4˜Ô Ø�N‰NÔÜÔ&¨Ñ5Ó7Ð7r   )N)Únoner   ))g        g      ð?N)
r   r   r   Útransformnamer   r(   r,   r5   r:   r   r   s   @r   r   r   "   s&   ø„ Ø'€Mõ1ó7óó÷ 8ð 8r   r   c                   ó(   ‡ — e Zd ZdZdZdˆ fd„	Zˆ xZS )ÚLinearGradientzE Linear gradients are defined by a SVG <linearGradient> element.
    ÚlinearGradientc                 óz   •— t        t        | �
  d	d|i|¤Ž |�|d   | d<   |d   | d<   |�|d   | d<   |d   | d<   yy)
zô
        :param 2-tuple start: start point of the gradient (**x1**, **y1**)
        :param 2-tuple end: end point of the gradient (**x2**, **y2**)
        :param inherit: gradient inherits properties from `inherit` see: **xlink:href**

        r#   Nr   Úx1r.   Úy1Úx2Úy2r   )r   r>   r   )r   ÚstartÚendr#   r   r   s        €r   r   zLinearGradient.__init__Z   s`   ø€ ô 	Œn˜dÑ,ÑF°WÐFÀÒFØÐØ˜q™ˆD�‰JØ˜q™ˆD�‰JØˆ?Ø˜Q™ˆD�‰JØ˜Q™ˆD�ŠJð r   r   ©r   r   r   Ú__doc__r   r   r   r   s   @r   r>   r>   U   s   ø„ ñà"€K÷ ñ  r   r>   c                   ó(   ‡ — e Zd ZdZdZdˆ fd„	Zˆ xZS )ÚRadialGradientzE Radial gradients are defined by a SVG <radialGradient> element.
    ÚradialGradientc                 óˆ   •— t        t        | �
  d
d|i|¤Ž |�|d   | d<   |d   | d<   |�|| d<   |�|d   | d<   |d   | d	<   yy)a-  
        :param 2-tuple center: center point for the gradient (**cx**, **cy**)
        :param r: radius for the gradient
        :param 2-tuple focal: focal point for the radial gradient (**fx**, **fy**)
        :param inherit: gradient inherits properties from `inherit` see: **xlink:href**

        r#   Nr   Úcxr.   ÚcyÚrÚfxÚfyr   )r   rJ   r   )r   ÚcenterrO   Úfocalr#   r   r   s         €r   r   zRadialGradient.__init__o   so   ø€ ô 	Œn˜dÑ,ÑF°WÐFÀÒFØÐØ ™ˆD�‰JØ ™ˆD�‰JØˆ=ØˆD�‰IØÐØ˜q™ˆD�‰JØ˜q™ˆD�ŠJð r   )NNNNrG   r   s   @r   rJ   rJ   j   s   ø„ ñà"€K÷"ñ "r   rJ   N)rH   Úsvgwrite.baser   Úsvgwrite.mixinsr   r   Úsvgwrite.utilsr   r   r   r>   rJ   r   r   r   Ú<module>rW      sL   ðñõ &ß ,Ý $ô+�Kô +ô08˜ Y°ô 08ôf Ð&ô  ô*"Ð&õ "r   