ok

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/svgwrite/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/svgwrite/__pycache__/gradients.cpython-37.pyc

B

s�]��@stdZddlmZddlmZmZddlmZGdd�de�ZGdd�deee�Z	Gd	d
�d
e	�Z
Gdd�de	�Zd
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)�	Transform�XLink)�	is_stringcs"eZdZdZd�fdd�	Z�ZS)�
_GradientStop�stopNcsFtt|�jf|�|dk	r"||d<|dk	r2||d<|dk	rB||d<dS)N�offsetz
stop-colorzstop-opacity)�superr�__init__)�selfr�color�opacity�extra)�	__class__��
/gradients.pyr
sz_GradientStop.__init__)NNN)�__name__�
__module__�__qualname__�elementnamer
�
__classcell__rr)rrrsrcsLeZdZdZd�fdd�	Zddd�Zddd	�Zddd�Z�fd
d�Z�Z	S)�_AbstractGradientZgradientTransformNcs@tt|�jf|�|dk	r<t|�r.|�|�n|�|���dS)N)r	rr
rZset_hrefZget_iri)r�inheritr)rrrr
$s
z_AbstractGradient.__init__�nonecCsd|��|fS)z( Returns the <FuncIRI> of the gradient. z%s %s)Zget_funciri)r�defaultrrr�get_paint_server,sz"_AbstractGradient.get_paint_servercCs|�t||||d��|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)rrrr
rrr�add_stop_color0sz _AbstractGradient.add_stop_color�gg�?c	Csbt|d�}t|d�}||tt|�d�}|}x(|D] }|�t|d�||�||7}q:W|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��)�float�lenr�round)	rZcolorsZsweepr
�start�endZdeltarrrrr�
add_colors>s	
z_AbstractGradient.add_colorscs t|d�r|��tt|���S)NZhref)�hasattrZ	update_idr	r�get_xml)r)rrrr)Ps
z_AbstractGradient.get_xml)N)r)NNN)rN)
rrrZ
transformnamer
rrr'r)rrr)rrr!s


rcs&eZdZdZdZd�fdd�	Z�ZS)�LinearGradientzE Linear gradients are defined by a SVG <linearGradient> element.
    ZlinearGradientNcs^tt|�jfd|i|��|dk	r:|d|d<|d|d<|dk	rZ|d|d<|d|d<dS)	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**

        rNrZx1r Zy1Zx2Zy2)r	r*r
)rr%r&rr)rrrr
[szLinearGradient.__init__)NNN)rrr�__doc__rr
rrr)rrr*Vsr*cs&eZdZdZdZd�fdd�	Z�ZS)�RadialGradientzE Radial gradients are defined by a SVG <radialGradient> element.
    ZradialGradientNcsntt|�jfd|i|��|dk	r:|d|d<|d|d<|dk	rJ||d<|dk	rj|d|d<|d|d	<dS)
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**

        rNrZcxr Zcy�rZfxZfy)r	r,r
)r�centerr-Zfocalrr)rrrr
ps	zRadialGradient.__init__)NNNN)rrrr+rr
rrr)rrr,ksr,N)r+Z
svgwrite.baserZsvgwrite.mixinsrrZsvgwrite.utilsrrrr*r,rrrr�<module>s5

Zerion Mini Shell 1.0