public class Palette
extends java.lang.Object
Palette
allows the user to associate a name and
index color model together as a palette and perform manipulations
on the palette colors.Constructor and Description |
---|
Palette(java.lang.String name,
java.awt.image.IndexColorModel model)
Constructs a new palette from the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.awt.Color color)
Adds a single color to the end of the palette.
|
void |
add(java.awt.Color[] colors)
Adds a number of colors to the end of the palette.
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
java.awt.image.IndexColorModel |
getModel()
Gets the palette model data.
|
java.lang.String |
getName()
Gets the palette name.
|
Palette |
remap(int length)
Remaps a color palette to a new number of colors.
|
public Palette(java.lang.String name, java.awt.image.IndexColorModel model)
name
- the color palette name.model
- the color palette model.public java.lang.String getName()
public java.awt.image.IndexColorModel getModel()
public Palette remap(int length)
length
- the size of the new palette.public void add(java.awt.Color[] colors)
colors
- an array of color objects to add.public void add(java.awt.Color color)
color
- the color to add.add(Color[])
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object