403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/reportlab/graphics/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/reportlab/graphics/__pycache__/shapes.cpython-310.pyc
o

`�b���@s�dZdZddlZddlZddlmZmZmZmZm	Z	m
Z
ddlmZddl
mZmZmZmZmZddlmZddlmZdd	lTdd
lmZmZeedd��Zdd	lTddlm Z dd
l!m"Z"ddl#m$Z$ddl%m&Z&m'Z'e$edd�Z(e$edd�Z)e$edd�Z*dZ+dZ,idd�dej-�dd�dd�dd�dd�dd�dd�dd�dd�dd�d d�d!ej-�d"e&�d#d�d$e�d%d&�Z.dd	l/Td'd(�Z0d)d*�Z1Gd+d,�d,�Z2Gd-d.�d.�Z3d/d0�Z4d1d2�Z5d3d4�Z6d5d6�Z7Gd7d8�d8e3e2�Z8Gd9d:�d:e8�Z9d|d;d<�Z:d|d=d>�Z;d}d@dA�Z<dBdC�Z=GdDdE�dEe9e�Z>GdFdG�dG�Z?GdHdI�dIe@�ZAeA�ZAGdJdK�dKe8�ZBGdLdM�dMeB�ZCGdNdO�dOeB�ZDeEeFdP��\ZGZHZIZJdQZKgdR�ZLd~dSdT�ZMdde'e'dUe'dVe'e&e&dWe&dXe&iZNGdYdZ�dZeD�ZOeO�ZPdd[d\�ZQGd]d^�d^eO�ZRgdddfd_d`�ZSGdadb�dbeD�ZTGdcdd�ddeD�ZUGdedf�dfeD�ZVGdgdh�dheD�ZWGdidj�djeD�ZXGdkdl�dleD�ZYGdmdn�dneB�ZZGdodp�dpeO�Z[defdqdr�Z\Gdsdt�dte8�Z]Gdudv�dve2�Z^Gdwdx�dxe8�Z_dydz�Z`ead{k�r�e`�dSdS)�z3.5.60z9Core of the graphics library - defines Drawing and Shapes�N)�pi�cos�sin�sqrt�radians�floor)�Flowable)�
shapeChecking�verbose�defaultGraphicsFontName�_unset_�
decimalSymbol)�logger)�colors)�*)�isSeq�asBytes�)�fp_str)�stringWidth)�tt2ps)�
FILL_EVEN_ODD�
FILL_NON_ZEROzNon-Zero WindingzEven-Odd�	transform�rrrrrr�strokeColor�strokeWidth�
strokeLineCap�strokeLineJoin�strokeMiterLimit�
�strokeDashArray�
strokeOpacity�fillOpacity�
fillOverprintF�strokeOverprint�
overprintMask�	fillColor�fillMode�fontSize�fontName�
textAnchor�startc
Csd}|D]}t|t|||��}qt|�|}|}	|ddkr&|}
|	|}	n|ddkr/d}
n	|d}
|	|
}	|ddkrV|}|dkrHd}n?|dkrP|}n7|d}n1|dd	krqd}|dkre|}n"|dkrld}n|d}n|d}|dkr~|}n	|dkr�|}nd}||
||||	fS)
Nr�s�ng@����e�endr,�w)�maxr�len)
�text�fontr)�leadingr+�	boxAnchorr2�t�h�yt�yb�xb�xt�r?�;/usr/lib/python3/dist-packages/reportlab/graphics/shapes.py�_textBoxLimitsCs6



rAcCsptt|�||f|||f||||f|||ff�}dd�|D�}dd�|D�}t|�t|�t|�t|�|fS)z�
    Find the corner points of the rotated w x h sized box at x,y
    return the corner points and the min max points in the original space
    cS�g|]}|d�qS�rr?��.0�xr?r?r@�
<listcomp>k�z%_rotatedBoxLimits.<locals>.<listcomp>cSrB�rr?rDr?r?r@rGlrH)�zTransformPoints�rotate�minr3)rF�yr2r:�angle�C�X�Yr?r?r@�_rotatedBoxLimitses6rRc@�eZdZdZdd�ZdS)�_DrawTimeResizeablez:Addin class to provide the horribleness of _drawTimeResizecCsFt|d�r|j}|j}|||_|_t|d�r!|�||�dSdSdS)N�_canvas�_drawTimeResize)�hasattrrU�_drawing�width�heightrV)�selfr2r:�canvas�drawingr?r?r@rVqs

