%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__/renderbase.cpython-312.pyc

�

��d2���dZdZddl�ddlmZddlmZddlmZm	Z	d�Z
Gd	�d
�Zd�Zd�Z
d
�ZGd�d�Zedk(red�ee�yy)z3.3.0zXSuperclass for renderers to factor out common functionality and default implementations.�)�*)�DerivedValue)�	rl_config�)�mmult�inversec�r�i}|j�j�D]\}}|tvs�|||<�|S)z�Used to compute when we need to change the graphics state.
    For example, if we have two adjacent red shapes we don't need
    to set the pen color to red in between. Returns the effect
    the given shape would have on the graphics state)�
getProperties�items�STATE_DEFAULTS)�shape�delta�prop�values    �?/usr/lib/python3/dist-packages/reportlab/graphics/renderbase.py�
getStateDeltarsF��

�E��*�*�,�2�2�4� ���e��>�!��E�$�K� ��L�c�B�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zy)�StateTrackera*Keeps a stack of transforms and state
    properties.  It can contain any properties you
    want, but the keys 'transform' and 'ctm' have
    special meanings.  The getCTM()
    method returns the current transformation
    matrix at any point, without needing to
    invert matrixes when you pop.Nc�@�g|_g|_|�tj�}|rQtj	�D]:}d|ddj�z|ddz}t
||�s�,t||�||<�<d|vr|d|d<|jj|�y)N�initialr�	transform�ctm)	�_deltas�	_combinedr�copy�keys�upper�hasattr�getattr�append)�self�defaults�
defaultObj�k�as     r�__init__zStateTracker.__init__!s������
�����%�*�*�,�H��#�(�(�*�
8���a���e�k�k�m�+�A�a�b�E�1���:�a�(�")�*�Q�"7�H�Q�K�
8�
�(�"�&�{�3�H�U�O������h�'rc��|S�N�)r"�ds  r�_applyDefaultObjzStateTracker._applyDefaultObj5s���rc�D�|jdj�}|j�D]:\}}|dk(r+|d|d<t|jdd|d�|d<�6|||<�<|jj	|�|j
j	|�y)z�Take a new state dictionary of changes and push it onto
        the stack.  After doing this, the combined state is accessible
        through getState()���rrN)rrrrr!r)r"r�newstate�keyrs     r�pushzStateTracker.push8s���
�>�>�"�%�*�*�,���+�+�-�	&�J�C���k�!�(-�k�(:���%�"'����r�(:�5�(A�5��CU�"V����
!&���
�	&�	
�����h�'������E�"rc��|jd=|jd}|jd}|jd=i}|j�D],\}}||}||k7s�|dk(rt|d�||<�(|||<�.|S)z�steps back one, and returns a state dictionary with the
        deltas to reverse out of wherever you are.  Depending
        on your back end, you may not need the return value,
        since you can get the complete state afterwards with getState()r.r)rrrr)r"�newState�	lastDelta�reverseDeltar0�curValue�	prevValues       r�popzStateTracker.popKs���

