bibliothek.util
Class Colors

java.lang.Object
  extended by bibliothek.util.Colors

public final class Colors
extends Object

Some fields and methods that make life easier when dealing with Colors.

Author:
Benjamin Sigg

Method Summary
static Color between(Color a, Color b, double value)
          Creates a color which "lies between" the colors a and b
static Color between(Color a, double weightA, Color b, double weightB, Color c, double weightC)
          Creates a color that "lies between" the colors a, b and c.
static Color brighter(Color color)
          Helper methods calling Color.brighter().
static Color brighter(Color c, double value)
          Increases the brightness of a color.
static Color darker(Color color)
          Helper methods calling Color.darker().
static Color darker(Color c, double value)
          Decreases the brightness of a color.
static Color deltaBrightness(Color c, double delta)
          Converts c into HSB and adds delta to the brightness.
static Color diffMirror(Color color, double factor)
           
static Color fuller(Color color, double factor)
           
static Color middle(Color a, Color b)
           
static Color undiffMirror(Color color, double factor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

darker

public static Color darker(Color c,
                           double value)
Decreases the brightness of a color.

Parameters:
c - the color which will be made darker
value - how much darker the color should be, 1 means black, 0 means c is returned
Returns:
a color which is darker than c

brighter

public static Color brighter(Color c,
                             double value)
Increases the brightness of a color.

Parameters:
c - the color which will be made brighter
value - how much brighter the color should be, 1 means white, 0 means c is returned
Returns:
a color which is brighter than c

deltaBrightness

public static Color deltaBrightness(Color c,
                                    double delta)
Converts c into HSB and adds delta to the brightness.

Parameters:
c - the color to convert
delta - the delta in brightness
Returns:
the new color

between

public static Color between(Color a,
                            Color b,
                            double value)
Creates a color which "lies between" the colors a and b

Parameters:
a - the first color
b - the second color
value - a value between 0 and 1, 0 means a is returned, 1 means b is returned
Returns:
a color whose rgb-values are between the rgb-values of a and b

between

public static Color between(Color a,
                            double weightA,
                            Color b,
                            double weightB,
                            Color c,
                            double weightC)
Creates a color that "lies between" the colors a, b and c. Each color has a weight, and as higher the weight as more of that color is inside the created color.

Parameters:
a - the first color to incooperate
weightA - how much of a goes into the resulting color
b - the second color to incooperate
weightB - how much of b goes into the resulting color
c - the third color to incooperate
weightC - how much of c goes into the resulting color
Returns:
(a * weightA + b * weightB + c * weightC) / (weightA + weightB + weightC)

middle

public static Color middle(Color a,
                           Color b)

fuller

public static Color fuller(Color color,
                           double factor)

undiffMirror

public static Color undiffMirror(Color color,
                                 double factor)

diffMirror

public static Color diffMirror(Color color,
                               double factor)

darker

public static Color darker(Color color)
Helper methods calling Color.darker().

Parameters:
color - some color to modify, can be null
Returns:
the darker color or null

brighter

public static Color brighter(Color color)
Helper methods calling Color.brighter().

Parameters:
color - some color to modify, can be null
Returns:
the brighter color or null