�z#_DrawTimeResizeable._drawTimeResizeN)�__name__�
__module__�__qualname__�__doc__rVr?r?r?r@rTo�rTc@seZdZifdd�ZdS)�_SetKeyWordArgscCs"|��D]
\}}t|||�qdS)z9In general properties may be supplied to the constructor.N)�items�setattr)r[�keywords�key�valuer?r?r@�__init__zs�z_SetKeyWordArgs.__init__N)r^r_r`rir?r?r?r@rcysrcc
Cs|dd�|D�}|sdS|d\}}}}|dd�D]\}}}}	||kr%|}||kr+|}||kr1|}|	|kr7|	}q||||fS)NcSsg|]}|dur|�qS�Nr?rDr?r?r@rG�sz"getRectsBounds.<locals>.<listcomp>rrr?)
�rectList�L�xMin�yMin�xMax�yMax�x1�y1�x2�y2r?r?r@�getRectsBounds�s�rucCs|d|||}d|d||}||}|g}||d||}|dkr�t|�}|dkr4|}d||}	g}
z	|
�|	|�WnYz	|
�||	�WnY|d9}|d9}|
D]}d|krndkr�nqb|�|||||||�qb|�|�|S)ag
    this is used to find if a curveTo path operator has extrema in its range
    The curveTo operator is defined by the points y0, y1, y2, y3

        B(t):=(1-t)^3*y0+3*(1-t)^2*t*y1+3*(1-t)*t^2*y2+t^3*y3
            :=t^3*(y3-3*y2+3*y1-y0)+t^2*(3*y2-6*y1+3*y0)+t*(3*y1-3*y0)+y0
    and is a cubic bezier curve.

    The differential is a quadratic
        t^2*(3*y3-9*y2+9*y1-3*y0)+t*(6*y2-12*y1+6*y0)+3*y1-3*y0

    The extrema must be at real roots, r, of the above which lie in 0<=r<=1

    The quadratic coefficients are
        a=3*y3-9*y2+9*y1-3*y0 b=6*y2-12*y1+6*y0 c=3*y1-3*y0
    or
        a=y3-3*y2+3*y1-y0 b=2*y2-4*y1+2*y0 c=y1-y0  (remove common factor of 3)
    or
        a=y3-3*(y2-y1)-y0 b=2*(y2-2*y1+y0) c=y1-y0

    The returned value is [y0,x1,x2,y3] where if found x1, x2 are any extremals that were found;
    there can be 0, 1 or 2 extremals
    ���rg�g�?r)r�append)�y0rrrt�y3�a�b�crQ�d�q�Rr9r?r?r@�_getBezierExtrema�s4"�
r�cCs\t|�}|fdd�}tt|td|d���}tt|td|d���}t|�t|�t|�t|�fS)NcSs||Srjr?)�i�pr?r?r@�<lambda>�szgetPathBounds.<locals>.<lambda>rrwr)r4�list�map�rangerLr3)�pointsr.�f�xs�ysr?r?r@�
getPathBounds�s
r�cCsP|d}t|�r$dd�|D�}dd�|D�}t|�t|�t|�t|�fSt|�S)z"Helper function for list of pointsrcSrBrCr?�rE�xyr?r?r@rG�rHz#getPointsBounds.<locals>.<listcomp>cSrBrIr?r�r?r?r@rG�rH)rrLr3r�)�	pointList�firstr�r�r?r?r@�getPointsBounds�sr�c@sXeZdZdZe�Zdd�Zddd�Zdd�Zdd
d�Z	dd
�Z
er&	dd�Zdd�Z
dS)�Shapea1Base class for all nodes in the tree. Nodes are simply
    packets of data to be created, stored, and ultimately
    rendered - they don't do anything active.  They provide
    convenience methods for verification but do not
    check attribiute assignments or use any clever setattr
    tricks this time.cCstd|jj��)zReturn a clone of this shape.z!No copy method implemented for %s)�NotImplementedError�	__class__r^�r[r?r?r@�copy��z
Shape.copyrcCs4i}|j��D]\}}|dd�dkr|||<q|S)zDInterface to make it easy to extract automatic
        documentationrr�_)�__dict__rd)r[�recur�propsrgrhr?r?r@�
getProperties�s�zShape.getPropertiescCs|j�|�dS)zfSupports the bulk setting if properties from,
        for example, a GUI application or a config file.N)r��update)r[r�r?r?r@�
setProperties�r�zShape.setProperties�cCsHt|�����}|��|r|d}|D]
\}}td|||f�qdS)z�Convenience. Lists them on standard output.  You
        may provide a prefix - mostly helps to generate code
        samples for documentation.�.z	%s%s = %sN)r�r�rd�sort�print)r[�prefix�propList�namerhr?r?r@�dumpPropertiess�zShape.dumpPropertiescCs�|jdurL|j��D]}|ddkr||jvsJd||f��q
|j��D](\}}t||�s6Jd||f��t||�}|�|�sKJd|||jjf��q%dSdS)a.If the programmer has provided the optional
        _attrMap attribute, this checks all expected
        attributes are present; no unwanted attributes
        are present; and (if a checking function is found)
        checks each attribute.  Either succeeds or raises
        an informative exception.Nrr�z#Unexpected attribute %s found in %szMissing attribute %s from %sz-Invalid value %s for attribute %s in class %s)	�_attrMapr��keysrdrW�getattr�validater�r^)r[rg�attr�	metavaluerhr?r?r@�verifys
�
"�zShape.verifycCst|||�dS)zSBy default we verify.  This could be off
            in some parallel base classes.N)�validateSetattr)r[r�rhr?r?r@�__setattr__%szShape.__setattr__cC�td��)�5Returns bounding rectangle of object as (x1,y1,x2,y2)z+Shapes and widgets must implement getBounds�r�r�r?r?r@�	getBounds*szShape.getBoundsNrI)r�)r^r_r`ra�AttrMapr�r�r�r�r�r�r	r�r�r?r?r?r@r��s

r�c
@s�eZdZdZeeeddd�eedd�eedd�eeddd�eed	dd�d
�Z	dd�Z
d
d�Zd3dd�Zdd�Z
d3dd�Zdd�Zdd�Zdd�Zd4dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�ZdS)5�GroupaGroups elements together.  May apply a transform
    to its contents.  Has a publicly accessible property
    'contents' which may be used to iterate over contents.
    In addition, child nodes may be given a name in which
    case they are subsequently accessible as properties.z"Coordinate transformation to applyr��desc�
advancedUsagezContained drawable elements�r��Turn on stroke overprinting�Turn on fill overprinting�overprinting for ordinary CMYK)r�contentsr%r$r&cOs<|j��|_g|_d|_|D]}|�|�qt�||�dS)z�Initial lists of elements may be provided to allow
        compact definitions in literal Python code.  May or
        may not be useful.rN)r��cloner�r�addrcri)r[�elementsrf�eltr?r?r@ri=szGroup.__init__cCs8|r|t|j���vrtt�|j|<t|||�dSdS)zLif name is not None add an attribute pointing to node and add to the attrMapN)r�r�r��AttrMapValue�isValidChildre)r[r��noder?r?r@�
_addNamedNodeMs
�zGroup._addNamedNodeNcCs8|durt|�sJd��|j�|�|�||�dSdS)z�Appends non-None child node to the 'contents' attribute. In addition,
        if a name is provided, it is subsequently accessible by name
        Nz1Can only add Shape or UserNode objects to a Group)r�r�ryr�)r[r�r�r?r?r@r�Ts
�z	Group.addcCs|�|�|jdS)Nr/)r�r�)r[r�r?r?r@�_nn^s

z	Group._nncCsT|dur(t|�sJd��|dkr|g|j||�<n|j�||�|�||�dSdS)z4Inserts sub-node n in contents at specified locationNz4Can only insert Shape or UserNode objects in a Groupr)r�r��insertr�)r[r�r.r�r?r?r@r�bs�zGroup.insertcCs�t|t�rt|j|j�pt�}|j��|_t|d�r"|jdd�|_|j	}|j	j
}|D]}t|t�r7|��}nt|t�rA|�
�}n|��}||�q+|�|�|S)z9Return a new object which only contains primitive shapes.rN)�
isinstance�DrawingrYrZr�r�r�rWrr�ry�UserNode�provideNode�expandUserNodesr��_copyNamedContents)r[�obj�
self_contentsr|�child�newChildr?r?r@r�ls





zGroup.expandUserNodescCs�t�}t|d�r|j|_t|d�r|jdd�|_|��dd�}|rX|�d�}t|t�r5|�|�	��n!t|t�rQ|�
�}|jdkrK|j�|j�n|�
|�n|�
|�|s#|S)z return a fully expanded object�	__label__rNrr)r�rWr�r�getContents�popr�r�ryr��_exploder��extendr�)r[r��Pr.r?r?r@r��s"





