o
    ÒèFh�  ã                   @  sd   d dl mZ 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 )é    )Úannotationsé   )ÚImageÚ	ImageFile)Úi32bec                 C  s(   t | ƒdkot| dƒdkot| dƒdv S )Né   r   é   é   ©r   é   )ÚlenÚi32)Úprefix© r   úK/var/www/html/loop/nvenv/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  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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ÚmsgÚversionÚwidthÚheightÚcolor_depthÚcomment_lengthÚmagic_numberr   r   r   r   Ú_open,   sB   




zGbrImageFile._openc                 C  s:   | j stj | j| j¡| _ |  | j | j	¡¡ tj 
| ¡S )N)Úimr   ÚcoreÚnewÚmoder!   Ú	frombytesr   r   r"   Úload)r#   r   r   r   r2   [   s   zGbrImageFile.loadN)Ú__name__Ú
__module__Ú__qualname__ÚformatÚformat_descriptionr,   r2   r   r   r   r   r   (   s
    /r   z.gbrN)Ú
__future__r   Ú r   r   Ú_binaryr   r   r   r   Úregister_openr6   Úregister_extensionr   r   r   r   Ú<module>   s   >