public class Swatch extends Object
Constructor and Description |
---|
Swatch(PApplet parent)
Creates a Swatch object with the default color (Red)
|
Swatch(PApplet parent,
int color)
Creates a Swatch object with a specified color.
|
Modifier and Type | Method and Description |
---|---|
float |
black()
Returns the CMYK black value based on the formula ...
|
float |
brightnessDiff(int color) |
float |
brightnessDiff(Swatch swatch) |
float |
colorDiff(int color) |
float |
colorDiff(Swatch swatch) |
float |
cyan()
Returns the CMYK cyan value based on the formula ...
|
void |
darken()
Darkens the color
|
void |
darken(float amount)
Darkens the color based on a specific amount
|
void |
desaturate()
Desaturates the color
|
void |
desaturate(float amount)
Desaturates the color by a specified amount
|
int |
getColor()
Returns the color of the Swatch
|
int |
getTransparentColor(int alpha)
Returns the transparent color of the Swatch
|
void |
lighten()
Lightens the color
|
void |
lighten(float amount)
Lightens the color by a specific amount
|
float |
magenta()
Returns the CMYK magenta value based on the formula ...
|
void |
rotateRGB(float i_angle) |
void |
rotateRYB(float i_angle) |
void |
saturate()
Saturates the color
|
void |
saturate(float amount)
Saturates the color by a specified amount
|
void |
setColor(int color)
Sets the color of the Swatch.
|
float |
yellow()
Returns the CMYK yellow value based on the formula ...
|
public Swatch(PApplet parent)
parent
- reference to the main PApplet object.public Swatch(PApplet parent, int color)
parent
- reference to the main PApplet object.color
- specified color.public void setColor(int color)
color
- public float black()
public float cyan()
public float magenta()
public float yellow()
public void darken()
public void darken(float amount)
public void lighten()
public void lighten(float amount)
amount
- public void desaturate()
public void desaturate(float amount)
amount
- public void saturate()
public void saturate(float amount)
amount
- public int getColor()
public int getTransparentColor(int alpha)
alpha
- Alpha value of the color. This should be a number between 0 and 100public void rotateRGB(float i_angle)
i_angle
- public void rotateRYB(float i_angle)
i_angle
- public float brightnessDiff(int color)
public float brightnessDiff(Swatch swatch)
public float colorDiff(int color)
public float colorDiff(Swatch swatch)
Processing library colorLib by Jan Vantomme. (C) 2012 - 2015