�zGroup._explodecCs|jD]}|j�|�qdSrj)r�ry)r[r�r�r?r?r@�
_copyContents�s
�zGroup._copyContents�r�c	Cs�ddlm}|j}|st|j���}|j��D]'\}}||vr.|�|�}t|||j|�q||vr>||vr>t||||��qdS)Nr)r�)	r�r�r�r�r�r�rd�indexre)	r[r��aKeys�noCopyr�r��k�v�posr?r?r@r��s
��zGroup._copyNamedContentscCs$|j��|_|�|�|�|�|S)z
copies to obj)r�r�r�r��r[r�r?r?r@�_copy�s

zGroup._copycCs|�|���S)zreturns a copy)r�r�r�r?r?r@r��sz
Group.copycCst|jt|��|_dS�z&Convenience to help you set transformsN)�mmultrrK)r[�thetar?r?r@rK��zGroup.rotatecC�t|jt||��|_dSr�)r�r�	translate)r[�dx�dyr?r?r@r���zGroup.translatecCr�r�)r�r�scale)r[�sx�syr?r?r@r��r�zGroup.scalecCs tt|jt|��t|��|_dSr�)r�r�skewX�skewY)r[�kx�kyr?r?r@�skew�� z
Group.skewcCs|jdd�||f|_dS)z2Convenience function to set the origin arbitrarilyN���)r�r[rFrMr?r?r@�shift�szGroup.shiftcCs$t|_|j�|j�||_||_dS)z| Convenience function to make a drawing from a group
            After calling this the instance will be a drawing!
        N)r�r�r�r��_xtraAttrMaprYrZ)r[rYrZr?r?r@�	asDrawing�s
zGroup.asDrawingcCs,t|dd�}|j}|r||vr|g|}|S)z[Return the list of things to be rendered
        override to get more complicated behaviour�
backgroundN)r�r�)r[r}rOr?r?r@r��szGroup.getContentscCs�|jrFg}|jD]	}|�|���qt|�}|durdS|\}}}}|j}||g||g||g||gg}g}	|D]
}
|	�t||
��q7t|	�SdSrj)r�ryr�rur�transformPointr�)r[r}�elemrqrrrsrt�trans�corners�
newCorners�cornerr?r?r@r��s
zGroup.getBoundsrj)Nr�)r^r_r`rar�r��isTransform�isListOfShapes�	isBooleanr�rir�r�r�r�r�r�r�r�r�r�rKr�r�r�r�r�r�r�r?r?r?r@r�.s8

�




	r�cCs^ddlm}|j}||�j}|p|j}||vr|g||<dS|||vr-||�|�dSdS)z7add an import of obj's class to a dictionary of importsr)�	getmoduleN)�inspectrr�r^ry)r��Ir.rr~�mr?r?r@�
_addObjImport�s

�rcCs�t|t�r	t|�St|�r<d}|D]}|dt||�}qt|t�r*d|dd�Sd|dd�t|�dkr8dp9dfS|turJ|rHt||d	�d	St|t	�r�|rVt||�d
dl
m}||j�\}}}}}	}
}|r||t|�d�}|t|�d�=ng}|�
�}
|jjd}|dd�D]}|
�|d�}|dt||�7}q�|D]}|
�|d�}|d
|t||�f7}q�|
��D]\}}|
|}|d
|t||�f7}q�|dd�dSt|�S)zEreturn a repr style string with named fixed args first, then keywordsr�z%s,z[%s]Nr/z(%s%s)r�,�
EmptyClipPathr)�getfullargspec�(z%s=%s,�))r��floatrr�_reprr�r4r
rr�rrrir�r�r^r�rd�repr)r[rr-r�r�args�varargs�varkw�defaults�
kwonlyargs�kwonlydefaults�annotations�kargsr�r.r?r?r@r�sB

$
r�		c
Cs�d}t|dd�}|r|d||t|�f}|j}|D]@}t|t�rNd|}|d7}t|dd�}	|	r5d|	}	|d||||	f}|t|||||�}|d8}q|d	||t||�f}q|S)
Nr�rz%s%s.transform = %s
zv%drr��#z%s%s=%s._nn(Group())%s
z
%s%s.add(%s)
)r�rr�r�r��_renderGroupPy)
�G�pfxrr��indentr-rOr.�npfx�lr?r?r@rs

rcKsH|�|j�i}t|�}|��D]}|�|�r!|||||d�<q|Srj)r�r�r4r��
startswith)r[r�kwr�r.r�r?r?r@�_extraKW/s
�r#c
@seZdZdZhd�Zehd�Zeeedd�eedd�ed�ee	dd�ee
d	d
dd�d
d�ee
dddd�dd�eedd�eedd�eedd�d�	Z
eeeee
e�ddd�dd�d�Ze�e
�d2dd�Zdd�Zefd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd3d+d,�Zd4d-d.�Zd5d0d1�ZdS)6r�zOutermost container; the thing a renderer works on.
    This has no properties except a height, width and list
    of contents.>�ps�py�bmp�eps�gif�jpg�pct�pdf�png�svg�tif�jpeg�pict�tiff�tiff1�tiffl�tiffp>r$r%r'r+r-zDrawing width in points.r�zDrawing height in points.Nz=Background widget for the drawing e.g. Rect(0,0,width,height)�LEFT�RIGHT�CENTER�CENTREz+Horizontal alignment within parent document�TOP�BOTTOMz)Vertical alignment within parent documentzGlobal scaling for renderingz.override the STATE_DEFAULTS value for fontNamez.override the STATE_DEFAULTS value for fontSize)	rYrZ�canvr��hAlign�vAlign�renderScale�initialFontName�initialFontSizerr)�lo�emptyOKzOne or more plot modes)�BASE�formats���cOs@d|_tj|g|�Ri|��||_||_d|_d|_d|_dS)Nr5r:��?)r�r�rirYrZr<r=r>)r[rYrZ�nodesrfr?r?r@rihs
zDrawing.__init__cCs�gd�gd�d�}t|��d|�}d|jj}d}|��D]\}}|d|t|�dd	��d
d�f}q|d|}|d
|j|jf}|d}||}|d|}|S)N)�_DrawingEditorMixinr�r�)�Color�	CMYKColor�
PCMYKColor)zreportlab.graphics.shapeszreportlab.lib.colorsr[�ExplodedDrawing_z0#Autogenerated by ReportLab guiedit do not edit
zfrom %s import %s
rr/�'r�z(
class %s(_DrawingEditorMixin,Drawing):
z3	def __init__(self,width=%s,height=%s,*args,**kw):
z1		Drawing.__init__(self,width,height,*args,**kw)
zZ

if __name__=="__main__": #NORUNTESTS
	%s().save(formats=['pdf'],outDir='.',fnRoot=None)
)	rr�r�r^rd�str�replacerYrZ)r[rrr.r-r�or?r?r@�	_renderPyqs�&zDrawing._renderPyc	Cs:ddlm}|j||jdd|tur|nt|dt�d�dS)z�This is used by the Platypus framework to let the document
        draw itself in a story.  It is specific to PDF and should not
        be used directly.r��	renderPDF�
_showBoundary��showBoundaryN)�reportlab.graphicsrT�drawr;rr�)r[rWrTr?r?r@rY�s
�zDrawing.drawcCs2|j}|j}|j}|dkr||9}||9}||fS)NrG)rYrZr>)r[�
availWidth�availHeightrYrZr>r?r?r@�wrap�szDrawing.wrapcCst�|�}|j|_|j|_|S)z:Return a new drawing which only contains primitive shapes.)r�r�rYrZr�r?r?r@r��s
zDrawing.expandUserNodescCs|�|�|j|j��S)zReturns a copy)r�r�rYrZr�r?r?r@r��r�zDrawing.copycOs|�t|i|���Srj)r�r�)r[rr"r?r?r@�asGroup�szDrawing.asGroupr�cKs|�dd�}t|t�rd|}nd}|d7}ddlm}d}	|sft|d|jjd�}t|d	d�}
t|
d
�r9|
|�}
t|d
�rC||
�}n#z||
}Wnt	ye}zt
|��d�dkr[�WYd}~nd}~ww|durpt|d
d�}t|d
�ry||�}tj
�|�r�tj
�|�\}}n|p�t|d
d�}|���tj�}|s�d}tj
�|�s�tj
�t|dtj
�tjd��|�}tj
�|�s�t�|�tj
�tj
�||��}tj
�|�}
|
ddd���|jvr�|
d}dd�|p�t|ddg�D�}
|dur�|fp�t|d|�fd}tjjtjjf}|tj_tj_d|
v�rbddl m!}|d}|�r)t"|d|f�|j#|||fdt|d|j$�it%|dfi|����|	d}	tj&dk�rbddl'}ddl(}|�)|��*dd�|�+|�|j,D]i}||
v�r�dd l m-}d!||f}|�r�t"|||f�t|d"d�}|�r�t|d|g�}||v�r�t|d#d��s�|�.�nd}|j#||f|t|d|j$�d$�t%|d%fi|����|	d&|}	|�r�|�/|��qed'|
v�r6zdd(l0m1}Wnt2�y�dd)l m3}Ynw|d*}|�r�t"|d+|f�|j#||f|t|d,d-g�dt|d,dd.g�dt|d/|j4�t|d|j$�t|d0|j5�d1�t%|d2fi|����|	d3}	d4|
v�rldd5l m6}|d6}|�rPt"|d7|f�|j#||fdt|d|j$�it%|d8fi|����|	d9}	d:|
v�r�dd)l m3}|d;}|�r�t"|d+|f�|j#||fdt|d|j$�it%|d2fi|����|	d<}	d=|
v�r�|d>}|�r�t"|d=|f�t7|d?��}|�8t9|�:��;d@tj<���Wd�n	1�s�wY|	dA}	|\tj_tj_t|dB��r�|�=||	�|	�r�||	dd��p�dS)Cz�Saves copies of self in desired location and formats.
        Multiple formats can be supported in one call

        the extra keywords can be of the form
        _renderPM_dpi=96 (which passes dpi=96 to renderPM)
        �	seqNumberr�z%4d: zgenerating %s file %sr��	rl_config�fileNamePatternz%03d�chartId�__call__znot all arguments convertedN�outDirr��
_override_CWDrcSsg|]}|���qSr?)�lowerrDr?r?r@rG�rHz Drawing.save.<locals>.<listcomp>rDr+r
rSz.pdf�PDFrW�
showBorder�_renderPDF_z/.pdf�mac�CAROzPDF ��renderPMz%s.%s�_drawTimeCollector�disabled��fmtrW�
_renderPM_z/.r'��renderPS_SEP��renderPSz.eps�EPS�EPS_info�Testing�	ReportLab�preview�	ttf_embed)�title�dept�companyr{rWr|�
_renderPS_z/.epsr-��	renderSVGz.svg�SVG�_renderSVG_z/.svgr$z.psz/.psr%z.py�wb�
z/.py�
saveLogger)>r�r��int�	reportlabr`r�r�r^rW�	TypeErrorrO�find�os�path�isabs�split�rstrip�sep�join�dirname�sys�argv�isdir�makedirs�normpath�splitextrf�
_saveModesr�warnOnce�enabled�infoOncerXrTr��
drawToFilerWr#�platform�macfs�
macostools�FSSpec�SetCreatorType�touched�_bmModesrm�clear�save�rlextra.graphicsrt�ImportErrorrv�eps_preview�
eps_ttf_embedr��open�writerrRrP�linesepr�)r[rDr
�fnRootrdr}r"�genFmtr`�extrb�err�fnroot�plotMode�_savedrT�filenamer�r��bmFmtrm�dtc�dtcfmtsrvr�r�r?r?r@r��s�




 ��
