
    kfi                     @    d Z dZddlmZ ddlmZ  G d d          ZdS )z3.3.0z
PDFPathObject is an efficient way to draw paths on a Canvas. Do not
instantiate directly, obtain one from the Canvas instead.

Progress Reports:
8.83, 2000-01-13, gmcm: created from pdfgen.py

    )pdfgeom)fp_strc                   n    e Zd ZdZddZd Zd Zd Zd Zd Z	ddZ
ddZd Zd ZddZd Zd Zd ZdS )PDFPathObjecta:  Represents a graphic path.  There are certain 'modes' to PDF
    drawing, and making a separate object to expose Path operations
    ensures they are completed with no run-time overhead.  Ask
    the Canvas for a PDFPath with getNewPathObject(); moveto/lineto/
    curveto wherever you want; add whole shapes; and then add it back
    into the canvas with one of the relevant operators.

    Path objects are probably not long, so we pack onto one line

    the code argument allows a canvas to get the operations appended directly so
    avoiding the final getCode
    Nc                 @    |g f|d u          | _         | j        | _        d S N)_code_init_code_append_code_append)selfcodes     [/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/reportlab/pdfgen/pathobject.py__init__zPDFPathObject.__init__   s'    2Ytt|,
 2    c                     |                     d          s|                     d          s
J d            | j        j        } |d            ||           || _        d S )Nz mz rez%path must start with a moveto or rectn)endswithr	   appendr   )r   ccode_appends      r   r
   zPDFPathObject._init_code_append#   si    zz$]1::e#4#4]]6]]]]j'CA'r   c                 6    d                     | j                  S )z#pack onto one line; used internally )joinr	   r   s    r   getCodezPDFPathObject.getCode*   s    xx
###r   c                 R    |                      dt          ||          z             d S )Nz%s mr   r   r   xys      r   moveTozPDFPathObject.moveTo.   )    &6!A;;./////r   c                 R    |                      dt          ||          z             d S )Nz%s lr   r   s      r   lineTozPDFPathObject.lineTo1   r"   r   c                 Z    |                      dt          ||||||          z             d S )Nz%s cr   )r   x1y1x2y2x3y3s          r   curveTozPDFPathObject.curveTo4   s3    &6"b"b"b#A#AABBBBBr   r   Z   c           
      ^    |                      t          j        ||||||                     dS )a  Contributed to piddlePDF by Robert Kern, 28/7/99.
        Draw a partial ellipse inscribed within the rectangle x1,y1,x2,y2,
        starting at startAng degrees and covering extent degrees.   Angles
        start with 0 to the right (+x) and increase counter-clockwise.
        These should have x1<x2 and y1<y2.

        The algorithm is an elliptical generalization of the formulae in
        Jim Fitzsimmon's TeX tutorial <URL: http://www.tinaja.com/bezarc1.pdf>.N_curvesr   	bezierArcr   r&   r'   r(   r)   startAngextents          r   arczPDFPathObject.arc7   s1     	W&r"bXvFFGGGGGr   c           
      `    |                      t          j        ||||||          d           dS )zmLike arc, but draws a line from the current point to
        the start if the start is not the current point.r$   Nr/   r2   s          r   arcTozPDFPathObject.arcToC   s3     	W&r"bXvFFxPPPPPr   c           	      X    |                      dt          ||||f          z             dS )zAdds a rectangle to the pathz%s reNr   r   r   r    widthheights        r   rectzPDFPathObject.rectH   s2    'FAq%+@$A$AABBBBBr   c           
      j    |                      t          j        ||||z   ||z   dd                     dS )zadds an ellipse to the pathr   ih  Nr/   r9   s        r   ellipsezPDFPathObject.ellipseL   s7    W&q!QYq6z1cJJKKKKKr   r!   c                 v     t          | |          |d         d d           |D ]} | j        |dd            d S )Nr      )getattrr,   )r   curvesinitialcurves       r   r0   zPDFPathObject._curvesP   sX    Wvay!}-- 	% 	%EDL%)$$$	% 	%r   c                 X    ||z
  }||z
  }d|z  x}}|                      ||||           dS )zadds a circle to the pathr@   N)r>   )r   x_ceny_cenrr&   r'   r:   r;   s           r   circlezPDFPathObject.circleU   s@    QYQY1RUF+++++r   c           
         d}|||z   f}t          |          t          |          }}|||z   f}	t          |	          t          |	          }	}
t          |t          t          f          rd |D             }t          |          dk     r|dt          |          z
  dgz  z  }|                     ||d         z   |
           |                     ||d         z
  |
           |d         dk    r4||d         z  }|                     ||z
  |
||
|z   ||
|d         z              |                     ||	|d         z
             |d         dk    r4||d         z  }|                     ||	|z
  ||z
  |	||d         z
  |	           |                     ||d         z   |	           |d         dk    r4||d         z  }|                     ||z   |	||	|z
  ||	|d         z
             |                     ||
|d         z              |d         dk    r4||d         z  }|                     ||
|z   ||z   |
||d         z   |
           n||z  }|                     ||z   |
           |                     ||z
  |
           |                     ||z
  |
||
|z   ||
|z              |                     ||	|z
             |                     ||	|z
  ||z
  |	||z
  |	           |                     ||z   |	           |                     ||z   |	||	|z
  ||	|z
             |                     ||
|z              |                     ||
|z   ||z   |
||z   |
           | 	                                 dS )	z{Draws a rectangle with rounded corners. The corners are
        approximately quadrants of a circle, with the given radius.gW[?c                 .    g | ]}t          d |          S )r   )max).0rH   s     r   
<listcomp>z+PDFPathObject.roundRect.<locals>.<listcomp>h   s     ***aQq***r      r   r@         N)
minrL   
isinstancelisttuplelenr!   r$   r,   close)r   r   r    r:   r;   radiusmxhixloyhiylorH   ts                r   	roundRectzPDFPathObject.roundRect\   sx    %is88SXXS&js88SXXSfd5\** 	H**6***A1vvaxxqQx!n,KKad
C(((KKad
C(((tAvvadFS1Wc3acAaDjIIIKKS1Q4Z(((tAvvadFS#'37CqtSIIIKKad
C(((tAvvadFS1Wc3acAaDjIIIKKS1Q4Z(((tAvvadFS#'37CqtSIII F
AKKfc***KKfc***LLq#sC!GS#,GGGKKS6\***LLcAgsQwS6\3GGGKKfc***LLq#sC!GS#,GGGKKS6\***LLcAgsQwS6\3GGG

r   c                 0    |                      d           dS )z%draws a line back to where it startedhN)r   r   s    r   rW   zPDFPathObject.close   s    #r   r   )r   r-   )r!   )__name__
__module____qualname____doc__r   r
   r   r!   r$   r,   r5   r7   r<   r>   r0   rI   r_   rW    r   r   r   r      s        3 3 3 3( ( ($ $ $0 0 00 0 0C C C
H 
H 
H 
HQ Q Q Q
C C CL L L% % % %
, , ,+ + +Z    r   r   N)__version__re   reportlab.pdfgenr   reportlab.lib.rl_accelr   r   rf   r   r   <module>rj      su    	 % $ $ $ $ $ ) ) ) ) ) )y y y y y y y y y yr   