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__/mixins.cpython-311.pyc

�

�܋f�)���ddlmZddlmZdddd�Zddd	d
�ZGd�de��ZGd
�de��ZGd�de��ZGd�de��Z	Gd�de��Z
Gd�de��ZGd�de��ZdS)���strlist��	is_string�xMid�xMin�xMax)�center�left�right�YMid�YMin�YMax)�middle�top�bottomc�(�eZdZdZd
d�Zd�Zdd�Zd	S)�ViewBoxa� The **ViewBox** mixin provides the ability to specify that a
    given set of graphics stretch to fit a particular container element.

    The value of the **viewBox** attribute is a list of four numbers
    **min-x**, **min-y**, **width** and **height**, separated by whitespace
    and/or a comma, which specify a rectangle in **user space** which should
    be mapped to the bounds of the viewport established by the given element,
    taking into account attribute **preserveAspectRatio**.

    rc�2�t||||g��|d<dS)a~ Specify a rectangle in **user space** (no units allowed) which
        should be mapped to the bounds of the viewport established by the
        given element.

        :param number minx: left border of the viewBox
        :param number miny: top border of the viewBox
        :param number width: width of the viewBox
        :param number height: height of the viewBox

        �viewBoxNr)�self�minx�miny�width�heights     �F/opt/cloudlinux/venv/lib64/python3.11/site-packages/svgwrite/mixins.py�viewboxzViewBox.viewboxs"��"�D�$��v�#>�@�@��Y����c��d|d<dS)zh Stretch viewBox in x and y direction to fill viewport, does not
        preserve aspect ratio.
        �none�preserveAspectRatioN�)rs r�stretchzViewBox.stretch's��'-��
"�#�#�#rr
r�meetc��|jr|dvrtd|z���t|�t|�d|��|d<dS)a Set the **preserveAspectRatio** attribute.

        :param string horiz: horizontal alignment ``'left | center | right'``
        :param string vert: vertical alignment ``'top | middle | bottom'``
        :param string scale: scale method ``'meet | slice'``

        ============= =======================================================
        Scale methods Description
        ============= =======================================================
        ``'meet'``    preserve aspect ration and zoom to limits of viewBox
        ``'slice'``   preserve aspect ration and viewBox touch viewport on
                      all bounds, viewBox will extend beyond the bounds of
                      the viewport
        ============= =======================================================

        )r$�slicezInvalid scale parameter '%s'� r!N)�debug�
ValueError�_horiz�_vert)r�horiz�vert�scales    r�fitzViewBox.fit-sV��"�:�	E�%�'8�8�8��;�e�C�D�D�D�39�%�=�=��t����e�e�&T��
"�#�#�#rN)rrrr)r
rr$)�__name__�
__module__�__qualname__�__doc__rr#r/r"rrrrs_������	�	�A�A�A�A�-�-�-�U�U�U�U�U�Urrc�F�eZdZdZdZdd�Zdd�Zdd�Zd�Zd�Z	d	�Z
d
�ZdS)�	Transforma| The **Transform** mixin operates on the **transform** attribute.
    The value of the **transform** attribute is a `<transform-list>`, which
    is defined as a list of transform definitions, which are applied in the
    order provided. The individual transform definitions are separated by
    whitespace and/or a comma. All coordinates are **user
    space coordinates**.

    �	transformNc�T�|�dt||g��z��dS)z�
        Specifies a translation by **tx** and **ty**. If **ty** is not provided,
        it is assumed to be zero.

        :param number tx: user coordinate - no units allowed
        :param number ty: user coordinate - no units allowed
        z
translate(%s)N��_add_transformationr)r�tx�tys   r�	translatezTransform.translateLs/��	
� � ��7�R��H�3F�3F�!F�G�G�G�G�Grc�T�|�dt||g��z��dS)ac
        Specifies a rotation by **angle** degrees about a given point.
        If optional parameter **center** are not supplied, the rotate is
        about the origin of the current user coordinate system.

        :param number angle: rotate-angle in degrees
        :param 2-tuple center: rotate-center as user coordinate - no units allowed

        z