0 
2



2�
����	
���
0
�zDrawing.savec
KsZ||jvsJd|��ddlm}|dkr ddlm}|�|�S||jvrCddlm}|j|f|t|d|j	�d�t
|d	fi|����S|d
krlzddlm}Wnt
y^ddlm}Ynw|j||t|d|j	�d
�S|dkr�ddlm}|j|t|d|j	�d�S|dkr�|��S|dkr�ddlm}	|	j|fdt|d|j	�it
|dfi|����SdS)z,Converts to an 8 bit string in given format.zUnknown file format "%s"rr_r+rSrlrhrprrr'rsru)r{rWr$rVr%r-r�rWr�N)r�r�r`rXrT�drawToStringr�rmr�rWr#r�rtr�rvrRr�)
r[�formatr
r{r"r`rTrmrvr�r?r?r@�asStrings>

����.�zDrawing.asString�fitcCsP|��}|j}|j}t||g|�R�}	|	��\}
}}}
|dks7|dkrX|
|ks7|||ks7||ks7|
||krX||
|||	_|
||||	_dddd||
||f|	_|	S|dksj|dkr�|
|ksj|||kr�||
|||	_dddd||
df|	_|	S|dks�|dkr�||ks�|
||kr�|
||||	_ddddd||f|	_|	S)	z?return a base class drawing which ensures all the contents fitsr��expandrr�fitx�expandx�fity�expandy)r�rYrZr�r�r)r[�kind�lpad�rpad�bpad�tpadrO�oW�oHr]�xL�yL�xH�yHr?r?r@�resized;s$8$�$�zDrawing.resized)rErF)NNNNr�)Nr)r�rrrr)r^r_r`rar�r�r�r��isNumber�isValidChildOrNone�OneOf�isStringOrNone�isNumberOrNoner�r��
SequenceOfr�r�rirRrrYr\r�r�r]r�r�r�r?r?r?r@r�8sD





����

		

|r�c@�eZdZdZddd�ZdS)rIz<This is a mixin to provide functionality for edited drawingsNcCs�t|�}|r&t|d�r&d|jvr|j��|_|r|durt}t||�|j|<t|d�r@|r@|r8|�|||�dS|�||�dS|rJt|||�dSt	d��)zb
        effectively setattr(obj,name,value), but takes care of things with _attrMaps etc
        r�Nr�zCan't add, need name)
r�rWr�r�r�r�r�r�re�
ValueError)r[r�rhr�r�r�r��ivcr?r?r@�_addPs
z_DrawingEditorMixin._add�NNNN)r^r_r`rar�r?r?r?r@rIN�rIc@seZdZdd�ZdS)�isStrokeDashArraycCs0t�|�pt|ttf�ot|d�ot|d�S)Nrr)�isListOfNumbersOrNone�testr�r��tupler��isListOfNumbers)r[rFr?r?r@r�es0zisStrokeDashArray.testN)r^r_r`r�r?r?r?r@r�dsr�c@s�eZdZeee�ee�eeddd�dd�eeddd�dd�eedd�eedd�ee	d	d�ee
d
d�ee
ddd�d
�	Zdd�ZdS)�	LineShaperrrwz#Line cap 0=butt, 1=round & 2=squarer�z$Line join 0=miter, 1=round & 2=bevelz$miter limit control miter line joinsz[numbers] or [phase,[numbers]]zEThe level of transparency of the line, any real number betwen 0 and 1r�r�r�)	rrrrrr!r"r%r&cCs<td|_d|_d|_d|_d|_d|_d|_|�|�dS)Nrrr)	�STATE_DEFAULTSrrrrrr!r"r��r[r"r?r?r@rixs
zLineShape.__init__N)
r^r_r`r�r��
isColorOrNoner�r�r��	isOpacityrr�rir?r?r?r@r�is



