CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
GimpGradientFile.cpython-310.pyc31 linesDownload Raw Back to __pycache__
1o

2��Yi'�@s�dZddlmZddlmZmZmZmZddlm	Z	dZ3e4r*ddlmZddl
mZd	Z	ddd�Zddd�Zddd�Zddd�Zddd�ZeeeeegZ	Gdd�d�ZGdd�de�ZdS)z�5Stuff to translate curve segments to palette values (derived from6the corresponding code in GIMP, written by Federico Mena Quintero.7See the GIMP distribution for more information.)8�)�annotations)�log�pi�sin�sqrt�)�o8F)�Callable)�IOg�����|�=�middle�float�pos�returncCsL||kr|tkr9dSd||S||}d|}|tkrdSdd||S)Ng��?��?)�EPSILON�rr
�r�~E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\PIL/GimpGradientFile.py�linear$srcCs|td�tt|t��S)Nr)r�maxrrrrr�curved3�rcCs$ttdtt||��ddS)Ng@r)rrrrrrr�sine7s$rcCstdt||�dd�S�Nr��rrrrrr�sphere_increasing;rrcCsdtdt||�d�Srrrrrr�sphere_decreasing?rrc@s&eZdZUdZded<ddd	d10�ZdS)
�GradientFileNzblist[tuple[float, float, float, list[float], list[float], Callable[[float, float], float]]] | None�gradient��entries�intr�tuple[bytes, str]cCs~|jdusJ�g}d}|j|\}}}}}}	t|�D]�}11|12|d}||kr9|d7}|j|\}}}}}}	||ks&||}|tkrG|	dd�}
n
|	||||||�}
ttd|d|d|
|dd��}ttd|d|d|
|dd��}ttd|d|d|
|dd��}ttd|d|d|
|dd��}|�||||�qd�|�dfS)	Nrrr��r��ZRGBA)r �rangerrr#�append�join)�selfr"�paletteZix�x0�x1�xm�rgb0�rgb1�segment�i�x�w�scale�r�g�b�arrr�13getpaletteVs(�,,,,zGradientFile.getpalette)r!)r"r#rr$)�__name__�14__module__�__qualname__r �__annotations__r;rrrrrGs15
16�rc@seZdZdZd	dd�ZdS)17�GimpGradientFilez(File handler for GIMP's gradient format.�fp�	IO[bytes]r�Nonec	Cs�|���d�s
d}t|��|��}|�d�r|����}t|�}g|_t|�D]P}|����}dd�|dd�D�}|d|d}}	|d	}18|d19d�}|dd�}tt|d�}
t|d�}|dkrkd
}t	|��|j�20||	|21|||
f�q'dS)Ns
GIMP Gradientznot a GIMP gradient filesName: cSsg|]}t|��qSr)r)�.0r4rrr�22<listcomp>�sz-GimpGradientFile.__init__.<locals>.<listcomp>�rrrr&��zcannot handle HSV colour space)�readline�23startswith�SyntaxError�stripr#r r(�split�SEGMENTS�OSErrorr))r+rA�msg�line�countr3�sr5r-r.r/r0r1r2Zcspacerrr�__init__zs,24�zGimpGradientFile.__init__N)rArBrrC)r<r=r>�__doc__rTrrrrr@wsr@N)rrr
rrr)rU�25__future__r�mathrrrr�_binaryr�
TYPE_CHECKING�collections.abcr	�typingr26rrrrrrrNrr@rrrr�<module>s&27282930310
Aluode/PerceptionLabPortable · CoolFace