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
ZdddZdddZdddZdddZddZy)é)Ú annotationsN)ÚSequence)ÚIOé)ÚGimpGradientFileÚGimpPaletteFileÚ
ImageColorÚ PaletteFileF)ÚImagecóèeZdZdZ d ddZedd«Zejdd«Zedd«Zejdd«ZddZ 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Úcolors rÚcolorszImagePalette.colors>s‡à <‰<Рܘ4Ÿ9™9“~ˆˆDŒLܘ1œc $§,¡,ÓÓ
4ܘdŸl™l¨1¨q°8©|Ð=ؘDŸL™LÑØ&'¨8¡m ˜
|‰|Ðrcó||_yr)r)rr%s rr%zImagePalette.colorsJs àˆ rcóÀt«}|j|_|j|_|j|jdd|_|j|_|Sr)r
rrrr)rÚnews rÚcopyzImagePalette.copyNsHÜà—9‘9ˆŒØ—l‘lˆŒ Ø <‰<Ð Ÿ,™,¡q˜/ˆCŒKØ—J‘JˆŒ àˆ
rcó‚|jr|j|jfS|j|j«fS)
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ˆ˜S“/Ð d—ll¤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)Ú
backgroundÚ transparencyrérz$cannot allocate more than 256 colors)
r1rrrrrÚinfoÚgetÚreversedÚlistÚ enumerateÚ histogramr0)rÚimageÚindexÚspecial_colorsr#Úcountr4s rÚ_new_color_indexzImagePalette._new_color_indextô˜$Ÿ,™,¬ Ô% d§l¡lÓ3ˆDŒMÜD—L‘LÓ!¤S¨¯©£^ÑØCEˆÙ à
˜
˜~ÓˆNð˜>ј
ð˜ CŠ<Ùä (¬¬i¸¿¹Ó8IÓ.JÓ)KÓ LòHA “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ˆ˜S“/Ð eœUÔ y‰y˜EÒu“: ’?ؘQ‘x 3’ØO˜Ü! " 1˜I˜u“: ’?ؘVO
Ø—{‘{ 5Ñ)ð$.¬d°5«k¨]Ð;ˆCܘS“/Ð !øô%ò
à×-¨e°QÓ7Ü! $§-¡-´Ô;Ø%* ˜˜tŸy™y>ؘ#¤c¨$¯,©,Ó&7ÒŸ
Ð&8¨°Ñ(8РŸ-™-¨°Ñ(8¸8Ñ(CÐ(EÐ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.wTz
# Palette
z# Mode: ú