Files
intellecton/venv/lib/python3.12/site-packages/PIL/__pycache__/ImagePalette.cpython-312.pyc
T

81 lines
12 KiB
Plaintext
Raw Normal View History

Ë
ß¼jø#ãó¸—ddlmZddlZddlmZddlmZddlmZm Z m
Z
m Z dZ e rddlm
Z
Gd „d
«Zdd „Zdd „Zdd
„Zddd„Zddd„Zddd„Zddd„Zdd„Zy)é)Ú annotationsN)ÚSequence)ÚIOé)ÚGimpGradientFileÚGimpPaletteFileÚ
ImageColorÚ PaletteFileF)ÚImagecóè—eZdZdZ d dd„Zedd„«Zejdd„«Zedd„«Zejdd„«Zdd„Z dd „Z
dd
„Z e Z d dd „Z
d dd „Zdd
„Zy)Ú ImagePalettea¥
Color palette for palette mapped images
:param mode: The mode to use for the palette. See:
:ref:`concept-modes`. Defaults to "RGB"
:param palette: An optional palette. If given, it must be a bytearray,
an array or a list of ints between 0-255. The list must consist of
all channels for one color followed by the next color (e.g. RGBRGBRGB).
Defaults to an empty palette.
NcóT—||_d|_|xs
t«|_d|_y©N)ÚmodeÚrawmodeÚ bytearrayÚpaletteÚdirty)Úselfrrs úS/home/antigravity/intellecton/venv/lib/python3.12/site-packages/PIL/ImagePalette.pyÚ__init__zImagePalette.__init__+s'€ð
ˆŒ Ø#'ˆŒ ØÒ-¤)£+ˆŒ Ø!%ˆ�
ócó—|jSr)Ú_palette©rs rrzImagePalette.palette5s €à�}‰}Ðrcó —d|_||_yr)Ú_colorsr)rrs rrzImagePalette.palette9s€à:>ˆŒ ؈�
rcó,—|j€}t|j«}i|_tdt|j«|«D]>}t |j|||z«}||jvrŒ-||z|j|<Œ@|jS)Nr)rÚlenrÚrangerÚtuple)rÚmode_lenÚiÚcolors rÚcolorszImagePalette.colors>s‡€à �<‰<Рܘ4Ÿ9™9“~ˆH؈DŒLܘ1œc $§,¡,Ó/°Ó:ò
4�ܘdŸl™l¨1¨q°8©|Ð<Ó=�ؘDŸL™LÑ(ØØ&'¨8¡m�— ‘ ˜UÒ#ð 
4ð
�|‰|Ðrcó—||_yr)r)rr%s rr%zImagePalette.colorsJs €àˆ� rcóÀ—t«}|j|_|j|_|j�|jdd|_|j|_|Sr)r
rrrr)rÚnews rÚcopyzImagePalette.copyNsH€Ü‹nˆà—9‘9ˆŒØ—l‘lˆŒ Ø �<‰<Ð #ØŸ,™,¡q˜/ˆCŒKØ—J‘JˆŒ àˆ
rcó‚—|jr|j|jfS|j|j«fS)z£
Get palette contents in format suitable for the low-level
``im.putpalette`` primitive.
.. warning:: This method is experimental.
)rrrÚtobytesrs rÚgetdatazImagePalette.getdataYs3€ð �<Š<Ø—<‘< §¡Ð-Ð -Ø�y‰y˜$Ÿ,™,›.Ð(Ð(rcóà—|jr
d}t|«‚t|jt«r |jSt j
d|j«}|j
«S)zUConvert palette to bytes.
.. warning:: This method is experimental.
ú!palette contains raw palette dataÚB)rÚ
ValueErrorÚ
isinstancerÚbytesÚarrayr+)rÚmsgÚarrs rr+zImagePalette.tobytesdsR€ð
�<Š<Ø5ˆCܘS“/Ð !Ü �d—l‘l¤EÔ *Ø—<‘<Ð Ü�k‰k˜#˜tŸ|™|Ó,ˆØ�{‰{‹}Ðrcó
—t|jt«st|j«|_t |j«t |j
«z}d}|rD|j jd«|j jd«f}||vr
|dz
}||vrŒ
|dk\rV|rAttt|j««««D]\}}|dk(sŒ ||vsŒ|}n|dk\rd}t|«|‚|S)N©Ú
backgroundÚ transparencyrérz$cannot allocate more than 256 colors)
r1rrrrrÚinfoÚgetÚreversedÚlistÚ enumerateÚ histogramr0)rÚimageÚeÚindexÚspecial_colorsr#Úcountr4s rÚ_new_color_indexzImagePalette._new_color_indextsñ€ô˜$Ÿ,™,¬ Ô2Ü% d§l¡lÓ3ˆDŒMÜ�D—L‘LÓ!¤S¨¯©£^Ñ3ˆØCEˆÙ à—
‘
—‘˜|Ó,Ø—
‘
—‘˜~Ó.ðˆNð˜>Ñ)ؘ‘
�ð˜>Ò)à �CŠ<Ùä (¬¬i¸¿¹Ó8IÓ.JÓ)KÓ Lò‘H�A�uØ “z a¨~Ò&=Ø !˜Ùðð˜Š|Ø<�Ü  “o¨1Ð,؈ rcó"—|jr
d}t|«‚t|t«rj|jdk(r)t |«dk(r=|ddk7r
d}t|«‚|dd}n"|jdk(rt |«dk(r|d z
} |j |Sd t|«›�}t|«‚#t$rØ}|j||«}t|jt«sJ‚||j |<t |j«}||zt |j«kr:|jd||zt|«z|j||z|zdz|_ n|xjt|«z
c_ d
|_
|cYd}~Sd}~wwxYw) zgGiven an rgb tuple, allocate palette entry.
.. warning:: This method is experimental.
r.ÚRGBéééÿz/cannot add non-opaque RGBA color to RGB paletteNÚRGBA)rKrzunknown color specifier: )rr0r1r!rrr%ÚKeyErrorrFrrrr2rÚrepr)rr$rAr4rBrCr"s rÚgetcolorzImagePalette.getcolorŽs€ð �<Š<Ø5ˆCܘS“/Ð !Ü �eœUÔ #Ø�y‰y˜EÒ!Ü�u“: ’?ؘQ‘x 3’ØO˜Ü(¨›oÐ-Ø! " 1˜I‘EØ—‘˜fÒ$Ü�u“: ’?ؘV‘O�Eð
Ø—{‘{ 5Ñ)Ð)ð$.¬d°5«k¨]Ð;ˆCܘS“/Ð !øô%ò
à×-Ñ-¨e°QÓ7�Ü! $§-¡-´Ô;Ð;Ð;Ø%*�— ‘ ˜EÑ"ܘtŸy™y›>�ؘ8Ñ#¤c¨$¯,©,Ó&7Ò7àŸ
™
Ð&8¨°Ñ(8Ð9Ü ›,ñ'àŸ-™-¨°Ñ(8¸8Ñ(CÐ(EÐFñGð•Mð —M’M¤U¨5£\Ñ1•MØ�”
Ø• ûð
úsÂB-Â- FÂ6C
F ÆFÆ Fcó�—|jr
d}t|«‚d}t|t«rt |d«}d} |j d«|j d|j ›d�«t|j«}td«D]�}|j |›«t|t|j «z|d zt|j «z«D]*}|j d
||kr|j|nd ›�«Œ,|j d«Œ� |r|j«y y #|r|j«wwxYw)
zVSave palette to text file.
.. warning:: This method is experimental.
r.FÚwTz
# Palette
z# Mode: ú