rotate(%s)Nr8)r�angler
s   r�rotatezTransform.rotateVs/��	
� � ���%���0J�0J�!J�K�K�K�K�Krc�T�|�dt||g��z��dS)a
        Specifies a scale operation by **sx** and **sy**. If **sy** is not
        provided, it is assumed to be equal to **sx**.

        :param number sx: scalar factor x-axis, no units allowed
        :param number sy: scalar factor y-axis, no units allowed

        z	scale(%s)Nr8)r�sx�sys   rr.zTransform.scalebs/��	
� � ��w��B�x�/@�/@�!@�A�A�A�A�Arc�6�|�d|z��dS)z� Specifies a skew transformation along the x-axis.

        :param number angle: skew-angle in degrees, no units allowed

        z	skewX(%s)N�r9�rr>s  r�skewXzTransform.skewXm�#��	
� � ��u�!4�5�5�5�5�5rc�6�|�d|z��dS)z� Specifies a skew transformation along the y-axis.

        :param number angle: skew-angle in degrees, no units allowed

        z	skewY(%s)NrDrEs  r�skewYzTransform.skewYurGrc�\�|�dt||||||g��z��dS)Nz
matrix(%s)r8)r�a�b�c�d�e�fs       r�matrixzTransform.matrix}s6��� � ���!�Q��1�a��9K�0M�0M�!M�N�N�N�N�Nrc��|j�|jd��}|�d|�����||j<dS)N�r')�attribs�get�
transformname�strip)r�
new_transform�
old_transforms   rr9zTransform._add_transformation�sF����(�(��);�R�@�@�
�/<�}�}�m�m�$L�#S�#S�#U�#U��T�
� � � r)N)r0r1r2r3rVr<r?r.rFrIrQr9r"rrr5r5Bs��������� �M�H�H�H�H�
L�
L�
L�
L�	B�	B�	B�	B�6�6�6�6�6�6�O�O�O�V�V�V�V�Vrr5c�&�eZdZdZd�Zdd�Zd�ZdS)�XLinkz
 XLink mixin c�<�||_|���dS)a

        Create a reference to **element**.

        :param element: if element is a `string` its the **id** name of the
          referenced element, if element is a **BaseElement** class the **id**
          SVG Attribute is used to create the reference.

        N)�href�	update_id)r�elements  r�set_hrefzXLink.set_href�s!����	��������rNc�B�|�||d<|�||d<|�||d<|�||d<dSdS)zA Set XLink attributes (for `href` use :meth:`set_href`).
        Nz
xlink:rolez
xlink:arcrolezxlink:titlez
xlink:showr")r�title�show�role�arcroles     r�	set_xlinkzXLink.set_xlink�sR����!%�D�����$+�D��!���"'�D�����!%�D������rc��t|d��sdSt|j��r|j}n|j���}||jd<dS)Nr]z
xlink:href)�hasattrrr]�get_irirT)r�idstrs  rr^zXLink.update_id�sY���t�V�$�$�	��F��T�Y���	(��I�E�E��I�%�%�'�'�E�%*���\�"�"�"r)NNNN)r0r1r2r3r`rfr^r"rrr[r[�sL��������
�
�
�
&�
&�
&�
&�+�+�+�+�+rr[c�.�eZdZdZdd�Z		dd�Zdd�ZdS)	�Presentationz8
    Helper methods to set presentation attributes.
    Nc�~�|�,t|��r||d<n|���|d<|�||d<|�||d<|S)zS
        Set SVG Properties **fill**, **fill-rule** and **fill-opacity**.

        N�fillz	fill-rulezfill-opacity�r�get_paint_server)r�color�rule�opacitys    rrnzPresentation.fill�s_��
������
8�$��V���$�5�5�7�7��V���� $�D�����#*�D�� ��rc��|�,t|��r||d<n|���|d<|�||d<|�||d<|�||d<|�||d<|�||d<|S)z�
        Set SVG Properties **stroke**, **stroke-width**, **stroke-opacity**,
        **stroke-linecap** and **stroke-miterlimit**.

        N�strokezstroke-widthzstroke-opacityzstroke-linecapzstroke-linejoinzstroke-miterlimitro)rrqrrs�linecap�linejoin�
miterlimits       rruzPresentation.stroke�s���������
:�!&��X���!&�!7�!7�!9�!9��X����#(�D�� ���%,�D�!�"���%,�D�!�"���&.�D�"�#��!�(2�D�$�%��rc�>�|�t|d��|d<|�||d<|S)at
        Set SVG Properties **stroke-dashoffset** and **stroke-dasharray**.

        Where *dasharray* specify the lengths of alternating dashes and gaps as
        <list> of <int> or <float> values or a <string> of comma and/or white
        space separated <lengths> or <percentages>. (e.g. as <list> dasharray=[1, 0.5]
        or as <string> dasharray='1 0.5')
        Nr'zstroke-dasharrayzstroke-dashoffsetr)r�	dasharray�offsets   rrzzPresentation.dasharray�s5��� �'.�y�#�'>�'>�D�#�$���(.�D�$�%��r)NNN)NNNNNN�NN)r0r1r2r3rnrurzr"rrrlrl�sd������������ DH�)-�����2
�
�
�
�
�
rrlc��eZdZdZdd�ZdS)�
MediaGroupz8
    Helper methods to set media group attributes.

    Nc�"�|�||d<|�||d<|S)zV
        Set SVG Properties **viewport-fill** and **viewport-fill-opacity**.

        Nz
viewport-fillzviewport-fill-opacityr")rrqrss   r�
viewport_fillzMediaGroup.viewport_fill�s*��
��$)�D��!���,3�D�(�)��rr|)r0r1r2r3r�r"rrr~r~�s2��������
	�	�	�	�	�	rr~c��eZdZdZd�ZdS)�Markersz3
    Helper methods to set marker attributes.

    c��d�}t|��r||��|d<dS	|\}}}|r||��|d<|r||��|d<|r||��|d<dSdS#ttf$r||��|d<YdSwxYw)a�
        Set markers for line elements (line, polygon, polyline, path) to
        values specified by  `markers`.

        * if `markers` is a 3-tuple:

          * attribute 'marker-start' = markers[0]
          * attribute 'marker-mid' = markers[1]
          * attribute 'marker-end' = markers[2]

        * `markers` is a `string` or a `Marker` class:

          * attribute 'marker' = `FuncIRI` of markers

        c�@�t|��rd|zSd|dzS)Nzurl(%s)zurl(#%s)�idr)�values r�get_funciriz(Markers.set_markers.<locals>.get_funciri
s.������
0� �5�(�(�"�E�$�K�/�/r�markerzmarker-startz
marker-midz
marker-endN)r�	TypeError�KeyError)r�markersr��start_marker�
mid_marker�
end_markers      r�set_markerszMarkers.set_markers�s��� 	0�	0�	0��W���	6�(�[��1�1�D��N�N�N�	
6�7>�4��j�*��E�+6�;�|�+D�+D�D��(��A�)4��Z�)@�)@�D��&��A�)4��Z�)@�)@�D��&�&�&�A�A���x�(�
6�
6�
6�!,��W�!5�!5��X�����
6���s�6A�B�BN)r0r1r2r3r�r"rrr�r��s-��������$6�$6�$6�$6�$6rr�c��eZdZdd�ZdS)�Clipping�autoc	�*�d|�d|�d|�d|�d�	|d<dS)z-
        Set SVG Property **clip**.

        zrect(�,�)�clipNr")rrrrrs     r�	clip_rectzClipping.clip_rect%s,���
/2�c�c�5�5�5�&�&�&�$�$�$�G��V���rN)r�r�r�r�)r0r1r2r�r"rrr�r�$s.������H�H�H�H�H�Hrr�N)
�svgwrite.utilsrrr*r+�objectrr5r[rlr~r�r�r"rr�<module>r�s���#�"�"�"�"�"�$�$�$�$�$�$��F�V�	<�	<���6�F�	;�	;��1U�1U�1U�1U�1U�f�1U�1U�1U�f@V�@V�@V�@V�@V��@V�@V�@V�F!+�!+�!+�!+�!+�F�!+�!+�!+�H:�:�:�:�:�6�:�:�:�z���������$)6�)6�)6�)6�)6�f�)6�)6�)6�XH�H�H�H�H�v�H�H�H�H�Hr

Zerion Mini Shell 1.0