
    p"h^                         S r SSKJr  SSKJrJr  SSKJr   " S S\5      r " S S\\\5      r	 " S	 S
\	5      r
 " S S\	5      rg)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                   0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )_GradientStop   stopc                 Z   > [         [        U ]
  " S0 UD6  Ub  XS'   Ub  X S'   Ub  X0S'   g g )Noffsetz
stop-colorzstop-opacity )superr   __init__)selfr   coloropacityextra	__class__s        D/var/www/html/env/lib/python3.13/site-packages/svgwrite/gradients.pyr   _GradientStop.__init__   sC    mT+4e4#N!&#*      r   NNN)__name__
__module____qualname____firstlineno__elementnamer   __static_attributes____classcell__r   s   @r   r   r      s    K+ +r   r   c                   Z   ^  \ rS rSrSrS	U 4S jjrS
S jrSS jrSS jrU 4S jr	Sr
U =r$ )_AbstractGradient"   gradientTransformc                    > [         [        U ]
  " S0 UD6  UbB  [        U5      (       a  U R	                  U5        g U R	                  UR                  5       5        g g )Nr   )r   r"   r   r   set_hrefget_iri)r   inheritr   r   s      r   r   _AbstractGradient.__init__%   sK    /8%8!!g&goo/0	 r   c                 0    U R                  5       < SU< 3$ )z'Returns the <FuncIRI> of the gradient.  )get_funciri)r   defaults     r   get_paint_server"_AbstractGradient.get_paint_server-   s    **,g66r   c           	      8    U R                  [        XX0S95        U $ )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_color _AbstractGradient.add_stop_color1   s     	vgDEr   c                     US   US   -
  [        U5      S-
  -  nUS   nU H#  nU R                  [        US5      Xc5        XT-  nM%     U $ )zAdd 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      )lenr3   round)r   colorssweepr   deltar   r   s          r   
add_colors_AbstractGradient.add_colors?   s[     qE!H$Vq9qEfa 0%AOF  r   c                 j   > [        U S5      (       a  U R                  5         [        [        U ]  5       $ )Nhref)hasattr	update_idr   r"   get_xml)r   r   s    r   rC   _AbstractGradient.get_xmlO   s+    4  NN&577r   r   )N)noner   ))g        g      ?N)r   r   r   r   transformnamer   r.   r3   r=   rC   r   r   r    s   @r   r"   r"   "   s&    'M17 8 8r   r"   c                   4   ^  \ rS rSrSrSrSU 4S jjrSrU =r$ )LinearGradientU   zDLinear gradients are defined by a SVG <linearGradient> element.
    linearGradientc                    > [         [        U ]
  " S	SU0UD6  Ub  US   U S'   US   U S'   Ub  US   U S'   US   U S'   gg)
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   x1r6   y1x2y2r   )r   rH   r   )r   startendr(   r   r   s        r   r   LinearGradient.__init__Z   s`     	nd,FWFFqDJqDJ?QDJQDJ r   r   r   	r   r   r   r   __doc__r   r   r   r   r    s   @r   rH   rH   U   s    "K   r   rH   c                   4   ^  \ rS rSrSrSrSU 4S jjrSrU =r$ )RadialGradientj   zDRadial gradients are defined by a SVG <radialGradient> element.
    radialGradientc                    > [         [        U ]
  " S
SU0UD6  Ub  US   U S'   US   U S'   Ub  X S'   Ub  US   U S'   US   U S	'   gg)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   cxr6   cyrfxfyr   )r   rV   r   )r   centerr\   focalr(   r   r   s         r   r   RadialGradient.__init__o   sm     	nd,FWFFDJDJ=IqDJqDJ r   r   )NNNNrS   r    s   @r   rV   rV   j   s    "K" "r   rV   N)rT   svgwrite.baser   svgwrite.mixinsr   r   svgwrite.utilsr   r   r"   rH   rV   r   r   r   <module>re      sL    & , $+K +08Y 08f &  *"& "r   