
    e	                    l   d dl mZ d dlZddlmZmZ  ej                  d      Zd Z G d dej
                        Z	d	 Z
 ej                  e	j                  e	e        ej                  e	j                  e
        ej                  e	j                  d
        ej                  e	j                  d       y)    )annotationsN   )Image	ImageFiles   \s*#define[ \t]+.*_width[ \t]+(?P<width>[0-9]+)[\r\n]+#define[ 	]+.*_height[ 	]+(?P<height>[0-9]+)[
]+(?P<hotspot>#define[ 	]+[^_]*_x_hot[ 	]+(?P<xhot>[0-9]+)[
]+#define[ 	]+[^_]*_y_hot[ 	]+(?P<yhot>[0-9]+)[
]+)?[\000-\377]*_bits\[]c                .    | j                         d d dk(  S )N   s   #define)lstrip)prefixs    4/usr/lib/python3/dist-packages/PIL/XbmImagePlugin.py_acceptr   '   s    ==?2A*,,    c                      e Zd ZdZdZd Zy)XbmImageFileXBMz
X11 Bitmapc                   t         j                  | j                  j                  d            }|sd}t	        |      t        |j                  d            }t        |j                  d            }|j                  d      rAt        |j                  d            t        |j                  d            f| j                  d<   d| _        ||f| _	        d	d
| j                  z   |j                         d fg| _        y )Ni   znot a XBM filewidthheighthotspotxhotyhot1xbmr   r   )xbm_headmatchfpreadSyntaxErrorintgroupinfo_mode_sizesizeendtile)selfmmsgxsizeysizes        r   _openzXbmImageFile._open3   s    NN477<<,-"Cc""AGGG$%AGGH%&779$'$8#aggfo:N#ODIIi 
E\
Vdii/$?@	r   N)__name__
__module____qualname__formatformat_descriptionr,    r   r   r   r   /   s    F%Ar   r   c                   | j                   dk7  rd| j                    d}t        |      |j                  d| j                  d    dj	                  d             |j                  d| j                  d	    dj	                  d             | j
                  j                  d
      }|rN|j                  d|d    dj	                  d             |j                  d|d	    dj	                  d             |j                  d       t        j                  | |dd| j                  z   dd fg       |j                  d       y )Nr   zcannot write mode z as XBMz#define im_width r   
asciiz#define im_height r   r   z#define im_x_hot z#define im_y_hot s   static char im_bits[] = {
r   r   s   };
)	modeOSErrorwriter$   encodeencoderinfogetr   _save)imr   filenamer)   r   s        r   r<   r<   F   s   	ww#~"277)73clHH B/66w?@HH!"''!*R077@Ann  +G
$WQZL3::7CD
$WQZL3::7CDHH+,OOBeVbgg%5q$?@AHHWr   z.xbmz	image/xbm)
__future__r   re r   r   compiler   r   r   r<   register_openr0   register_saveregister_extensionregister_mimer2   r   r   <module>rG      s   * # 	  2::-A9&& A.(   L''w ?   L'' /   ,,f 5   L'' 5r   