Ñò
ÀsUHc           @   s  d  Z  d d k Z d d k Z d d k Z d d k Z d „  Z d „  Z e i d ƒ Z e i d ƒ Z	 d „  Z
 d d d	 „  ƒ  YZ d
 „  Z d e i f d „  ƒ  YZ d d „ Z e i e i e e ƒ e i e i e ƒ e i e i d ƒ e i e i d ƒ e i e i d ƒ d S(   s   0.5iÿÿÿÿNc         C   sD   t  |  d ƒ t  |  d ƒ d >t  |  d ƒ d >t  |  d ƒ d >S(   Ni    i   i   i   i   i   i   (   t   ord(   t   c(    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   i32   s    c         C   sD   t  |  d @ƒ t  |  d ?d @ƒ t  |  d ?d @ƒ t  |  d ?d @ƒ S(   Niÿ   i   i   i   (   t   chr(   t   i(    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   o32    s    s   ^%%([^:]*):[ \t]*(.*)[ \t]*$s   ^%[%!\w]([^:]*)[ \t]*$c         C   s‹  |  d \ } }  } } | \ } } d d k  } d d k }	 | i ƒ  }
 d d d | d d d	 |
 d
 g } t i | ƒ } zð |	 i | d ƒ } | d d j p | d d j o% | i d | d | d f ƒ n | i | ƒ xJ | d j o< | i d ƒ } | p Pn | t	 | ƒ } | i | ƒ qä W| i
 ƒ  } | o t d | ƒ ‚ n t i i |
 ƒ } Wd y |	 i |
 ƒ Wn n XX| S(   s-   Render an image using Ghostscript (Unix only)i    iÿÿÿÿNt   gss   -qs   -g%dx%ds   -dNOPAUSE -dSAFERs   -sDEVICE=ppmraws   -sOutputFile=%ss   - >/dev/null 2>/dev/nullt   wi   s   %d %d translate
i    s   gs failed (status %d)(   t   tempfilet   ost   mktempt   stringt   joint   popent   writet   seekt   readt   lent   closet   IOErrort   Imaget   coret   open_ppmt   unlink(   t   tilet   sizet   fpt   decodert   offsett   datat   lengtht   bboxR   R	   t   filet   commandR   t   st   statust   im(    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   Ghostscript&   sB    	"%   t   PSFilec           B   s>   e  Z d  Z d „  Z d „  Z d d „ Z d „  Z d „  Z RS(   s3   Wrapper that treats either CR or LF as end of line.c         C   s   | |  _  d  |  _ d  S(   N(   R   t   Nonet   char(   t   selfR   (    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   __init__V   s    	c         C   s&   t  |  i | ƒ } t |  | | ƒ | S(   N(   t   getattrR   t   setattr(   R)   t   idt   v(    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   __getattr__Y   s    i    c         C   s    d  |  _ |  i i | | ƒ d  S(   N(   R'   R(   R   R   (   R)   R   t   whence(    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyR   ]   s    	c         C   s+   |  i  i ƒ  } |  i o | d } n | S(   Ni   (   R   t   tellR(   (   R)   t   pos(    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyR1   `   s    
c         C   s´   d } |  i  o |  i  } d  |  _  n |  i i d ƒ } x. | d j o  | | } |  i i d ƒ } q; W| d j o6 |  i i d ƒ |  _  |  i  d j o d  |  _  q¬ n | d S(   Nt    i   s   
s   s   
(   R(   R'   R   R   (   R)   R"   R   (    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   readlinee   s    
	 
(   t   __name__t
   __module__t   __doc__R*   R/   R   R1   R4   (    (    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyR&   T   s   			c         C   s!   |  d  d j p t  |  ƒ d j S(   Ni   s   %!PSl   ÅP§ (   R   (   t   prefix(    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   _acceptv   s    t   EpsImageFilec           B   s,   e  Z d  Z d Z d Z d „  Z d „  Z RS(   s.   EPS File Parser for the Python Imaging Libraryt   EPSs   Encapsulated Postscriptc         C   s3  t  |  i ƒ } | i d ƒ } | d  d j o& d } | i d d ƒ | i ƒ  } nN t | ƒ d j o1 t | d ƒ } t | d ƒ } | i | ƒ n
 t d ‚ | i | ƒ d  } d	 |  _ d# |  _	 | i
 ƒ  } xú| oòt | ƒ d j o t d ‚ n | d d j o | d  } n  | d d j o | d  } n y t i | ƒ } Wn! t i j
 o } t d ‚ n X| oµ | i d
 d ƒ \ } } | |  i | <| d j o yq t t t t t i | ƒ ƒ ƒ } | d | d | d | d
 f |  _	 d d$ |  i	 | | | f f g |  _ Wq*q*Xq©n| t i | ƒ } | o\ | i d
 ƒ } | d j o Pn | d  d j o | d |  i | d  <q©d |  i | <n
 t d ‚ | i
 ƒ  } | d
  d j o PqÖ qÖ WxH| d d j o6t | ƒ d j o t d ‚ n | d d j o | d  } n  | d d j o | d  } n | d  d j o«t i | d d d ƒ\ }	 }
 } } } } } } t |	 ƒ }	 t |
 ƒ }
 t | ƒ } t | ƒ } t | ƒ } | d
 j o
 d } n | d j o
 d } n P| d j o Pn | d
 j o d |  _ n6 | d j o d  |  _ n | d j o d	 |  _ n P| d
  | d j o
 d! j n o | d
 d !} n xt | i
 ƒ  } | p Pn | t | ƒ  | j o> |	 |
 f |  _	 | d d |	 |
 f | i ƒ  d f g |  _ d  SqŠn | i
 ƒ  } | p PqÓqÓW| p t d" ‚ n d  S(%   Ni   i   s   %!PSi    i   l   ÅP§ i   s   not an EPS filet   RGBi   iÿ   iþÿÿÿs   
