Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/PIL/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/PIL/__pycache__/GimpGradientFile.cpython-312.pyc

�

&ٜg:���dZddlmZddlmZmZmZmZddlm	Z	m
Z
ddlmZdZ
	dd�Zdd	�Zdd
�Zdd�Zdd�ZeeeeegZ	Gd
�d�ZGd�de�Zy)z�
Stuff to translate curve segments to palette values (derived from
the corresponding code in GIMP, written by Federico Mena Quintero.
See the GIMP distribution for more information.)
�)�annotations)�log�pi�sin�sqrt)�IO�Callable�)�o8g�����|�=c�n�||kr|tkryd|z|zS||z
}d|z
}|tkrydd|z|zzS)Ng��?��?)�EPSILON��middle�poss  �?/usr/local/lib/python3.12/site-packages/PIL/GimpGradientFile.py�linearr sT��
�f�}��G�����9�v�%�%��F�l���v����G�����s��V�+�+�+�c�R�|td�tt|t��zzS)Nr
)r�maxrrs  r�curvedr/s"���3�s�8�c�#�f�g�"6�7�7�8�8rc�\�ttdztt||�zz�dzdzS)Ng@r)rrrrs  r�siner3s.���"��s��b�6�&�#�#6�6�6�7�#�=��D�Drc�>�tdt||�dz
dzz
�S�Nr��rrrs  r�sphere_increasingr7s#����v�f�c�*�S�0�Q�6�6�7�7rc�>�dtdt||�dzz
�z
Srrrs  r�sphere_decreasingr!;s#����c�F�6�3�/�1�4�4�5�5�5rc�&�eZdZUdZded<ddd�Zy)�GradientFileNzblist[tuple[float, float, float, list[float], list[float], Callable[[float, float], float]]] | None�gradientc	���|j�J�g}d}|j|\}}}}}}	t|�D�](}
|
|dz
z}||kr!|dz
}|j|\}}}}}}	||kr�!||z
}|tkr
|	dd�}
n|	||z
|z||z
|z�}
tt	d|d|dz
|
z|dzzdz��}tt	d|d|dz
|
z|dzzdz��}tt	d|d|dz
|
z|dzzdz��}tt	d|d|dz
|
z|dzzdz��}|j||z|z|z���+dj
|�dfS)	Nrr
r
�r�r�RGBA)r$�rangerr�int�append�join)�self�entries�palette�ix�x0�x1�xm�rgb0�rgb1�segment�i�x�w�scale�r�g�b�as                  r�
getpalettezGradientFile.getpaletteRs����}�}�(�(�(���
��*.�-�-��*;�'��B��D�$���w��A��W�q�[�!�A��q�&��a���26�-�-��2C�/��B��D�$���q�&��R��A��7�{���S�)����b��A�
��B��!�|�<���3�s�t�A�w��a��0�E�9�D��G�C�D�s�J�K�L�A��3�s�t�A�w��a��0�E�9�D��G�C�D�s�J�K�L�A��3�s�t�A�w��a��0�E�9�D��G�C�D�s�J�K�L�A��3�s�t�A�w��a��0�E�9�D��G�C�D�s�J�K�L�A�
�N�N�1�q�5�1�9�q�=�)�+ �.�x�x�� �&�(�(r)�)r.r*�returnztuple[bytes, str])�__name__�
__module__�__qualname__r$�__annotations__r?�rrr#r#Cs��	
�
�
	�
�)rr#c��eZdZdZdd�Zy)�GimpGradientFilez(File handler for GIMP's gradient format.c	�f�|j�dddk7r
d}t|��|j�}|jd�r|j�j�}t	|�}g|_t
|�D]�}|j�j�}|ddD�cgc]
}t|���}}|d|d}
}	|d}|d	d
}|d
d}
tt	|d�}t	|d�}|dk7r
d}t|��|j
j|	|
|||
|f���ycc}w)
N�
s
GIMP Gradientznot a GIMP gradient filesName: �rrr
r'��zcannot handle HSV colour space)�readline�SyntaxError�
startswith�stripr*r$r)�split�float�SEGMENTS�OSErrorr+)r-�fp�msg�line�countr7�sr8r9r1r2r3r4r5r6�cspaces                r�__init__zGimpGradientFile.__init__vs,��
�;�;�=��"��!1�1�,�C��c�"�"��{�{�}���?�?�9�%��;�;�=�&�&�(�D��D�	����
��u��A����
�#�#�%�A�#$�S�b�6�*�6�a��q��6�A�*��q�T�1�Q�4��B��1��B��Q�q�6�D��Q�r�7�D��s�1�R�5�z�*�G���2��Z�F���{�6���c�l�"��M�M� � �"�b�"�d�D�'�!B�C�!��*s�(D.N)rVz	IO[bytes]rA�None)rBrCrD�__doc__r\rFrrrHrHss��2�DrrHN)rrSrrSrArS)r^�
__future__r�mathrrrr�typingrr	�_binaryrrrrrrr!rTr#rHrFrr�<module>rcsm�� �
#�#�#���
���,�9�E�8�6�
�F�D�"3�5F�G���-)�-)�`"D�|�"Dr

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists