Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/site-packages/PIL/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/site-packages/PIL/__pycache__/PSDraw.cpython-35.pyc



�ʴW��@sHddlmZddlZGdd�de�ZdZdZdZdS)�)�EpsImagePluginNc@s�eZdZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zddd�ZdS)�PSDrawzk
    Sets up printing to the given file. If **file** is omitted,
    :py:attr:`sys.stdout` is assumed.
    NcCs|stj}||_dS)N)�sys�stdout�fp)�selfr�r�=/opt/alt/python35/lib64/python3.5/site-packages/PIL/PSDraw.py�__init__s	zPSDraw.__init__cCsNttks|jtjkr1|jj|�n|jjt|d��dS)NzUTF-8)�bytes�strrrr�write)rZto_writerrr	�	_fp_write$szPSDraw._fp_writecCsA|jd�|jt�|jt�|jd�i|_dS)z=Set up printing of a document. (Write Postscript DSC header.)zD%!PS-Adobe-3.0
save
/showpage { } def
%%EndComments
%%BeginDocument
z%%EndProlog
N)r�	EDROFF_PS�VDI_PS�isofont)r�idrrr	�begin_document*s




zPSDraw.begin_documentcCs0|jd�t|jd�r,|jj�dS)z-Ends printing. (Write Postscript DSC footer.)z%%%EndDocument
restore showpage
%%End
�flushN)r�hasattrrr)rrrr	�end_document8s
zPSDraw.end_documentcCsN||jkr3|jd||f�d|j|<|jd||f�dS)z~
        Selects which font to use.

        :param font: A Postscript font name
        :param size: Size in points.
        z#/PSDraw-%s ISOLatin1Encoding /%s E
�z/F0 %d /PSDraw-%s F
N)rr)rZfont�sizerrr	�setfont@s
	
zPSDraw.setfontcCs||}|jd|�dS)z�
        Draws a line between the two points. Coordinates are given in
        Postscript point coordinates (72 points per inch, (0, 0) is the lower
        left corner of the page).
        z%d %d %d %d Vl
N)r)rZxy0Zxy1�xyrrr	�lineOs
zPSDraw.linecCs|jd|�dS)a8
        Draws a rectangle.

        :param box: A 4-tuple of integers whose order and function is currently
                    undocumented.

                    Hint: the tuple is passed into this format string:

                    .. code-block:: python

                        %d %d M %d %d 0 Vr

        z%d %d M %d %d 0 Vr
N)r)r�boxrrr	�	rectangleXs
zPSDraw.rectanglecCsRdj|jd��}dj|jd��}||f}|jd|�dS)z�
        Draws text at the given position. You must use
        :py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method.
        z\(�(z\)�)z%d %d M (%s) S
N)�join�splitr)rr�textrrr	r"gs
zPSDraw.textcCs�|s$|jdkrd}nd}t|jdd�|}t|jdd�|}t|d|d�}t|d|d�}||kr�|||}|}||kr�|||}|}||d|d}||d|d}	|jd	||	f�||f|jkr[||jd}
||jd}|jd
|
|f�tj||jdd�|jd�dS)
z,Draw a PIL image, centered in the given box.�1���dr�Hr��zgsave
%f %f translate
z%f %f scale
Nz

grestore
)�mode�floatrrrZ_saver)rrZimZdpi�x�yZxmaxZymaxZdxZdyZsxZsyrrr	�imageqs.	zPSDraw.image)
�__name__�
__module__�__qualname__�__doc__r
rrrrrrr"r-rrrr	rs	
ra�/S { show } bind def
/P { moveto show } bind def
/M { moveto } bind def
/X { 0 rmoveto } bind def
/Y { 0 exch rmoveto } bind def
/E {    findfont
        dup maxlength dict begin
        {
                1 index /FID ne { def } { pop pop } ifelse
        } forall
        /Encoding exch def
        dup /FontName exch def
        currentdict end definefont pop
} bind def
/F {    findfont exch scalefont dup setfont
        [ exch /setfont cvx ] cvx bind def
} bind def
a�/Vm { moveto } bind def
/Va { newpath arcn stroke } bind def
/Vl { moveto lineto stroke } bind def
/Vc { newpath 0 360 arc closepath } bind def
/Vr {   exch dup 0 rlineto
        exch dup neg 0 exch rlineto
        exch neg 0 rlineto
        0 exch rlineto
        100 div setgray fill 0 setgray } bind def
/Tm matrix def
/Ve {   Tm currentmatrix pop
        translate scale newpath 0 0 .5 0 360 arc closepath
        Tm setmatrix
} bind def
/Vf { currentgray exch setgray fill setgray } bind def
a�/landscape false def
/errorBUF 200 string def
/errorNL { currentpoint 10 sub exch pop 72 exch moveto } def
errordict begin /handleerror {
    initmatrix /Courier findfont 10 scalefont setfont
    newpath 72 720 moveto $error begin /newerror false def
    (PostScript Error) show errorNL errorNL
    (Error: ) show
        /errorname load errorBUF cvs show errorNL errorNL
    (Command: ) show
        /command load dup type /stringtype ne { errorBUF cvs } if show
        errorNL errorNL
    (VMstatus: ) show
        vmstatus errorBUF cvs show ( bytes available, ) show
        errorBUF cvs show ( bytes used at level ) show
        errorBUF cvs show errorNL errorNL
    (Operand stargck: ) show errorNL /ostargck load {
        dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL
    } forall errorNL
    (Execution stargck: ) show errorNL /estargck load {
        dup type /stringtype ne { errorBUF cvs } if 72 0 rmoveto show errorNL
    } forall
    end showpage
} def end
)ZPILrr�objectrrrZERROR_PSrrrr	�<module>s
�"