unlekker.util
Class ColorPalette

java.lang.Object
  extended by unlekker.util.ColorUtil
      extended by unlekker.util.ColorPalette

public class ColorPalette
extends ColorUtil

Utility to generate color palettes.

Author:
Marius Watz

Field Summary
 int alloc
           
 int[] c
           
static float[] hsb
           
 int num
           
 int numSet
           
 
Constructor Summary
ColorPalette()
           
 
Method Summary
 void add(float r, float g, float b)
          Add a single color entry
 void add(float r, float g, float b, float a)
          Add a single color entry
 void add(int col)
          Add a single color entry
 void add(int col, int numcol)
          Add a single color multiple times
 void add(java.lang.String hex)
          Add a single color entry from a hexadecimal color string.
 void add(java.lang.String hex, int num)
          Add a single color multiple times from a hexadecimal color string.
 void addRange(float numrange, float r, float g, float b, float r2, float g2, float b2)
          Adds an interpolated range of colors.
 void addRange(float numrange, float r, float g, float b, float a, float r2, float g2, float b2, float a2)
          Adds an interpolated range of colors with alpha.
 void addRange(float numrange, int c1, int c2)
          Adds an interpolated range of colors.
 void addRange(float numrange, java.lang.String hex1, java.lang.String hex2)
          Adds an interpolated range of colors.
 void addSet(ColorSet _set)
          Adds ColorSet to the palette.
 void empty()
          Remove any color definitions.
 void getPalette()
          Initializes palette using a randomly selected ColorSet.
 int getRandomCol()
          Get random color from the current palette.
 void savePalette(java.lang.String filename)
           
 void scramblePalette()
          Scramble current palette so that colors are in random order.
 
Methods inherited from class unlekker.util.ColorUtil
color, color, color, color, color, colorAdjust, colorBlended, colorBlended, colorBlended, colorMult, colorToHex, colorToHex, colorToString, getAlpha, getBrightness, getSaturation, isWhite, setAlpha
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

num

public int num

alloc

public int alloc

numSet

public int numSet

c

public int[] c

hsb

public static float[] hsb
Constructor Detail

ColorPalette

public ColorPalette()
Method Detail

empty

public void empty()
Remove any color definitions.


addSet

public void addSet(ColorSet _set)
Adds ColorSet to the palette. NOT YET FUNCTIONAL

Parameters:
_set -

getPalette

public void getPalette()
Initializes palette using a randomly selected ColorSet. NOT YET FUNCTIONAL


savePalette

public void savePalette(java.lang.String filename)

getRandomCol

public int getRandomCol()
Get random color from the current palette.


scramblePalette

public void scramblePalette()
Scramble current palette so that colors are in random order.


add

public void add(int col)
Add a single color entry


add

public void add(int col,
                int numcol)
Add a single color multiple times

Parameters:
col - Color to add
numcol - Number of copies to add

add

public void add(float r,
                float g,
                float b)
Add a single color entry


add

public void add(float r,
                float g,
                float b,
                float a)
Add a single color entry


add

public void add(java.lang.String hex,
                int num)
Add a single color multiple times from a hexadecimal color string.


add

public void add(java.lang.String hex)
Add a single color entry from a hexadecimal color string.


addRange

public void addRange(float numrange,
                     float r,
                     float g,
                     float b,
                     float r2,
                     float g2,
                     float b2)
Adds an interpolated range of colors.

Parameters:
numrange - Number of interpolated colors to add
r -
g -
b -
r2 -
g2 -
b2 -

addRange

public void addRange(float numrange,
                     float r,
                     float g,
                     float b,
                     float a,
                     float r2,
                     float g2,
                     float b2,
                     float a2)
Adds an interpolated range of colors with alpha.

Parameters:
numrange - Number of interpolated colors to add
r -
g -
b -
r2 -
g2 -
b2 -

addRange

public void addRange(float numrange,
                     int c1,
                     int c2)
Adds an interpolated range of colors.

Parameters:
numrange - Number of interpolated colors to add
c1 -
c2 -

addRange

public void addRange(float numrange,
                     java.lang.String hex1,
                     java.lang.String hex2)
Adds an interpolated range of colors.

Parameters:
numrange - Number of interpolated colors to add
hex1 - Color 1 in hexadecimal format
hex2 - Color 2 in hexadecimal format