o
    \"<fê
  ã                   @   sX   d dl mZmZ d dlmZ dd„ ZG dd„ dejƒZe ej	ee¡ e 
ej	d¡ dS )	é   )ÚImageÚ	ImageFile)Úi32bec                 C   s(   t | ƒdkot| dƒdkot| dƒdv S )Né   é    é   é   ©r   é   )ÚlenÚi32)Úprefix© r   úI/var/www/html/kck/venv/lib/python3.10/site-packages/PIL/GbrImagePlugin.pyÚ_accept   s   (r   c                   @   s$   e Zd ZdZdZdd„ Zdd„ ZdS )ÚGbrImageFileÚGBRzGIMP brush filec           	      C   sL  t | j d¡ƒ}t | j d¡ƒ}|dk rtdƒ‚|dvr#td|› ƒ‚t | j d¡ƒ}t | j d¡ƒ}t | j d¡ƒ}|dksC|dkrGtdƒ‚|dvrRtd|› ƒ‚|d	kr[|d }n|d
 }| j d¡}|dkrmtdƒ‚t | j d¡ƒ| jd< | j |¡d d… }|d	krŠd| _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ÚversionÚwidthÚheightÚcolor_depthÚcomment_lengthÚmagic_numberr   r   r   r   Ú_open,   s8   


zGbrImageFile._openc                 C   s6   | j rd S tj | j| j¡| _ |  | j | j	¡¡ d S )N)
Úimr   ÚcoreÚnewr   r    Ú	frombytesr   r   r!   )r"   r   r   r   ÚloadV   s   zGbrImageFile.loadN)Ú__name__Ú
__module__Ú__qualname__ÚformatÚformat_descriptionr*   r/   r   r   r   r   r   '   s
    *r   z.gbrN)Ú r   r   Ú_binaryr   r   r   r   Úregister_openr3   Úregister_extensionr   r   r   r   Ú<module>   s   <