�r�c	@sNeZdZeeeedd�eedd�eedd�eedd�d�Zdd�Zdd�Z	dS)	�Liner�r�)rCrqrrrsrtcK�(t�||�||_||_||_||_dSrj)r�rirqrrrsrt)r[rqrrrsrtr"r?r?r@ri��

z
Line.__init__cCs|j|j|j|jfS)r�)rqrrrsrtr�r?r?r@r��szLine.getBoundsN)
r^r_r`r�r�r�r�r�rir�r?r?r?r@r��s



�r�c
@sTeZdZeeeedd�eedd�eedd�eeddd�ee	e
e��d�Zd	d
�Z
dS)�
SolidShapez$filling color of the shape, e.g. redr�zGthe level of transparency of the color, any real number between 0 and 1r�r�rr�)rCr'r#r$r&r(cCs td|_d|_t�||�dS)Nr')r�r'r#r�rir�r?r?r@ri�s
zSolidShape.__init__N)r^r_r`r�r�r�r�r�rr�rrr�rir?r?r?r@r��s


�r�rx)rwrw�r)�moveTo�lineTo�curveTo�	closePathc
Cs�|j}d}d}d}|}|jD];}	|	tkr,|r(|r(|
tkr(|d7}|r(|t�|d7}t|	}||}||	|||��|}|	tkrH|d7}|	}
q|r^|r^|
tkr^|d7}|r^|t�||kS)zHelper function for renderers.rr)r��	operators�_MOVETO�
_CLOSEPATH�_PATH_OP_ARG_COUNT)
r��	drawFuncs�	countOnly�
forceCloser�r��hadClosePath�	hadMoveTo�active�opr��nArgs�jr?r?r@�_renderPath�s2


r�znon-zero�nonzerozeven-odd�evenoddc
@s�eZdZdZeeee�ee�ee�ee	e
dd���ee
ee��d�Z
ddddefdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�ZdS)�Pathz2Path, made up of straight lines and bezier curves.r-r+)rCr�r��
isClipPath�	autocloser(NrcKs^t�||�|durg}|durg}t|�ddksJd��||_||_||_||_||_dS�Nrwr�-Point list must have even number of elements!)r�rir4r�r�r�rr()r[r�r�r�rr(r"r?r?r@ri�s
z
Path.__init__cCs2|�|jdd�|jdd��}|�|���|Srj)r�r�r�r�r��r[�newr?r?r@r��s z	Path.copycC� |j�||g�|j�t�dSrj)r�r�r�ryr�r�r?r?r@r���zPath.moveTocCrrj)r�r�r�ry�_LINETOr�r?r?r@r��rzPath.lineTocCs(|j�||||||g�|j�t�dSrj)r�r�r�ry�_CURVETO)r[rqrrrsrt�x3r{r?r?r@r��szPath.curveTocCs|j�t�dSrj)r�ryr�r�r?r?r@r��szPath.closePathcCs|j}ztg}|j}|j}g}|j}|j}d}|jD]O}	t|	}
||
}|
dkr6|||�|||d�n0|
dkrf|||d�\}}
}|t|d||
|��||d|d�\}}}|t|d|||��|}qt|�t|�t|�t|�fWSt|�YS)Nrrwrr�r/)	r�ryr�r�r�r�rLr3r�)r[r�rP�aX�eXrQ�aY�eYr�r�r�r�rqrsr	rrrtr{r?r?r@r��s0
zPath.getBounds)r^r_r`rar�r�r�r�r�NoneOrr�rrr�rir�r�r�r�r�r�r?r?r?r@r��s �
r�cCs�|dur|}g}td}	||	}
||	}||
kr"|dt}||
kst||
�}|j}
|dkrNt||p4d�}||	}tt||d�d�}||}|d7}nd}d}t|�D]}|
||}|
||t|�||t|�f�qV|rw|�	�|S)N��f@rw���MbP?rG��?rr)
rrryrLr3r�r�rr�reverse)�centerx�centery�radius�startangledegrees�endangledegrees�yradius�degreedeltarr��degreestoradians�
startangle�endanglerNr|�radiansdeltar.r?r?r@�getArcPointss.�
&rc@r�)�ArcPathzPath with an addArc methodNc


Csft||||||||	d�}
|st|j�s$|�|
dd|
dd�|
d=|
D]
\}}|�||�q&dS)N)rrrrr)rr4r�r�r�)
r[rrrrrrrr�rr�rFrMr?r?r@�addArc:s
zArcPath.addArcr�)r^r_r`rar r?r?r?r@r8r�rcKs>g}g}|D]B}t|�s|}g}	n
|d}|dd�}	|tvr%td|��t�|�}
t|	�t|
kr<td|t|	�f��|�|
�|�t	|	��q|df|dffD]\}}t
|t|�d�D]
}
||
|||
<q]qQ|�dd�}|�rdD]�}||||df}|ddur�|ddur�qt||dd�}t|�t
|�}}|ddur�|ddur�t|�t
|�}}||}t|�dkr�|||}t
|t|�d�D]}
||||
|||
<q�qtt
|t|�d�D]
}
||d	||
<q�qt|ddur�|d|n|d|}t
|t|�d�D]}
||
|7<�qqtt|||fi|��S)
Nrrzbad operator name %sz%s bad arguments %srw�bbox)rrg���ư>r)r�_PATH_OP_NAMESr�r�r4r�rOryr�r�r�r�rLr3�absr�)�pathSegsr�r�r�r"�Or��seg�opNamerr�rrQr�r!r�r|r}r~�facr?r?r@�
definePathAsT

���$�r)c	@s`eZdZdZeeee�ee�eedd�eedd�ee�ee�d�Zddd�Z	d	d
�Z
dd�Zd
S)�Rectz)Rectangle, possibly with rounded corners.�width of the object in pointsr��height of the objects in points)rCrFrMrYrZ�rx�ryrcKs4t�||�||_||_||_||_||_||_dSrj)r�rirFrMrYrZr-r.)r[rFrMrYrZr-r.r"r?r?r@ris
z
Rect.__init__cC�*|�|j|j|j|j�}|�|���|Srj)r�rFrMrYrZr�r�rr?r?r@r���z	Rect.copycC� |j|j|j|j|j|jfSrj�rFrMrYrZr�r?r?r@r��s zRect.getBoundsN)rr)r^r_r`rar�r�r�r�r�rir�r�r?r?r?r@r*ss

