Class Palette

java.lang.Object
  |
  +--Palette

class Palette
extends java.lang.Object

Author:
Erhan Oztop, 2001-2002

Source code by Erhan Oztop (erhan@atr.co.jp)
Copyright August 2002 via
University of Southern California Ph.D. publication copyright
Simple palette implementation. Let's one to access colors with integers or names. First 10 colors are reserved for standart java colors as black, white,red,gree,blue,cyan,magenta,yellow,gray,lightGray.

Field Summary
 java.awt.Color[] C
           
 int maxN
           
 int N
           
 java.lang.String[] names
           
 
Constructor Summary
Palette(int size)
          Creates a palette of 10+size colors.
 
Method Summary
 int addColor(java.awt.Color c)
          adds the color c and returns its index.
 int addColor(java.awt.Color c, java.lang.String name)
          Adds the color c with name name and returns its index.
 int addColor(int r, int g, int b)
          adds the color r,g,b and returns its index.
 int addColor(int r, int g, int b, java.lang.String name)
          Adds the color (r,g,b) with name name and returns its index.
 java.awt.Color getColor(int k)
          Get color by index
 java.awt.Color getColor(java.lang.String name)
          Get color by name.
 void spread(int start, int end, int r0, int g0, int b0, int r1, int g1, int b1)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

maxN

public int maxN

N

public int N

C

public java.awt.Color[] C

names

public java.lang.String[] names
Constructor Detail

Palette

public Palette(int size)
Creates a palette of 10+size colors.
Method Detail

addColor

public int addColor(java.awt.Color c)
adds the color c and returns its index.

addColor

public int addColor(int r,
                    int g,
                    int b)
adds the color r,g,b and returns its index.

addColor

public int addColor(int r,
                    int g,
                    int b,
                    java.lang.String name)
Adds the color (r,g,b) with name name and returns its index.

addColor

public int addColor(java.awt.Color c,
                    java.lang.String name)
Adds the color c with name name and returns its index.

getColor

public java.awt.Color getColor(java.lang.String name)
Get color by name.

getColor

public java.awt.Color getColor(int k)
Get color by index

spread

public void spread(int start,
                   int end,
                   int r0,
                   int g0,
                   int b0,
                   int r1,
                   int g1,
                   int b1)