Ñò
…n+Oc           @   sÁ   d  Z  d d k Z d d k Z d d k Z d d k l Z l Z l Z l Z d Z	 d e f d „  ƒ  YZ
 d „  Z d e i f d	 „  ƒ  YZ e i d
 e e ƒ e i d
 d ƒ e i d
 d ƒ d S(   s   0.4iÿÿÿÿN(   t   i16t   i32t   ChunkStreamt   _MODESs   ŠARG

t	   ArgStreamc           B   s×   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d d	 „ Z
 d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s   Parser callbacks for ARG datac         C   s9   t  i |  | ƒ d |  _ d  |  _ d  |  _ |  i ƒ  d  S(   Ni    (   R   t   __init__t   eoft   Nonet   imt   palettet   _ArgStream__reset(   t   selft   fp(    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyR   #   s
    			c         C   s1   d |  _  d  |  _ d |  _ h  |  _ h  |  _ d  S(   Ni    t   NONE(   R   (   t   countR   t   idt   actiont   imagest   names(   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt   __reset.   s
    				c      	   C   sÆ   |  i  d j o t d ‚ n |  i i | ƒ } t | ƒ t | d ƒ f |  _ y4 t t | d ƒ t | d ƒ f \ |  _ |  _	 Wn t d ‚ n Xt
 i o# d G|  i GHd G|  i G|  i	 GHn | S(	   s   AHDR -- animation headeri    s   misplaced AHDR chunki   i   i	   s   unknown ARG modes	   AHDR sizes	   AHDR mode(   R   t   SyntaxErrorR   t   readR   t   sizeR   t   ordt   modet   rawmodet   Imaget   DEBUG(   R   t   offsett   bytest   s(    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_AHDR:   s    4
c         C   s  |  i  d j o t d ‚ n d |  _ d |  _ d |  _  d |  _ |  i i | ƒ } t | ƒ d j ov t	 | ƒ |  _ t | ƒ d j oP t	 | d d !ƒ |  _  t | ƒ d j o t	 | d d !ƒ |  _ qØ d |  _ qÜ n t
 i o d G|  i G|  i  GHn | S(	   s   AFRM -- next frame followsi    s   misplaced AFRM chunki   i   i   i   t   AFRMN(   R   R   t   showR   R   t   repairR   R   t   lenR    R   R   (   R   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_AFRMN   s"    				
c         C   sË   |  i  d j o t d ‚ n d |  _ d |  _ d |  _  d |  _ |  i i | ƒ } t | ƒ d j o@ t	 | ƒ |  _ t | ƒ d j o t	 | d d !ƒ |  _  q¦ n t
 i o d G|  i G|  i  GHn | S(   s   ADEF -- store imagei    s   misplaced ADEF chunki   i   i   t   ADEFN(   R   R   R!   R   R   R"   R   R   R#   R    R   R   (   R   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_ADEFi   s    				
c         C   sC   |  i  d j o t d ‚ n |  i i | ƒ } | |  i |  i <| S(   s   NAME -- name the current imagei    s   misplaced NAME chunk(   R   R   R   R   R   R   (   R   R   R   t   name(    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_NAME€   s
    c         C   s)   t  i o	 d GHn d |  _ t d ‚ d S(   s   AEND -- end of animationt   AENDi   s   end of ARG fileN(   R   R   R   t   EOFError(   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_AENDŒ   s    
		i   c      	   C   s¨   t  | ƒ t  | d ƒ f } y. t t | d ƒ t | d ƒ f \ } } Wn t d ‚ n X| o7 t | d ƒ o n t | d ƒ o t d ‚ q› n | | | f S(   Ni   i   i	   s   unknown image modei   i   s   unknown filter category(   R   R   R   R   (   R   R   t   fullR   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt   __getmodesize–   s    .c         C   s0  |  i  d j o t d ‚ n |  i d	 j	 o- |  i |  i i ƒ  |  i |  i <d	 |  _ n |  i i | ƒ } |  i t	 | ƒ } t
 | d d !ƒ t
 | d d !ƒ } } | | | i d | | i d | f } | i d
 j o! |  i |  i i | | | ƒ n |  i |  i i | | ƒ d |  _ |  i ƒ  | S(   s$   PAST -- paste one image into anotheri    s   misplaced PAST chunki   i   i
   i   t   RGBAt   PASTN(   R.   (   R/   (   R   R   R"   R   R   t   copyR   R   R   R    R   R   R   t   pasteR   t   _ArgStream__store(   R   R   R   R   R   t   xt   yt   bbox(    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_PAST§   s    	 '(!	
c         C   s|   |  i  d j o t d ‚ n |  i i | ƒ } |  i | d ƒ \ } } } d |  _ t i i | | d ƒ |  _	 |  i
 ƒ  | S(   s   BLNK -- create blank imagei    s   misplaced BLNK chunkt   BLNK(   R7   (   R   R   R   R   t   _ArgStream__getmodesizeR   R   t   coret   fillR   R2   (   R   R   R   R   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_BLNKÌ   s    	
c         C   s¤   |  i  d j o t d ‚ n |  i i | ƒ } |  i | ƒ \ } } } d |  _ t i i | | ƒ |  _	 t i i
 | ƒ |  _ |  i i |  i	 d | ƒ d |  _ | S(   s   IHDR -- full image followsi    s   misplaced IHDR chunkt   IHDRt    (   R<   (   i    i    (   R   R   R   R   R8   R   R   R9   t   newR   t   zip_decodert   decodert   setimaget   data(   R   R   R   R   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_IHDRÝ   s    		c   
      C   s&  |  i  d j o t d ‚ n |  i i | ƒ } |  i | ƒ \ } } } t | d ƒ } t | d d !ƒ t | d d !ƒ f } | | d | d | d | d f }	 t i o d G| G|	 GHn d | |	 f |  _	 t i
 i | | ƒ |  _ t i
 i | ƒ |  _ |  i i |  i d
 | ƒ d	 |  _ | S(   s   DHDR -- delta image followsi    s   misplaced DHDR chunki   i   i   i   i   t   DHDRR=   (   i    i    (   R   R   R   R   R8   R   R   R   R   R   R9   R>   R   R?   R@   RA   RB   (
   R   R   R   R   R   R   R   t   difft   offsR5   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_DHDRñ   s    &(
	c         C   s§   |  i  d j o t d ‚ n |  i i | ƒ } |  i | d ƒ \ } } } d |  _ t i i | | ƒ |  _	 t i i
 | ƒ |  _ |  i i |  i	 d | ƒ d |  _ | S(   s   JHDR -- JPEG image followsi    s   misplaced JHDR chunkt   JHDRR=   (   RH   (   i    i    (   R   R   R   R   R8   R   R   R9   R>   R   t   jpeg_decoderR@   RA   RB   (   R   R   R   R   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_JHDR  s    		c         C   s§   |  i  d j o t d ‚ n |  i i | ƒ } |  i | d ƒ \ } } } d |  _ t i i | | ƒ |  _	 t i i
 | ƒ |  _ |  i i |  i	 d | ƒ d |  _ | S(   s6   UHDR -- uncompressed image data follows (EXPERIMENTAL)i    s   misplaced UHDR chunkt   UHDRR=   (   RK   (   i    i    (   R   R   R   R   R8   R   R   R9   R>   R   t   raw_decoderR@   RA   RB   (   R   R   R   R   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_UHDR&  s    		c         C   s€   |  i  i | ƒ } |  i | |  _ |  i i |  i ƒ \ } } | d j  o" | d j  o t d | ‚ q| n |  i | |  _ | S(   s   IDAT -- image data blocki    s   decoder error %d(   R   R   RB   R@   t   decodet   IOError(   R   R   R   R   t   nt   e(    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_IDAT:  s    c         C   s   |  i  | | ƒ S(   N(   t
   chunk_IEND(   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_DENDJ  s    c         C   s   |  i  | | ƒ S(   N(   RS   (   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_JENDM  s    c         C   s   |  i  | | ƒ S(   N(   RS   (   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_UENDP  s    c         C   s&   |  `  |  ` |  i ƒ  |  i i | ƒ S(   s   IEND -- end of image(   R@   RB   R2   R   R   (   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyRS   S  s    
c         C   sñ   |  i  d } | d j o |  i |  i |  i <nv | d j oh |  i  \ } } } |  i |  i } |  i } | d j o | i | i | ƒ ƒ } n | i | | ƒ n |  i d |  _ |  i d j o' |  i o |  i |  i |  _ t	 ‚ n d  S(	   Ni    R7   R<   RH   RK   RD   i   (   s   BLNKs   IHDRs   JHDRs   UHDR(
   R   R   R   R   t   chop_add_modulot   cropR1   R   R!   R*   (   R   t   cidR   R5   t   im0t   im1(    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt   __storea  s    	c         C   s?   |  i  i | ƒ } |  i d j o t i d | ƒ |  _ n | S(   s   PLTE -- palette datat   Pt   RGB(   R   R   R   t   ImagePalettet   rawR	   (   R   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_PLTEy  s    c         C   s=   |  i  d j o t d ‚ n |  i i | ƒ } |  i ƒ  | S(   s   SYNC -- reset decoderi    s   misplaced sYNC chunk(   R   R   R   R   R
   (   R   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt
   chunk_sYNC  s
    
(   t   __name__t
   __module__t   __doc__R   R
   R   R$   R&   R(   R+   R8   R6   R;   RC   RG   RJ   RM   RR   RT   RU   RV   RS   R2   Ra   Rb   (    (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyR       s.   							
	%			!									c         C   s   |  d  t  j S(   Ni   (   t   MAGIC(   t   prefix(    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt   _accept  s    t   ArgImageFilec           B   sA   e  Z d  Z d Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   t   ARGs   Animated raster graphicsc         C   sØ   t  i o t  i i d t ƒ n |  i i d ƒ t j o t d ‚ n t |  i ƒ |  _	 |  i	 i ƒ  \ } } } | d j o t d ‚ n |  i	 i
 | | | ƒ } |  i	 i | | ƒ |  i	 i |  _ |  i	 i |  _ d  S(   Ns•   The ArgImagePlugin driver is obsolete, and will be removed from a future release of PIL.  If you rely on this module, please contact the PIL authors.i   s   not an ARG filet   AHDRs   expected an AHDR chunk(   R   t   warningst   warnt   RuntimeWarningR   R   Rf   R   R   t   argt   callt   crcR   R   (   R   RY   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt   _openš  s    
	c         C   sV   |  i  i d  j o |  i d ƒ n |  i  i |  _ |  i  i |  _ t i i |  ƒ d  S(   Ni    (   Ro   R   R   t   seekR	   R   t   load(   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyRt   ¸  s
    c         C   sú   |  i  i o t d ‚ n |  i  i |  _ xº |  i  i ƒ  \ } } } |  i  i o t d ‚ n y |  i  i | | | ƒ } WnS t j
 o PnA d j
 o4 t i o | G| Gd GHn |  i i | ƒ } n X|  i  i | | ƒ q, |  i i d ƒ d  S(   Ns   end of animationt   glurks	   (unknown)i   (	   Ro   R   R*   R   R   Rp   R   R   Rq   (   R   t   frameRY   R   R   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyRs   Ä  s"    
c         C   s   d S(   Ni    (    (   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt   tellã  s    c         C   s:   |  i  i d ƒ |  i i |  ƒ |  i i ƒ  d |  _  d S(   s   Verify ARG filei   N(   R   Rs   Ro   t   verifyt   closeR   (   R   (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyRx   æ  s    (	   Rc   Rd   t   formatt   format_descriptionRr   Rt   Rs   Rw   Rx   (    (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyRi   •  s   				Rj   s   .args   video/x-arg(   t   __version__R   t	   ImageFileR_   t   PngImagePluginR    R   R   R   Rf   R   Rh   Ri   t   register_opent   register_extensiont   register_mime(    (    (    s<   /usr/local/lib/python2.6/dist-packages/PIL/ArgImagePlugin.pyt   <module>   s   $"ÿ p	_