File: //usr/lib/python3/dist-packages/PIL/__pycache__/ImagePalette.cpython-38.pyc
U
g�
^� � @ sz d dl Z ddlmZmZmZmZ G dd� d�Zdd� Zdd � Zd
d� Z dd
d�Z
ddd�Zddd�Zddd�Z
dd� ZdS )� N� )�GimpGradientFile�GimpPaletteFile�
ImageColor�PaletteFilec @ sF e Zd ZdZddd�Zdd� Zd d
� Zdd� ZeZd
d� Z dd� Z
dS )�ImagePaletteas
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 and of length ``size``
times the number of colors in ``mode``. The list must be aligned
by channel (All R values must be contiguous in the list before G
and B values.) Defaults to 0 through 255 per channel.
:param size: An optional palette size. If given, it cannot be equal to
or greater than 256. Defaults to 0.
�RGBNr c C sv || _ d | _|p$ttd��t| j � | _i | _d | _|dkrTt| j �d t| j�ksj|dkrr|t| j�krrtd��d S )N� r zwrong palette size) �mode�rawmode� bytearray�range�len�palette�colors�dirty�
ValueError)�selfr
r �size� r �2/usr/lib/python3/dist-packages/PIL/ImagePalette.py�__init__'