�
		r*c	@sXeZdZdZeeee�ee�eedd�eedd�ed�d�Z	dd�Z
d	d
�Zdd�ZdS)
�Imagez
Bitmap image.r+r�r,N)rCrFrMrYrZr�cKs.t�||�||_||_||_||_||_dSrj)r�rirFrMrYrZr�)r[rFrMrYrZr�r"r?r?r@ri�s
zImage.__init__cC�.|�|j|j|j|j|j�}|�|���|Srj)r�rFrMrYrZr�r�r�rr?r?r@r��sz
Image.copycCr1rjr2r�r?r?r@r��r�zImage.getBounds)
r^r_r`rar�r�r�r�r�r�rir�r�r?r?r?r@r3�s

�r3c@sLeZdZeeeedd�eedd�eedd�d�Zdd�Zdd	�Z	d
d�Z
dS)
�Circle�x of the centrer��y of the centre�radius in points)rC�cx�cy�rcKs"t�||�||_||_||_dSrj)r�rir9r:r;)r[r9r:r;r"r?r?r@ri�s
zCircle.__init__cC�&|�|j|j|j�}|�|���|Srj)r�r9r:r;r�r�rr?r?r@r���zCircle.copycCs,|j|j|j|j|j|j|j|jfSrj)r9r;r:r�r?r?r@r���,zCircle.getBoundsN�r^r_r`r�r�r�r�r�rir�r�r?r?r?r@r5�s


�r5c	@sVeZdZeeeedd�eedd�eedd�eedd�d�Zdd�Zd	d
�Z	dd�Z
d
S)�Ellipser6r�r7zx radiuszy radius)rCr9r:r-r.cKr�rj)r�rir9r:r-r.)r[r9r:r-r.r"r?r?r@ri�r�zEllipse.__init__cCr/rj)r�r9r:r-r.r�r�rr?r?r@r��r0zEllipse.copycCs,|j|j|j|j|j|j|j|jfSrj)r9r-r:r.r�r?r?r@r��r>zEllipse.getBoundsNr?r?r?r?r@r@�s



�r@c@s�eZdZdZeeeedd�eedd�eedd�ee�ee�ee�ee�ee�ee	dd�d�
Z
dZ			
ddd�Zd
d�Z
dd�Zdd�Zdd�Zd	S)�WedgeznA "slice of a pie" by default translates to a polygon moves anticlockwise
       from start angle to end angler6r�r7r8ztreat as annular ring)
rCrrrrrr�radius1�yradius1�annularrNFc	KsVt�||�||kr|d}||ks
|||||f\|_|_|_|_|_||_||_dS)Nih)	r�rirrrrrrrD)	r[rrrrrrrDr"r?r?r@ri�s��
zWedge.__init__cCsHt|dd�}|dur
|j}t|dd�}t|d|�}|dur|}|||fS)NrrBrC)r�r)r[rrBrCr?r?r@�
_xtraRadii�s
zWedge._xtraRadiicCsd|j}|j}|j}|��\}}}|j}|j}td}	||	}
||	}||
kr0|dt}||
ks&t||
�}g}
|dkr\t|j	pAd|�}||	}t
dt||d��}||}|d7}nd}d}g}|j}|
j}t
|�D]}|
||}|t|�t|�f�ql|D]\}}||||�||||�q�|dks�|dur�|dks�|dur�||�||�n|��|D]\}}||||�||||�q�|j�r.tt|dt�d	�}|�|
d|
d�t
dd|d�D]}|�|
||
|d�q�|��|�|
d||
d|d�t
d|dd
|d�D]}|�|
||
|d��q|��|St|
�S)NrrwrrGrrrr()r(rx)rrrrErrrrrLrr3r�ryr�rrrrDr�r�rr�r�r��Polygon)r[rrrrrBrCrrrrrrNr�rrr.�CA�CAAr|r~r-r�rFr?r?r@�	asPolygonsb�
  zWedge.asPolygoncCr4rj)r�rrrrrr�r�rr?r?r@r�8s�z