�N�N�2���>�>�"�%���L�L��$�	�
�\�\�"�
���&�_�_�.�	2�M�C�� ��
�I��H�$��+�%�(/�	�+�0F�(G�L��%�(1�L��%�	2��rc� �|jdS)z1returns the complete graphics state at this pointr.�r�r"s r�getStatezStateTracker.getStatebs���~�~�b�!�!rc�&�|jddS)z7returns the current transformation matrix at this pointr.rr:r;s r�getCTMzStateTracker.getCTMfs���~�~�b�!�%�(�(rc�&�|jd|S)z>returns the complete graphics state value of key at this pointr.r:)r"r0s  r�__getitem__zStateTracker.__getitem__js���~�~�b�!�#�&�&rc�(�||jd|<y)z6sets the complete graphics state value of key to valuer.Nr:)r"r0rs   r�__setitem__zStateTracker.__setitem__ns��"'����r��3�r)NN)�__name__�
__module__�__qualname__�__doc__r'r,r1r8r<r>r@rBr*rrrrs/��%�(�(�#�&�."�)�'�(rrc��td�dddgd�d�}ddlm}ddidd	|d
�dgd�idgd
�iddig}t|�}td|j	��t�|D]:}td|�|j|�td|j	�d��<|D]7}td|j
��td|j	�d��9y)NzTesting state tracker)rrrrrr)�	fillColor�strokeColor�fontNamerr)�_baseGFontNamerH�red�green�blue)rHrIrJr)��?rrrOrr)rOrrrO��rIzinitial:zpushing:zstate:  �
zpopping:)�print�reportlab.graphics.shapesrKrr<r1r8)r#rK�deltas�strs     r�testStateTrackerrWrs���	�
!�"� ���R_�`�H�8�	�U���F�n�M�	�&�'�	�&�'�	�u��
�F�
�h�	�B�	�*�b�k�k�m�$�	�G��-��
�j�%� �
�����
�j�����t�,�-�
�-��
�j�����"�
�j�����t�,�-rc��t|t�r1	t|d�rd}n	||_d}|}|j	�}|s|`|S|S#s`wwxYw�N�_canvasr)�
isinstance�UserNoderrZ�provideNode)�node�canvas�ocanvas�onodes    r�_expandUserNoderb�s\���$��!�		.��t�I�&���%������E��#�#�%�D���
��K�4�K����
�7�s�*A�Ac���|j}|dk7rf|}|j|j|z|j|z�}|jj�|_|j
||�d|_|S)Ng�?)�renderScale�	__class__�width�height�__dict__r�scale)r+rd�os   r�renderScaledDrawingrk�sf���-�-�K��C��
��
�K�K�����+�A�H�H�[�,@�A���Z�Z�_�_�&��
�	����K�(���
��Hrc��eZdZdZd�Zddejfd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
ddd
ddddd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy) �Rendererz*Virtual superclass for graphics renderers.c�6�t|�d|j����)Nz+ operation not defined at superclass class=)�
ValueErrorre)r"�	operations  r�	undefinedzRenderer.undefined�s���Y�X\�Xf�Xf�g�h�hrrc�L�t|��|_|tjurtj}||_|x|jd<|_d|_	|r^t|d�r*|j||||j|j�n(|j|||j|j�|j�|j||�|j!|�|j#�|j%�|`|`|`|`|`y#|`|`|`|`|`wxYw)z�This is the top level function, which draws the drawing at the given
        location. The recursive part is handled by drawNode.)r$�_drawingN�drawBoundary)r�_trackerr�_unset_�showBoundaryrZrhrs�_parentrrtrfrg�rect�	saveState�	initState�drawNoder8�restoreState)r"�drawingr_�x�yrws      r�drawz
Renderer.draw�s���%��8��
��9�,�,�,�9�;Q�;Q�l����6=�=����
�#�d�m����	]���6�.�1��'�'��Q�q����w�~�~�V��K�K��1�g�m�m�W�^�^�D������N�N�1�Q���M�M�'�"��H�H�J����!���d�m�V�_�g�o�t�}����d�m�V�_�g�o�t�}�s
�B3D�D#c���|jjd}tt|d�dd�||fz|d<|jj	|�|j|i�y)Nr.r�)rur�tuple�listr1�applyStateChanges)r"rr�rUs    rr{zRenderer.initState�sa�����(�(��,��#�D���)<�$=�b�q�$A�B�A�a�5�H��{���
�
���6�"����v�r�*rc�8�|jj�yr))rur8r;s rr8zRenderer.pop�s���
�
���rc�&�|jd�y)zEThis is the recursive method called for each node
        in the treer|N�rq)r"r^s  rr|zRenderer.drawNode�s��	
���z�"rc�>�|jjd}||S)z,Return current state parameter for given keyr.)rur)r"r0�currentStates   r�
getStateValuezRenderer.getStateValue�s!���}�}�.�.�r�2���C� � rc��|jj�D]7\}}t|t�s�|j	||�}||j|<�9y)z�Examine a node for any values which are Derived,
        and replace them with their calculated values.
        Generally things may look at the drawing or their
        parent.

        N)rhrr[r�getValue)r"r^r0r�newValues     r�fillDerivedValueszRenderer.fillDerivedValues�sN���-�-�-�-�/�	.�J�C���%��.�!�>�>�$��4��%-��
