ó
P­\Jc           @   sA   d  d l  Z  d  d l Z d d d „  ƒ  YZ d Z d Z d Z d S(   iÿÿÿÿNt   PSDrawc           B   sb   e  Z d	 d  „ Z d	 d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 d „ Z RS(
   c         C   s+   | s d d  l  } | j } n  | |  _ d  S(   Niÿÿÿÿ(   t   syst   stdoutt   fp(   t   selfR   R   (    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyt   __init__   s    c         C   sM   |  j  j d ƒ |  j  j t ƒ |  j  j t ƒ |  j  j d ƒ i  |  _ d S(   s   Write Postscript DSC headersD   %!PS-Adobe-3.0
save
/showpage { } def
%%EndComments
%%BeginDocument
s   %%EndProlog
N(   R   t   writet	   EDROFF_PSt   VDI_PSt   isofont(   R   t   id(    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyt   begin_document    s
    c         C   s6   |  j  j d ƒ t |  j  d ƒ r2 |  j  j ƒ  n  d S(   s   Write Postscript DSC footers%   %%EndDocument
restore showpage
%%End
t   flushN(   R   R   t   hasattrR   (   R   (    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyt   end_document.   s    c         C   sZ   |  j  j | ƒ s< |  j j d | | f ƒ d |  j  | <n  |  j j d | | f ƒ d  S(   Ns#   /PSDraw-%s ISOLatin1Encoding /%s E
i   s   /F0 %d /PSDraw-%s F
(   R	   t   has_keyR   R   (   R   t   fontt   size(    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyt   setfont6   s
    c         C   s	   d GHd  S(   Ns   *** NOT YET IMPLEMENTED ***(    (   R   t   ink(    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyt   setink?   s    c         C   s"   | | } |  j  j d | ƒ d  S(   Ns   %d %d %d %d Vl
(   R   R   (   R   t   xy0t   xy1t   xy(    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyt   lineB   s    
c         C   s   |  j  j d | ƒ d  S(   Ns   %d %d M %d %d 0 Vr
(   R   R   (   R   t   box(    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyt	   rectangleF   s    c         C   sa   t  j t  j | d ƒ d ƒ } t  j t  j | d ƒ d ƒ } | | f } |  j j d | ƒ d  S(   Nt   (s   \(t   )s   \)s   %d %d M (%s) S
(   t   stringt
   joinfieldst   splitfieldsR   R   (   R   R   t   text(    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyR    I   s    c         C   sš  | s' | j  d k r d } q' d } n  t | j d d ƒ | } t | j d d ƒ | } t | d | d ƒ } t | d | d ƒ } | | k r° | | | } | } n  | | k rÓ | | | } | } n  | | d | d } | | d | d }	 |  j j d	 | |	 f ƒ | | f | j k rm| | j d }
 | | j d } |  j j d
 |
 | f ƒ n  t j | |  j d d ƒ |  j j d ƒ d S(   s   Write an PIL imaget   1iÈ   id   i    iH   i   i   i   s   gsave
%f %f translate
s   %f %f scale
s
   
grestore
N(   t   modet   floatR   R   R   t   EpsImagePlugint   _savet   None(   R   R   t   imt   dpit   xt   yt   xmaxt   ymaxt   dxt   dyt   sxt   sy(    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyt   imageO   s.    		 	 	N(   t   __name__t
   __module__R&   R   R   R   R   R   R   R   R    R1   (    (    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyR       s   							s×  /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
sñ  /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
sã  /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
(    (   R$   R   R    R   R   t   ERROR_PS(    (    (    s+   C:\Python27\Lib\site-packages\PIL\PSDraw.pyt   <module>   s
   r"