public class Palette extends Object
Constructor and Description |
---|
Palette(PApplet parent)
Creates an empty Palette object.
|
Palette(PApplet parent,
int[] colors)
Creates a Palette object from an array of colors.
|
Palette(PApplet parent,
int[] colors,
int count) |
Modifier and Type | Method and Description |
---|---|
Palette |
addColor(int color)
Adds a color to the Palette.
|
Palette |
addColors(int[] colors)
Adds colors to the Palette.
|
void |
createPalette() |
void |
createPalette(int color) |
void |
drawSwatches()
Draws all color swatches of the Palette to the screen.
|
void |
drawSwatches(float w,
float h)
Draws all color swatches of the Palette to the screen.
|
int |
getAverage()
Returns the average of all colors (Swatch?) from the Palette
|
int |
getColor(int colorNumber)
Returns the color for the index number
|
int |
getDarkest()
Returns the darkest color (Swatch?) from the Palette
|
int |
getLightest()
Returns the lightest color (Swatch?) from the Palette
|
int |
numSwatches()
Returns the number of swatches in the Palette
|
void |
removeDuplicateSwatches()
Removes duplicate colors from the Palette
|
void |
rotateRGB(int angle) |
void |
rotateRYB(int angle) |
void |
sortByHue()
Sorts the Swatches in the palette by hue
|
void |
sortByLuminance()
Sorts the Swatches in the palette by luminance
|
void |
sortByProximity() |
void |
sortBySaturation()
Sorts the Swatches in the palette by saturation
|
public Palette(PApplet parent)
parent
- reference to the main PApplet object.public Palette(PApplet parent, int[] colors)
parent
- reference to the main PApplet object.colors
- Array of Processing colors.public Palette(PApplet parent, int[] colors, int count)
parent
- reference to the main PApplet ojectcolors
- Array of Processing colorscount
- Number of colors in the final Palettepublic Palette addColor(int color)
color
- a Processing color.public Palette addColors(int[] colors)
colors
- an array of Processing colors.public void createPalette()
public void createPalette(int color)
public void removeDuplicateSwatches()
public void drawSwatches()
public void drawSwatches(float w, float h)
w
- Width of the Paletteh
- Height of the Palettepublic int getColor(int colorNumber)
colorNumber
- number of the color you want to getpublic int numSwatches()
public void rotateRGB(int angle)
public void rotateRYB(int angle)
public void sortByHue()
public void sortBySaturation()
public void sortByLuminance()
public void sortByProximity()
public int getDarkest()
public int getLightest()
public int getAverage()
Processing library colorLib by Jan Vantomme. (C) 2012 - 2015