ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/svgwrite/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/svgwrite/__pycache__/gradients.cpython-311.pyc

�

�܋f^���dZddlmZddlmZmZddlmZGd�de��ZGd�deee��Z	Gd	�d
e	��Z
Gd�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_stringc�$��eZdZdZd�fd�	Z�xZS)�
_GradientStop�stopNc�v��tt|��jdi|��|�||d<|�||d<|�||d<dSdS)N�offsetz
stop-colorzstop-opacity�)�superr�__init__)�selfr�color�opacity�extra�	__class__s     ��I/opt/cloudlinux/venv/lib64/python3.11/site-packages/svgwrite/gradients.pyrz_GradientStop.__init__sc���+��m�T�"�"�+�4�4�e�4�4�4���#�D��N���!&�D�����#*�D�� � � ����NNN)�__name__�
__module__�__qualname__�elementnamer�
__classcell__�rs@rrrsB��������K�+�+�+�+�+�+�+�+�+�+rrc�F��eZdZdZd
�fd�	Zdd�Zdd�Zd
d�Z�fd	�Z�xZ	S)�_AbstractGradient�gradientTransformNc����tt|��jdi|��|�Ot|��r|�|��dS|�|�����dSdS)Nr)r
rrr�set_href�get_iri)r�inheritrrs   �rrz_AbstractGradient.__init__%s���/����&�&�/�8�8�%�8�8�8�����!�!�
1��
�
�g�&�&�&�&�&��
�
�g�o�o�/�/�0�0�0�0�0�	�r�nonec�4�|����d|��S)z( Returns the <FuncIRI> of the gradient. � )�get_funciri)r�defaults  r�get_paint_serverz"_AbstractGradient.get_paint_server-s!���*�*�,�,�,�,�g�g�6�6rc�R�|�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)rrrrs    r�add_stop_colorz _AbstractGradient.add_stop_color1s,��	
����v�u�g�t�D�D�D�E�E�E��r�gg�?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)r�colors�sweepr�deltarrs       r�
add_colorsz_AbstractGradient.add_colors?so���q��E�!�H�$��V���q��9���q����	�	�E�����f�a� 0� 0�%��A�A�A��e�O�F�F��rc���t|d��r|���tt|�����S)N�href)�hasattr�	update_idr
r�get_xml)rrs �rr<z_AbstractGradient.get_xmlOsB����4�� � �	��N�N�����&��-�-�5�5�7�7�7r)N)r$r)r.N)
rrr�
transformnamerr)r-r7r<rrs@rrr"s��������'�M�1�1�1�1�1�1�7�7�7�7��������� 8�8�8�8�8�8�8�8�8rrc�(��eZdZdZdZd�fd�	Z�xZS)�LinearGradientzE Linear gradients are defined by a SVG <linearGradient> 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#Nr�x1r0�y1�x2�y2r)r
r?r)r�start�endr#rrs     �rrzLinearGradient.__init__Zsw���	-��n�d�#�#�,�F�F�W�F��F�F�F����q��D��J��q��D��J��?��Q��D��J��Q��D��J�J�J��?rr�rrr�__doc__rrrrs@rr?r?UsL���������"�K�
 �
 �
 �
 �
 �
 �
 �
 �
 �
 rr?c�(��eZdZdZdZd�fd�	Z�xZS)�RadialGradientzE Radial gradients are defined by a SVG <radialGradient> 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#Nr�cxr0�cy�r�fx�fyr)r
rKr)r�centerrP�focalr#rrs      �rrzRadialGradient.__init__os����	-��n�d�#�#�,�F�F�W�F��F�F�F������D��J����D��J��=��D��I����q��D��J��q��D��J�J�J��r)NNNNrHrs@rrKrKjsL���������"�K�"�"�"�"�"�"�"�"�"�"rrKN)rI�
svgwrite.baser�svgwrite.mixinsrr�svgwrite.utilsrrrr?rKrrr�<module>rXs����&�%�%�%�%�%�,�,�,�,�,�,�,�,�$�$�$�$�$�$�+�+�+�+�+�K�+�+�+�08�08�08�08�08��Y��08�08�08�f � � � � �&� � � �*"�"�"�"�"�&�"�"�"�"�"r

Zerion Mini Shell 1.0