| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.paulhertz.aifile.Palette
public class Palette
Maintains a set of Processing-style colors: alpha, red, green and blue stored as 4 bytes in an 32-bit int. Does not permit duplicate color entries. Provides methods for adding colors in other formats, and some utility functions.
| Constructor Summary | |
|---|---|
Palette()
Creates a Palette with no colors  | 
|
Palette(Palette palette)
Creates a Palette instance from another Palette's colorSet.  | 
|
| Method Summary | |
|---|---|
 void | 
addBlackWhiteGray()
Adds black, white and gray to the palette.  | 
 void | 
addColor(CMYKColor cmyk)
Transforms a CMYKColor to a 32-bit int
 and adds it to the colorSet of this Palette. | 
 void | 
addColor(int argb)
Adds a Processing color to the colorSet of this Palette.  | 
 void | 
addColor(RGBColor rgb)
Transforms an RGBColor to a 32-bit int
 and adds it to the colorSet of this Palette. | 
 void | 
addColors(ArrayList<Integer> argbColors)
Adds colors in argbColors to the colorSet of this Palette.  | 
 void | 
addColors(int[] argbColors)
Adds colors in argbColors to the colorSet of this Palette.  | 
static int[] | 
argbComponents(int argb)
Breaks a Processing color into A, R, G and B values in an array.  | 
static int | 
cmyk2int(CMYKColor cmyk)
Converts a CMYKColor to a Processing color. | 
static int[] | 
colorPermutation(int argb)
Returns all unique permutations of the color channels of a supplied color.  | 
static int | 
complement(int argb)
Returns the complement of a color.  | 
static int | 
composeColor(int gray)
Creates a Processing ARGB color from a grayscale value.  | 
static int | 
composeColor(int r,
             int g,
             int b,
             int a)
Creates a Processing ARGB color from r, g, b, and alpha channel values.  | 
 int | 
getColor(int index)
 | 
 int[] | 
getColors()
Returns the colors in the colorSet of this Palette as an array of integers.  | 
 LinkedHashSet<Integer> | 
getColorSet()
Returns the internal storage for colors.  | 
static RGBColor | 
int2rgb(int argb)
Converts a Processing color to an RGBColor. | 
static int | 
randColor()
Returns a random Processing color.  | 
static int | 
randColor(int[] c)
Creates a random color from randomly selected values in an array.  | 
static int | 
rgb2int(RGBColor rgb)
Converts an RGBColor to a Processing color. | 
static int[] | 
rgbComponents(int argb)
Breaks a Processing color into R, G and B values in an array.  | 
 String | 
toString()
 | 
 void | 
write(PrintWriter pw)
Writes this Palette in Adobe Illustrator file format.  | 
| Methods inherited from class java.lang.Object | 
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public Palette()
public Palette(Palette palette)
palette - a Palette, source for the colors used in this Palette| Method Detail | 
|---|
public void write(PrintWriter pw)
writeHeader()).
pw - PrintWriter for output to filepublic void addBlackWhiteGray()
public void addColor(RGBColor rgb)
RGBColor to a 32-bit int
 and adds it to the colorSet of this Palette.
rgb - an RGBColorpublic void addColor(CMYKColor cmyk)
CMYKColor to a 32-bit int
 and adds it to the colorSet of this Palette.
cmyk - a CMYKColorpublic void addColor(int argb)
argb - a Processing-format color, alpha, red, green and blue stored as 4 bytes in an 32-bit intpublic void addColors(ArrayList<Integer> argbColors)
argbColors - an ArrayList of Processing-format colors (32 bit integers)public void addColors(int[] argbColors)
argbColors - an array of Processing-format colors (32 bit integers)public LinkedHashSet<Integer> getColorSet()
public int[] getColors()
intspublic int getColor(int index)
public static int[] argbComponents(int argb)
argb - a Processing color as a 32-bit integer
public static int[] rgbComponents(int argb)
argb - a Processing color as a 32-bit integer
public static int composeColor(int r,
                               int g,
                               int b,
                               int a)
r - red component 0..255g - green component 0..255b - blue component 0..255a - alpha component 0..255
public static int composeColor(int gray)
gray - a grayscale value 0..255
public static int randColor(int[] c)
c - an array of integer values
public static int randColor()
public static int[] colorPermutation(int argb)
argb - a Processing-format color, a, r, g and b as bytes in a 32-bit integer
public static int complement(int argb)
argb - a Processing-format color, 32-bit integer a, r, g and b channels.
public static RGBColor int2rgb(int argb)
RGBColor.
argb - a Processing color
public static int rgb2int(RGBColor rgb)
RGBColor to a Processing color.
rgb - 
public static int cmyk2int(CMYKColor cmyk)
CMYKColor to a Processing color.
cmyk - 
public String toString()
toString in class Object
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||