ó
È4ec           @   sa   d  d l  m Z m Z d  d l m Z m Z m Z d Z	 d e j f d     YZ
 d d  Z d S(	   i   (   t	   ImageFilet   ImagePalette(   t   i8t   i16bet   i32bes   0.1t   GdImageFilec           B   s   e  Z d  Z d Z d   Z RS(   t   GDs   GD uncompressed imagesc         C   s%  |  j  j d  } t | d   d k r7 t d   n  d |  _ t | d d ! t | d d ! f |  _ t | d  } | r d n d	 } t | d
 | d
 | d ! } | d k  rĈ | |  j d <n  t	 j
 d | d
 | d d
 | d d ! |  _ d d |  j d
 | d d d f g |  _ d  S(   Ni  i   iŝ˙  i˙˙  s   Not a valid GD 2.x .gd filet   Li   i   i    i   i   t   transparencyt   XBGRt   rawi   (   iŝ˙  i˙˙  i   (   i    i    i   (   R   i    i   (   t   fpt   readt   i16t   SyntaxErrort   modet   _sizeR   t   i32t   infoR   R
   t   palettet   sizet   tile(   t   selft   st	   trueColort   trueColorOffsett   tindex(    (    s9   /usr/local/lib/python2.7/dist-packages/PIL/GdImageFile.pyt   _open.   s    	)*(   t   __name__t
   __module__t   formatt   format_descriptionR   (    (    (    s9   /usr/local/lib/python2.7/dist-packages/PIL/GdImageFile.pyR   )   s   t   rc         C   sM   | d k r t  d   n  y t |   SWn t k
 rH t d   n Xd S(   s)  
    Load texture from a GD image file.

    :param filename: GD file name, or an opened file handle.
    :param mode: Optional mode.  In this version, if the mode argument
        is given, it must be "r".
    :returns: An image instance.
    :raises IOError: If the image could not be read.
    R    s   bad modes   cannot identify this image fileN(   t
   ValueErrorR   R   t   IOError(   R   R   (    (    s9   /usr/local/lib/python2.7/dist-packages/PIL/GdImageFile.pyt   openJ   s    
N(   t    R    R   t   _binaryR   R   R   R   R   t   __version__R   R#   (    (    (    s9   /usr/local/lib/python2.7/dist-packages/PIL/GdImageFile.pyt   <module>   s   
!