Wedge.copycCs|����Srj)rIr�r�r?r?r@r�AszWedge.getBounds)NF)r^r_r`rar�r�r�r�r�rr�rrirErIr�r�r?r?r?r@rA�s*



�
�6	rAc@�@eZdZdZeeeedd�d�Zgfdd�Z	dd�Z
d	d
�ZdS)rFzKDefines a closed shape; Is implicitly
    joined back to the start for you.�5list of numbers in the form x1, y1, x2, y2 ... xn, ynr��rCr�cKs2t�||�t|�ddksJd��|pg|_dSr)r�rir4r�)r[r�r"r?r?r@riLszPolygon.__init__cC�|�|j�}|�|���|Srj�r�r�r�r�rr?r?r@r�Q�zPolygon.copycC�
t|j�Srj�r�r�r�r?r?r@r�V�
zPolygon.getBoundsN)r^r_r`rar�r�r�r�r�rir�r�r?r?r?r@rFDs
�rFc@rJ)�PolyLinez�Series of line segments.  Does not define a
    closed shape; never filled even if apparently joined.
    Put the numbers in the list, not two-tuples.rKr�rLcKszt�||�|p	g}t|�}|r8t|d�r,g}|D]\}}|�|�|�|�q|}nt|�ddks8Jd��||_dS)Nrrwr)r�rir4rryr�)r[r�r"�	lenPointsrlrFrMr?r?r@ribs

zPolyLine.__init__cCrMrjrNrr?r?r@r�qrOz
PolyLine.copycCrPrjrQr�r?r?r@r�vrRzPolyLine.getBoundsN)r^r_r`rar�r�r�r�r�rir�r�r?r?r?r@rSYs
�rSc	@sneZdZdZeeeeee	edd�fd�dd�eee
edf�dd�eee
ed	f�d
d�d�Zdd
gfdd�ZdS)�Hatchingz\define a hatching of a set of polygons defined by lists of the form [x0,y0,x1,y1,....,xn,yn]r)rAz
xy list(s)z8list(s) of numbers in the form x1, y1, x2, y2 ... xn, ynr�zangle(s)zCthe angle or list of angles at which hatching lines should be drawnzspacings(s)z-orthogonal distance(s) between hatching lines)rC�xyLists�angles�spacingsrw�-c
Ks�tj|fi|��t|�r|f}t|�r|f}t|�r|f}t|�t|�}|dkr5t|�||dg}||_||_||_|j	}|j
}t|�D�]\}}||}	t|�}t
|�}
t|�}d}|}
|D]%}tdt|�d�D]}||d|
|||}t||�}t||
�}
qnqdtt||	��d}tt|
|	��d}t||�D]�}g}|	|}|D]m}t|�d}tdt|�d�D]\}||}||d}||
||}||
||}||}||d}||
||}||
||}||kr�||k�s||k�r||k�r|�|||||||�|}q�q�|��tdt|�d�D]9}|||
||}||
|||}||d|
||}||
||d|}|||�|||��q'q�qHdS)Nrr/i���rwr)r�rir�r�r4r�rVrWrXr�r��	enumeraterrrr�rLr3r�rryr�)r[rXrWrV�kwdsr�r�r�r��spacing�cosTheta�sinTheta�spanMin�spanMaxr�r�rM�	spanStart�spanEnd�step�nodeX�stripeYr�r|r}�a1�b1rFrqrrr?r?r@ri�sv
�&"�
���zHatching.__init__N)
r^r_r`rar�r�r��EitherOrr�r�r�r�rir?r?r?r@rUys�rUc
CsHt|d|�}|�|�}|dkr"t|dd�}	|	t|d|�|||�}|S)N�_dpr�_dpLen)r��rfindr)
�tAr5r2r*r)�encoding�pivotCharacter�dpr��dpOffsr?r?r@�
numericXShift�s
rqc@s�eZdZdZeeedd�eedd�eedd�eddd�eedd�eed	d�ee	d
ddd
�dd�ee�ee	dddddddd�dd�d�	Z
dZdd�Zdd�Z
dd�Zd d!�ZdS)"�StringziNot checked against the spec, just a way to make something work.
    Can be anchored left, middle or end.zx point of anchoringr�zy point of anchoringzthe text of the stringNz_font name of the text - font is either acrobat standard or registered when using external font.z	font sizezcolor of the fontr,�middler1�numericz(treat (x,y) as one of the options below.rrrwrvrx�r��z.Control whether text is filled/stroked etc etc)	rFrMr5r*r)r'r+rm�textRenderMode�utf8cKsD||_||_||_d|_td|_td|_td|_|�|�dS)Nr,r*r)r')	rFrMr5r+r�r*r)r'r�)r[rFrMr5r"r?r?r@ri�s


zString.__init__cCs|jt|j|j|j|j�Srj)rFrr5r*r)rmr�r?r?r@�getEast�szString.getEastcCr<rj)r�rFrMr5r�r�rr?r?r@r��r=zString.copycCs�|j}t||j|j|j�}|j}|j}|dkr=|dkr"|d|8}n|dkr+||8}n|dkr=|t||||j|j|j�8}||jd|j|||j|jfS)Nr,rsrr1rtg�������?)	r5rr*r)rmr+rFrqrM)r[r9r2rlrFr?r?r@r��s
$zString.getBounds)r^r_r`rar�r�r��isStringr�r�r�rmriryr�r�r?r?r?r@rr�s$





�
rrc@rS)r�akA simple template for creating a new node.  The user (Python
    programmer) may subclasses this.  provideNode() must be defined to
    provide a Shape primitive when called by a renderer.  It does
    NOT inherit from Shape, as the renderer always replaces it, and
    your own classes can safely inherit from it without getting
    lots of unintended behaviour.cCr�)z�Override this to create your own node. This lets widgets be
        added to drawings; they must create a shape (typically a group)
        so that the renderer can draw the custom node.�4this method must be redefined by the user/programmerr�r�r?r?r@r�szUserNode.provideNodeN)r^r_r`rar�r?r?r?r@r�sr�c@rS)�
DirectDrawz"try to draw directly on the canvascCr�)Nr{r�)r[r\r?r?r@�drawDirectlyszDirectDraw.drawDirectlyN)r^r_r`rar}r?r?r?r@r|rbr|cCsptdddd�}ddl}|j}tjj}|d�||���|d�|��|d�|d�|`|d	�|��dS)
Nr rF�2rz
a Rectangle: z
verifying...z OK
zdeleting rect.width zverifying...)r*�pprintr��stdoutr�r�r�rY)r;r�ppr2r?r?r@r� sr��__main__rj)rr)FF)NNN)b�__version__rar�r��mathrrrrrr�reportlab.platypusr�reportlab.rl_configr	r
r�_baseGFontNamerr
�
reportlab.librr�reportlab.lib.validators�reportlab.lib.utilsrrr�isNumberInRanger��reportlab.lib.attrmap�reportlab.lib.rl_accelr�reportlab.pdfbase.pdfmetricsr�reportlab.lib.fontsr�reportlab.pdfgen.canvasrr�_baseGFontNameB�_baseGFontNameI�_baseGFontNameBI�NON_ZERO_WINDING�EVEN_ODD�blackr�rrArRrTrcrur�r�r�r�r�rrrr#r�rI�	Validatorr�r�r�r�r�r�r�rrr�r�r"r��_fillModeMapr�r
rrr)r*r3r5r@rArFrSrUrqrrr�r|r�r^r?r?r?r@�<module>s� 	������	�
���
�������"

5M
>

'	
�
H
	2k X3

�

Youez - 2016 - github.com/yon3zu
LinuXploit