bg^dZddlmZddlmZmZddlmZGddeZGddeeeZ Gd d e Z Gd d e Z d S)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) TransformXLink) is_stringc$eZdZdZdfd ZxZS) _GradientStopstopNc vtt|jdi||||d<|||d<|||d<dSdS)Noffsetz stop-colorz stop-opacity)superr__init__)selfr coloropacityextra __class__s c/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/svgwrite/gradients.pyrz_GradientStop.__init__sc+mT""+44e444  #DN  !&D   #*D   NNN)__name__ __module__ __qualname__ elementnamer __classcell__rs@rrrsBK++++++++++rrcFeZdZdZd fd Zd dZd dZd dZfd ZxZ S)_AbstractGradientgradientTransformNc tt|jdi||Ot|r||dS||dSdS)Nr )r rrrset_hrefget_iri)rinheritrrs rrz_AbstractGradient.__init__%s/&&/88%888  !! 1 g&&&&& goo//00000  rnonec4|d|S)z( Returns the of the gradient.  ) get_funciri)rdefaults rget_paint_serverz"_AbstractGradient.get_paint_server-s!**,,,,gg66rcR|t|||||S)a: Adds a stop-color to the gradient. :param offset: is either a (usually ranging from 0 to 1) or a `` (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)rr rrs radd_stop_colorz _AbstractGradient.add_stop_color1s, vugtDDDEEE rgg?c|d|dz t|dz z }|d}|D],}|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)rcolorssweeprdeltar rs r add_colorsz_AbstractGradient.add_colors?soqE!H$Vq9q  E   fa 0 0% A A A eOFF rct|dr|tt|S)Nhref)hasattr update_idr rget_xml)rrs rr<z_AbstractGradient.get_xmlOsB 4   NN   &--55777r)N)r$r)r.N) rrr transformnamerr)r-r7r<rrs@rrr"s'M1111117777     888888888rrc(eZdZdZdZdfd ZxZS)LinearGradientzE Linear gradients are defined by a SVG element. linearGradientNc tt|jd d|i|||d|d<|d|d<||d|d<|d|d<dSdS) 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#Nrx1r0y1x2y2r )r r?r)rstartendr#rrs rrzLinearGradient.__init__Zsw -nd##,FFWFFFF  qDJqDJ ?QDJQDJJJ ?rrrrr__doc__rrrrs@rr?r?UsL"K           rr?c(eZdZdZdZdfd ZxZS)RadialGradientzE Radial gradients are defined by a SVG element. radialGradientNc tt|jd d|i|||d|d<|d|d<|||d<||d|d<|d|d <dSdS) 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#Nrcxr0cyrfxfyr )r rKr)rcenterrPfocalr#rrs rrzRadialGradient.__init__os -nd##,FFWFFFF  DJDJ =DI  qDJqDJJJ  r)NNNNrHrs@rrKrKjsL"K""""""""""rrKN) rI svgwrite.basersvgwrite.mixinsrrsvgwrite.utilsrrrr?rKr rrrXs&%%%%%,,,,,,,,$$$$$$ + + + + +K + + +0808080808 Y080808f     &   *"""""&"""""r