iÿÿÿÿs   
t   BoundingBoxi   t   epst   EndCommentss   PS-Adobei	   R3   s   bad EPS headert   %i   s   %ImageData:t   maxspliti   t
   eps_binaryt   eps_hext   Lt   LABt   "s!   cannot determine EPS bounding box(   i   i   (   i    i    (   R&   R   R   R   R1   R   t   SyntaxErrorR'   t   modeR   R4   R   t   splitt   matcht   ret   errort   groupt   infot   mapt   intt   floatR   R   t   fieldR   t   tile2(   R)   R   R"   R   R   t   boxt   mR.   t   kt   xt   yt   bit   mot   z3t   z4t   enR-   R   (    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   _openƒ   sÄ    			 !'	
 1 

&	
c         C   sX   |  i  p d  St |  i  |  i |  i ƒ |  _ |  i i |  _ |  i i |  _ g  |  _  d  S(   N(   R   R%   R   R   R$   RH   (   R)   (    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   load  s    
(   R5   R6   R7   t   formatt   format_descriptionR^   R_   (    (    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyR:   }   s
   	”i   c         C   sê  |  i  ƒ  |  i d j o
 d" } n> |  i d j o
 d# } n$ |  i d j o
 d$ } n
 t d ‚ | o~ | i d ƒ | i d ƒ | i d |  i ƒ | i d ƒ | i d ƒ | i d ƒ | i d |  i ƒ | i d | ƒ n | i d ƒ | i d ƒ | i d |  i d | d ƒ | i d |  i ƒ | i d |  i ƒ | i d |  i d |  i d |  i d f ƒ | i d ƒ | i d | d ƒ t i |  | d d% |  i d d! f g ƒ | i d ƒ | i d  ƒ | i ƒ  d! S(&   s*   EPS Writer for the Python Imaging Library.RD   i   i   t   imageR<   i   s   false 3 colorimaget   CMYKi   s   false 4 colorimages   image mode is not supporteds   %!PS-Adobe-3.0 EPSF-3.0
s   %%Creator: PIL 0.1 EpsEncode
s   %%%%BoundingBox: 0 0 %d %d
s   %%Pages: 1
s   %%EndComments
s   %%Page: 1 1
s   %%ImageData: %d %d s   %d %d 0 1 1 "%s"
s   gsave
s   10 dict begin
s   /buf %d string def
i    s   %d %d scale
s   %d %d 8
s   [%d 0 0 -%d 0 %d]
s+   { currentfile buf readhexstring pop } bind
s   %s
i   R>   s   
%%%%EndBinary
s   grestore end
N(   i   i   s   image(   i   i   s   false 3 colorimage(   i   i   s   false 4 colorimage(   i    i    (	   R_   RH   t
   ValueErrorR   R   t	   ImageFilet   _saveR'   t   flush(   R$   R   t   filenameR>   t   operator(    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyRf   #  s:    



	 /)s   .pss   .epss   application/postscript(    (   t   __version__RK   R   R   Re   R   R   t   compileRI   RR   R%   R&   R9   R:   Rf   t   register_openR`   t   register_savet   register_extensiont   register_mime(    (    (    sB   P:\graphics\Tools\python26\lib\site-packages\PIL\EpsImagePlugin.pyt   <module>   s    			."	¦3