�
�c�"�
	.rc�X�t|dd�}	t||�}|s	s|`yyt|d�rd}n	||_d}|j	|�t|dd�}|r||||��t|t�r|j|��n�t|t�r|j|��not|t�r|j|��nLt|t�r|j|��n)t|t�r|j|��nt|t �r|j#|�n�t|t$�r|j'|�n�t|t(�r|j+|�n�t|t,�r|j/|�n~t|t0�r|j3|�n\t|t4�r|j7|�n:t|t8�r|j;|�nt=ddt?|�z�|s|`yy#s|`wwxYw)z1dispatch on the node's (super) class: shared coderZNr�_drawTimeCallback)r_�renderer�DrawingErrorz!Unexpected element %s in drawing!) r rbrZrr�r[�Line�drawLine�Image�	drawImage�Rect�drawRect�Circle�
drawCircle�Ellipse�drawEllipse�PolyLine�drawPolyLine�Polygon�drawPolygon�Path�drawPath�String�
drawString�Group�	drawGroup�Wedge�	drawWedge�
DirectDraw�drawDirectlyrS�str)r"r^r_r`�dtcbs     r�drawNodeDispatcherzRenderer.drawNodeDispatcher�s�����i��-��)	-�"�4��/�D���N���7�M�t�I�&���%������"�"�4�(��4� 3�D�9�D���T���6��$��%��
�
�d�#��D�%�(����t�$��D�$�'��
�
�d�#��D�&�)�����%��D�'�*�� � ��&��D�(�+��!�!�$�'��D�'�*�� � ��&��D�$�'��
�
�d�#��D�&�)�����%��D�%�(����t�$��D�%�(����t�$��D�*�-��!�!�$�'��n�%H�3�t�9�%T�U����7��7���7�s�H"�G8H"�"H)�_stroke�
_lineWidth�_lineCap�	_lineJoin�_fill�_font�	_fontSize)�stroke�stroke_width�stroke_linecap�stroke_linejoin�fill�font_family�	font_sizec��t|dd�}|j�D]Z}t||�}|s�|j|�	t	|d�rd}n	||_d}||_|j|�|`|r�Y|`�\y#|`s|`wwxYwrY)r �getContentsrbr�rrZrxr|)r"�groupr_r^r`s     rr�zRenderer.drawGroups�����i��-���%�%�'�	1�D�"�4��/�D���
�"�"�4�(�

1��4�	�*��G�#)�D�L�"�G�$����
�
�d�#��L��D�L�!	1���L��D�L�w�s�0A<�<	Bc��|j�}t|t�r|j|�y|j	|�yr))�	asPolygonr[r�r�r�)r"�wedge�Ps   rr�zRenderer.drawWedge/s4��
�O�O����a����M�M�!�����Q�rc�T�|j�}|D]}|j|��yr))�
asPolygonsr�)r"�path�polygons�polygons    rr�zRenderer.drawPath8s+���?�?�$���	*�G�� � ��)�	*rc�&�|jd�y)Nr�r�)r"rys  rr�zRenderer.drawRect=s�����z�"rc�&�|jd�y)Nr�r�)r"�lines  rr�zRenderer.drawLineAs�����z�"rc�&�|jd�y)Nr�r�)r"�circles  rr�zRenderer.drawCircleD������|�$rc�&�|jd�y)Nr�r��r"�ps  rr�zRenderer.drawPolyLineGs�����~�&rc�&�|jd�y)Nr�r�)r"�ellipses  rr�zRenderer.drawEllipseJ������}�%rc�&�|jd�y)Nr�r�r�s  rr�zRenderer.drawPolygonMr�rc�&�|jd�y)Nr�r�)r"�	stringObjs  rr�zRenderer.drawStringPr�rc�&�|jd�y)z\This takes a set of states, and outputs the operators
        needed to set those propertiesr�Nr�)r"rr3s   rr�zRenderer.applyStateChangesSs��	
���*�+rc��td��)Nr�)�NotImplementedError)r"�args�kwdss   rr�zRenderer.drawImageXs
��!�+�.�.rN)rCrDrErFrqrrvr�r{r8r|r�r�r��	_restoresr�r�r�r�r�r�r�r�r�r�r�r�r*rrrmrm�s���4�i�'(�1�9�;L�;L�]�2+��#�!�

.�/-�b$�L�R\�"-�W�7�'�)�I�1�, �*�
#�#�%�'�&�&�%�,�
/rrm�__main__z&this file has no script interpretationN)�__version__rFrT�reportlab.lib.validatorsr�	reportlabrrrrrrrWrbrkrmrCrSr*rr�<module>r�sj��

��f��'�1��&�	�W(�W(�r-�0�
�w/�w/�r�Z��	�
2�3�	�'�N�r

Zerion Mini Shell 1.0