%PDF- %PDF-
Direktori : /lib/python3/dist-packages/reportlab/graphics/__pycache__/ |
Current File : //lib/python3/dist-packages/reportlab/graphics/__pycache__/renderPDF.cpython-312.pyc |
� �e4; � � � d Z dZddlmZ ddl� ddlmZ ddlmZ ddl m Z ddlmZm Z mZmZ e j fd �Z G d � de� ZddlmZ G d � de� Zde j di fd�Zde j di fd�Zdd�Zedk( r? ed�� ddlZ eej8 � dkD rej8 d ZndZ eed�� yy)z3.3.0z�Render Drawing objects within others PDFs or standalone Usage:: import renderpdf renderpdf.draw(drawing, canvas, x, y) Execute the script to see some test drawings. changed � )�BytesIO)�*)�Canvas)�stringWidth)� rl_config)�Renderer� getStateDelta�renderScaledDrawing�STATE_DEFAULTSc �V � t � }|j t | � ||||�� y)z As it says��showBoundaryN)�_PDFRenderer�drawr )�drawing�canvas�x�yr �Rs �>/usr/lib/python3/dist-packages/reportlab/graphics/renderPDF.pyr r s% � ���A��F�F��w�'���A�L�F�Q� c �j � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zd� Z d� Zd � Zd� Zd� Zd� Zy)r z�This draws onto a PDF document. It needs to be a class rather than a function, as some PDF-specific state tracking is needed outside of the state info in the SVG model.c � � d| _ d| _ y �Nr )�_stroke�_fill��selfs r �__init__z_PDFRenderer.__init__% s � ������ r c � � t |t � r|j s| j j � t |� }| j j |� | j |i � | j |� | j j � t |t � r|j s| j j � yy)zEThis is the recursive method called for each node in the treeN)� isinstance�Path� isClipPath�_canvas� saveStater �_tracker�push�applyStateChanges�drawNodeDispatcher�pop�restoreState)r �node�deltass r �drawNodez_PDFRenderer.drawNode) s� � � �4��&�4�?�?��L�L�"�"�$� �t�$��� � ���6�"����v�r�*� ����%�� � �����4��&�4�?�?��L�L�%�%�'� ,;r c �� � |j |j cxk( rdk( ran n^| j j |j |j |j |j | j | j �� y | j j |j |j |j |j |j | j | j �� y )Nr ��stroke�fill�r2 r1 )�rx�ryr$ �rectr r �width�heightr r � roundRect)r r6 s r �drawRectz_PDFRenderer.drawRect= s� � ��7�7�d�g�g�"��"��L�L����F�F�D�F�F��J�J�����<�<���� � � �L�L�"�"��F�F�D�F�F��J�J����T�W�W�����<�<� #� r c � � |j }|r~t |d� s)t j j |j � rH| j j ||j |j |j |j � y y y )N�mode) �path�hasattr�os�existsr$ �drawInlineImager r r7 r8 )r �imager= s r � drawImagez_PDFRenderer.drawImageP sa � ��z�z���W�T�&�)�R�W�W�^�^�E�J�J�-G��L�L�(�(���G�G�U�W�W��K�K���� � .H�4r c � � | j rG| j j |j |j |j |j � y y �N)r r$ �line�x1�y1�x2�y2)r rF s r �drawLinez_PDFRenderer.drawLineZ s6 � ��<�<��L�L���d�g�g�t�w�w�������A� r c � � | j j |j |j |j | j | j �� y �Nr3 )r$ �circle�cx�cy�rr r )r rN s r � drawCirclez_PDFRenderer.drawCircle^ s: � ��L�L����I�I�v�y�y�&�(�(�����<�<� � r c � � | j r�t |j � dk\ sJ d� �|j dd |j dd }}| j j � }|j |d |d � t dt |� d� D ] }|j || ||dz � � | j j |� y y )N� �#Polyline must have 2 or more pointsr � ) r �len�pointsr$ � beginPath�moveTo�range�lineTo�drawPath)r �polyline�head�tailr= �is r �drawPolyLinez_PDFRenderer.drawPolyLinee s� � ��<�<��x���'�1�,�S�.S�S�,�!����1�-�x���q�r�/B�$�D��<�<�)�)�+�D��K�K��Q���a��)��1�c�$�i��+� 0�����D��G�T�!�A�#�Y�/� 0��L�L�!�!�$�'� r c �� � |j r | j |j � � y |j |j |j |j |j f\ }}}}}|j � \ }}} |�|}||z } | j j � }|dk( s|�<| dk( s| �5|j ||� |j ||z ||z ||z ||z || � nE|j ||z ||z ||z ||z || � |j ||z || z ||z || z || � |j � | j j || j | j �� y )Nr r3 )�annularr] � asPolygon�centerx�centery�radius�startangledegrees�endangledegrees� _xtraRadiir$ rY rZ �arcTo�arc�closer r )r �wedgerf rg rh ri rj �yradius�radius1�yradius1�angler= s r � drawWedgez_PDFRenderer.drawWedgeo si � ��=�=��M�M�%�/�/�+�,� �]�]�E�M�M�5�<�<��9P�9P�RW�Rg�Rg� g� I�G�W�f�&7��).�)9�)9�);�&�G�W�h���&��#�$5�5�E��<�<�)�)�+�D��� �g�o�H�a�K�8�CS����G�W�-�� � �7�6�>�7�7�?�G�F�N�G�T[�O�(�%�1� ���������'�&�.�'�RY�/�(�%�1�� � �7�7�?�G�H�,<�g�g�o�w�W_�O_�&���0��J�J�L��L�L�!�!�$�!�Z�Z�#�|�|� "� r c �6 � |j |j z }|j |j z }|j |j z }|j |j z }| j j ||||| j | j �� y rM )rO r4 rP r5 r$ �ellipser r )r rv rG rI rH rJ s r �drawEllipsez_PDFRenderer.drawEllipse� sq � � �Z�Z�'�*�*� $�� �Z�Z�'�*�*� $�� �Z�Z�'�*�*� $�� �Z�Z�'�*�*� $�������R��2�b�d�j�j�����Mr c �� � t |j � dk\ sJ d� �|j dd |j dd }}| j j � }|j |d |d � t dt |� d� D ] }|j || ||dz � � |j � | j j || j | j �� y )NrT rU r rV r0 )rW rX r$ rY rZ r[ r\ rn r] r r )r �polygonr_ r` r= ra s r �drawPolygonz_PDFRenderer.drawPolygon� s� � ��7�>�>�"�a�'�N�)N�N�'��^�^�A�a�(�'�.�.���*<�d���|�|�%�%�'�����D��G�T�!�W�%��q�#�d�)�Q�'� ,�A��K�K��Q���a��c��+� ,�� � ������� �#'�<�<�!%��� � r c � � t |dd� }|dv }|dv }| j r|s| j r�|r�| j j � }|d |j |j |j |j f\ }}}} } |dvra|d |d }}t | ||| � } |d k( r|| z }n>|d k( r || dz z }n0|dk( r|t || | ||| � z }nt d t |� z � �| j j ||| |xs d �� y y y )N�textRenderModer )r rT � � )rV rT � r~ � textAnchor)�start� inherited�fontName�fontSize�end�middleg �?�numericzbad value for textAnchor )r<