o
    sh                     @  sf   d dl mZ ddlmZmZ ddlmZ dd	d
ZG dd dejZ	e
e	je	e ee	jd dS )    )annotations   )Image	ImageFile)i32beprefixbytesreturnboolc                 C  s(   t | dkot| ddkot| ddv S )N   r         r      )leni32)r    r   f/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/PIL/GbrImagePlugin.py_accept    s   (r   c                   @  s(   e Zd ZdZdZdddZddd	Zd
S )GbrImageFileGBRzGIMP brush filer	   Nonec           
      C  s`  t | jd}|dk rd}t|t | jd}|dvr'd| }t|t | jd}t | jd}t | jd}|dksG|dkrMd}t||dvrZd| }t||d	krc|d }n|d
 }| jd}|dkrwd}t|t | jd| jd< | j|d d }	|d	krd| _nd| _||f| _|	| jd< t| j	 || | | _
d S )Nr   r   znot a GIMP brushr   z Unsupported GIMP brush version: r   )r   r   z$Unsupported GIMP brush color depth: r      s   GIMPz"not a GIMP brush, bad magic numberspacingLRGBAcomment)r   fpreadSyntaxErrorinfo_mode_sizer   _decompression_bomb_checksize
_data_size)
selfheader_sizemsgversionwidthheightcolor_depthcomment_lengthmagic_numberr   r   r   r   _open,   sB   




zGbrImageFile._openImage.core.PixelAccess | Nonec                 C  s>   | j d u rtj| j| j| _| | j	| j
 tj| S )N)_imr   corenewmoder%   im	frombytesr   r   r&   load)r'   r   r   r   r8   [   s   
zGbrImageFile.loadN)r	   r   )r	   r1   )__name__
__module____qualname__formatformat_descriptionr0   r8   r   r   r   r   r   (   s
    
/r   z.gbrN)r   r   r	   r
   )
__future__r    r   r   _binaryr   r   r   r   register_openr<   register_extensionr   r   r   r   <module>   s   
>