ó
È4ec           @   su   d  d l  m Z m Z d  d l m Z d „  Z d e j f d „  ƒ  YZ e j e j	 e e ƒ e j
 e j	 d ƒ d S(   i   (   t   Imaget	   ImageFile(   t   i32bec         C   s?   t  |  ƒ d k o> t |  d  ƒ d k o> t |  d d !ƒ d k S(   Ni   i   i   i   i   (   i   i   (   t   lent   i32(   t   prefix(    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/GbrImagePlugin.pyt   _accept   s    t   GbrImageFilec           B   s&   e  Z d  Z d Z d „  Z d „  Z RS(   t   GBRs   GIMP brush filec   	      C   sß  t  |  j j d ƒ ƒ } t  |  j j d ƒ ƒ } | d k  rK t d ƒ ‚ n  | d k rj t d | ƒ ‚ n  t  |  j j d ƒ ƒ } t  |  j j d ƒ ƒ } t  |  j j d ƒ ƒ } | d k sÊ | d k rÙ t d ƒ ‚ n  | d k rø t d | ƒ ‚ n  | d k r| d } nV | d	 } |  j j d ƒ } | d
 k rHt d ƒ ‚ n  t  |  j j d ƒ ƒ |  j d <|  j j | ƒ d  } | d k r•d |  _ n	 d |  _ | | f |  _ | |  j d <t j |  j	 ƒ | | | |  _
 d  S(   Ni   i   s   not a GIMP brushi   i   s"   Unsupported GIMP brush version: %si    s&   Unsupported GIMP brush color depth: %si   t   GIMPs"   not a GIMP brush, bad magic numbert   spacingiÿÿÿÿt   Lt   RGBAt   comment(   i   i   (   i   i   (   R   t   fpt   readt   SyntaxErrort   infot   modet   _sizeR    t   _decompression_bomb_checkt   sizet
   _data_size(	   t   selft   header_sizet   versiont   widtht   heightt   color_deptht   comment_lengtht   magic_numberR   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/GbrImagePlugin.pyt   _open,   s8    
	c         C   s>   t  j j |  j |  j ƒ |  _ |  j |  j j |  j	 ƒ ƒ d  S(   N(
   R    t   coret   newR   R   t   imt	   frombytesR   R   R   (   R   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/GbrImagePlugin.pyt   loadV   s    (   t   __name__t
   __module__t   formatt   format_descriptionR   R$   (    (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/GbrImagePlugin.pyR   '   s   	*s   .gbrN(   t    R    R   t   _binaryR   R   R   R   t   register_openR'   t   register_extension(    (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/GbrImagePlugin.pyt   <module>   s
   	8