%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/reportlab/graphics/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/reportlab/graphics/__pycache__/svgpath.cpython-312.pyc

�

׸�e�>����dZdZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZddlmZmZmZmZmZmZmZmZmZd�Zd�Zd	�Zd
�Zd�Zdd�Zdd
�Zd�Z Gd�dee�Z!y)z.this code is derived from that used by svglib.)�SvgPath�N)
�acos�ceil�copysign�cos�degrees�fabs�hypot�radians�sin�sqrt�)	�Group�mmult�rotate�	translate�transformPoint�Path�
FILL_EVEN_ODD�
_CLOSEPATH�UserNodec��tjd|�D�cgc]}|s�t|���}}g}tdt	|�|�D]-}|dkDr
|dvr	|dk(rdnd}|j|||||zg��/|Scc}w)a;Split `value`, a list of numbers as a string, to a list of float numbers.

    Also optionally insert a `l` or `L` operation depending on the operation
    and the length of values.
    Example: with op='m' and value='10,20 30,40,' the returned value will be
             ['m', [10.0, 20.0], 'l', [30.0, 40.0]]
    �(-?\d*\.?\d*(?:[eE][+-]?\d+)?)r>�M�mr�l�L)�re�findall�float�range�len�extend)�op�min_num�value�seq�floats�res�is       �</usr/lib/python3/dist-packages/reportlab/graphics/svgpath.py�split_floatsr,s���%'�J�J�/P�RW�$X�
`�S�\_�e�C�j�
`�F�
`�
�C�
�1�c�&�k�7�
+�0���q�5�R�:�%��c�	��s�B��
�
�B��q��W��-�.�/�0��J��
as
�A:�
A:c
��d}d}dj|||||||g�dz}g}tj||j��D]:}|j	||j�D�cgc]
}t
|���c}g��<|Scc}w)Nrz([1|0])z[\s,]*)�joinr�finditer�stripr#�groupsr )r$r&�float_re�flag_re�a_seq_rer)r'�nums        r+�split_arc_valuesr6s���0�H��G��~�~��(�H�g�w��(���	��H�
�C��{�{�8�U�[�[�]�3�?���
�
�B�s�z�z�|�<���s��<�=�>�?��J��=s�'Bc�b�idd�dd�dd�dd�dd�d	d�d
d�dd�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dddd��}|j�}g}tjd|j�tj��}d}|D]�}|j�dk(r�||vr9|dk(r||k(rd
}n|dk(r||k(rd}n|}||dk(s�@|j|gg��T|j
�dk(r|jt||��n|jt||||��|d}��|S)a�Normalise SVG path.

    This basically introduces operator codes for multi-argument
    parameters. Also, it fixes sequences of consecutive M or m
    operators to MLLL... and mlll... operators. It adds an empty
    list as argument for Z and z only in order to make the resul-
    ting list easier to iterate over.

    E.g. "M 10 20, M 20 20, L 30 40, 40 40, Z"
      -> ['M', [10, 20], 'L', [20, 20], 'L', [30, 40], 'L', [40, 40], 'Z', []]
    �A��a�Q��q�T��t�S�srrrr�Hr�V�h�v�C�r)�c�Z�zz([achlmqstvz]))�flagsN����)	�keysr�splitr0�Ir#�lowerr6r,)�attr�ops�op_keys�resultr1r$�items       r+�normalise_svg_pathrX#s�����Q���Q���Q���Q���Q�� #�Q��(+�Q��03�Q��	�Q���Q���Q��!$�Q��),�Q��14�Q��	�Q�	��Q�	��Q�	�&'�Q�Q�	�C��h�h�j�G��F�
�X�X�&��
�
��B�D�D�
A�F�	
�B�����:�:�<�2����7�?��s�{�t�r�z��������������2�w�!�|��
�
�r�2�h�'��x�x�z�S� ��
�
�.�r�4�8�9��
�
�l�2�s�2�w��=�>����B�'�*�M�c��|}|dd|d|dz
zz|dd|d|dz
zzf}|dd|d|dz
zz|dd|d|dz
zzf}|}||||fS)zM
    Convert a quadratic Bezier curve through q0, q1, q2 to a cubic one.
    rgUUUUUU�?rgUUUUUU�?�)�q0�q1�q2�c0�c1�c2�c3s       r+�convert_quadratic_to_cubic_pathrcTs���
�B�
�Q�%�%�2�a�5�2�a�5�=�)�
)�2�a�5�5�B�q�E�B�q�E�M�3J�+J�	K�B�
�Q�%�%�2�a�5�2�a�5�=�)�
)�2�a�5�5�B�q�E�B�q�E�M�3J�+J�	K�B�	�B�
�r�2�r�>�rYc���t|�t|�z}|dk(ry|d|dz|d|dzz|z}|dkrd}n|dkDrd}|d|dz|d|dzz
}ttt|�|��S)Nrr���)r
rrr)�urF�drIrBs     r+�vector_anglerhas���
�q�	�E�1�I��A��A�v��	
�1���!���q��t�a��d�{�	"�a�'�A��2�v���	
�Q��
��	�!��q��t��a��d�Q�q�T�k�!�A��8�D��G�Q�'�(�(rYc	�t�t|�}t|�}|rHt|�}	t|	�}
t|	�}d||z
z}d||z
z}
||z|
|
zz
}|
|z||
zz}nd||z
z}d||z
z}||z||zz||z||zzz}|dkDr5t	|�}||z}||z}||z||zz||z||zzz}d|zdz
}n
|dk7rd|zdz
}d|cxkrdkrnnd}t	|�}||k(r|}||z|z|z}||z|z|z}|r)|z
|zz
d||zzz}|
|z||zzd||zzz}n|d||zzz}|d||zzz}td||z
|z||z
|zf�}t||z
|z||z
|zf||z
|z||z
|zf�dz}|dk(r|dkDr|dz}n|dk(r
|dkr|dz
}||||||fS)z�
    See http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes F.6.5
    note that we reduce phi to zero outside this routine
    ��?rrg�����|۽)rrih)r	rrrr
rh)�x1�y1�x2�y2�fA�fS�rx�ry�phi�phi_rad�sin_phi�cos_phi�tx�ty�x1d�y1d�r�rr�cxd�cyd�cx�cy�theta1�dthetas                        r+�end_point_to_center_parametersr�ms���

�b��B�	
�b��B���#�,���g�,���g�,��
�B��G�_��
�B��G�_����l�W�r�\�)����l�W�r�\�)���R�"�W�o���R�"�W�o��,	�c�	�R�"�W���c�	�R�"�W� 5�5�A��1�u�
�!�W��
�b���
�b����#�I��b��!�C�#�I��b��$9�9��
��E�A�I��	
�a��
��E�A�I��
��~�A�~�
���Q��A�	�R�x�
�B���r�6�C�<�2�
�C�
��F�S�L�/�B�
�C��
�s�]�W�s�]�
*�S�B��G�_�
<��
�s�]�W�s�]�
*�S�B��G�_�
<��
�3�"�r�'�?�
"��
�3�"�r�'�?�
"���&�C�#�I��#3�c�C�i�2�5E�"F�
G�F�
�

��)�r�	�C�#�I��+�,��$��*��	�c�T�C�Z�2�-�.��	��F�
�Q�w�6�A�:��#�
��	�q��V�a�Z��#�
��
�r�2�r�F�7�V�G�+�+rYc
�d�t|�dkrd}|}ntt|�dz�}||z}|dk(rgSt|�}|dz}	tddt|	�z
zt	|	�z�}
|dkr|
}
g}t|�}||z}
t|�}t	|�}t|�D]�}|}|}|
||zz}t|�}t	|�}|j
|||zz|||zz
||||
|zz
zz||||
|zzzz
||||
|zzzz||||
|zz
zz
|||zz|||zz
f���|S)N�ZrrrjgUUUUUU�?)�absrrrrr!�append)rr�rqrr�	start_ang�extent�nfrag�
frag_angle�frag_rad�half_rad�kappa�
point_listr��	start_radr`�s1r*r_�s0s                   r+�bezier_arc_from_centrer��s���
�6�{�b�����
��S��[�2�%�&���e�^�
��Q���	��z�"�H��#�~�H����S��]�*�+�c�(�m�;�<�E��A�~�����J�
�Y�
�F���!�I�	�V��B�	�V��B�
�5�\�
)��
��
���Q��\�)��
��[��
��[�����2��R��<��r�B�w�,��r�R�%�"�*�_�5�5��r�R�%�"�*�_�5�5��r�R�%�"�*�_�5�5��r�R�%�"�*�_�5�5��r�B�w�,��r�B�w�,�(�	)�

)��rYc	
�"�||k(r||k(rgS|r�tt|�t||��}	t|	||f�\}
}t	dd|
|||||�\}}
}}}}t||
||||�}tt||�t|��}	g}|D]U\}}}}}}}}|j
t|	||f�t|	||f�zt|	||f�zt|	||f�z��W|St	||||||||�\}}
}}}}t||
||||�S)Nr)rrrrr�r�r�)rkrlrqrrrsrorprmrn�mx�tx2�ty2rr�r�r��bpr)�x3�y3�x4�y4s                      r+�bezier_arc_from_end_pointsr��s]��
�b��R�2�X��	�
��6�3�$�<��B�3���!4�
5��!�"�r�2�h�/���S�,J�
�q�#�s�B��B��-
�)��B��B�	�6�$�B��B��I�v�
F��
�9�R��$�f�S�k�
2����.0�	�*�B��B��B��B���J�J��r�B��8�,�~�b�2�r�(�/K�K��r�B��8�,�-�/=�b�2�r�(�/K�L�
�	�
�
�,J���B��B��B��-
�)��B��B�	�6�&�b�"�b�"�i��H�HrYc�0��eZdZdZddef�fd�	Zd�Z�xZS)rzPath, from an svg path stringrNc��
��|jdd�}|jdd�}t�)|�d%dd|||d�|��|syt|�}|j}	g}
g}d}d}
tdt
|�d�D�]"}|||dz\}}|dvr?|dkDr:|jdtk7r$|
jt
|j��|d	k(r|j|�|	d
d}�n�|dk(r|j|��n�|dk(rYt
|	�dk\r5|d
vr|}n|	d
d}|d|dz|d|dz}}|j||�n|j|�|	d
d}�n:|dk(r*|	d
|dz|	d|dz}}|j||��n|dk(r|j|d|	d��n�|dk(r|j|	d
|d��n�|dk(r |j|	d
|dz|	d��n�|dk(r |j|	d
|	d|dz��n�|dk(r|j|��nm|dk(rY|\}}}}t
|	�dks|dvr|	d
ddz\}}}}n
|	dd\}}}}|||z
z|||z
z}}|j||||||��n|dk(r;|	d
d\}}|\}}}}}}|j||z||z||z||z||z||z��n�|dk(re|\}}}}t
|	�dks|dvr|	d
ddz\}}}}n
|	dd\}}}}|||z
z|||z
z}}|j||||z||z||z||z��ne|dk(rO|	d
d\}}|\}}}}||f}
t||f||f||f�\\}}\}}\}}\}}|j||||||��n|dk(rm|
�|
\}}n|	d
d\}}|	d
d\}}|||z
z|||z
z}}||f}
|\}}t||f||f||f�\\}}\}}\}}\}}|j||||||��n�|dk(rf|	d
d\}}|\}}}}||z||z||z||zf\}}}}||f}
t||f||f||f�\\}}\}}\}}\}}|j||||||��n4|dk(rv|
�|
\}}n|	d
d\}}|	d
d\}}|\}}||z||z}}|||z
z|||z
z}}||f}
t||f||f||f�\\}}\}}\}}\}}|j||||||�n�|dvr�|\}}} }!}"}}|	d
d\}}|d k(r
||z
}||z
}t|�d!kst|�d!kr|j||�net||||| |!|"||�	}#|#D]!\}$}$}}}}}}|j||||||��#n+|d
vr|j!�nt"j%d"|�|d#vrd}
|}��%|jdtk7r$|
jt
|j��|s|rv|j'�}%|r1|%d|%dz}&tdt
|	�d�D]
}|&|	|z
|	|<�|r1|%d$|%dz}&tdt
|	�d�D]
}|&|	|z
|	|<�|
r�|j(��t+�}'|'j,j/t1j2|j,��t5|
�D]"}(|'jj7|(t��$|'|_d|_yd|_y)&N�vswapr�hswap)�points�	operators�
isClipPath�	autoclose�fillModerMr?)rrrerrNrr)rJrKrrrCrDrErFrGrAr<>rGrArIrB���rIrBr;r>r=r@)r8r:r:g�����|�=zSuspicious self operator: %s)r;r=r>r@�r[)�pop�super�__init__rXr�r!r"r�rr��moveTo�lineTo�curveTorcr�r��	closePath�logger�debug�	getBounds�	fillColorr�__dict__�update�copy�deepcopy�reversed�insert�_SvgPath__closed_path)*�selfrBr�r�r��kwr�r��normPathr��unclosed_subpath_pointers�
subpath_start�lastop�last_quadratic_cpr*r$�nums�starting_point�xn�ynrmrn�xp�yp�x0�y0�xi�yirkrlrqrrrsrorpr��_�br�closed_path�pointer�	__class__s*                                         �r+r�zSvgPath.__init__s�������w�q�!�����w�q�!��
���	1�#�d�#-�"+�!)�		1�.0�		1�
�&�%�a�(������$&�!��
��� ���q�#�h�-��+�H	�A���!�A�#��H�B���Z��A��E�d�n�n�R�.@�J�.N�)�0�0��T�^�^�1D�E��S�y�����T�"� &�r�s��
��s������T�"��s���v�;�!�#���+�)6��)/�����+�A�.��a��8�.��:K�d�ST�g�:U��B��K�K��B�'��D�K�K��&� &�r�s��
��s�����d�1�g�-�v�b�z�D��G�/C�B�����B��#��s�����D��G�V�B�Z�0��s�����F�2�J��Q��0��s�����F�2�J��a��0�&��*�=��s�����F�2�J��r�
�T�!�W�(<�=��s������d�#��s��!%���B��B��v�;��?�f�4H�&H�%+�B�C�[�1�_�N�B��B��%+�B�C�[�N�B��B���r�B�w���r�B�w��B�����R��R��R��4��s��������B�)-�&��B��B��B����R�"�W�b�2�g�r�B�w��R���b��"�r�'�R��s��!%���B��B��v�;��?�f�4H�&H�%+�B�C�[�1�_�N�B��B��%+�B�C�[�N�B��B���r�B�w���r�B�w��B�����R��R�"�W�b�2�g�r�B�w��R��H��s��������B�!%���B��B�%'��H�!�3�R��H�r�2�h��R��Q�7���R�(�2�r�H�R��h�r�2����R��R��R��4��s��$�0�.�F�B��#�B�C�[�F�B��������B��r�B�w���r�B�w��B��%'��H�!����B�3�R��H�r�2�h��R��Q�7���R�(�2�r�H�R��h�r�2����R��R��R��4��s��������B�!%���B��B�!#�b��"�r�'�2��7�B��G�!C���B��B�%'��H�!�3�R��H�r�2�h��R��Q�7���R�(�2�r�H�R��h�r�2����R��R��R��4��s��$�0�.�F�B��#�B�C�[�F�B��������B����B��b��"�r�'�B���r�B�w���r�B�w��B��%'��H�!�3�R��H�r�2�h��R��Q�7���R�(�2�r�H�R��h�r�2����R��R��R��4��z�!�.2�+��B��R��R��������B���9��"�H�B��"�H�B��r�7�e�#�s�2�w�%�'7��K�K��B�'�3�B��B��C��R�QS�UW�X�B�8:�=�4��1�b�"�b�"�b�"����R��R��R��<�=��z�!���� ����;�R�@��-�-�$(�!��F�QH	�T�>�>�"���+�%�,�,�S����-@�A��E���� �A���a�D��1��I���q��V��Q�/�.�A� !�F�1�I�
�F�1�I�.���a�D��1��I���q��V��Q�/�.�A� !�F�1�I�
�F�1�I�.�%����)C��&�K�� � �'�'��
�
�d�m�m�(D�E�#�$=�>�
B���%�%�,�,�W�j�A�
B�!,�D��!�D�N�!%�D�rYc���t�}|jj�|_|`|jr8t	�}|j|j�|j|�|S|S)N)rr�r�r�r�add)r��p�gs   r+�provideNodezSvgPath.provideNode�sZ���F���]�]�'�'�)��
�
�#������A�
�E�E�$�$�$�%�
�E�E�!�H��H��HrY)�__name__�
__module__�__qualname__�__doc__rr�r��
__classcell__)r�s@r+rrs���'�%&�$��t&�l
rYr)r)rr�)"r��__all__rr��mathrrrrrr	r
rrr
�shapesrrrrrrrrrr,r6rXrcrhr�r�r�rr[rYr+�<module>r�s_��4����T�T�T�n�n�n�� 
�/�b�
)�L,�\%�NI�>B�d�8�BrY

Zerion Mini Shell 1.0