tipgame.util
Class PathBlur

java.lang.Object
  extended by tipgame.util.PathBlur

public class PathBlur
extends java.lang.Object

Draws in reduced colors.

Author:
Jam Jenkins

Constructor Summary
PathBlur()
           
 
Method Summary
private static java.awt.Color blend(java.awt.Color from, java.awt.Color to, double distance)
          blends two color as a linear combination
private static double[] getExponentialValues(int num, double base)
          gets exponentially increasing values from 0 to 1
private static double[] getLinearValues(int num)
          gets linearly increasing values from 0 to 1
static void paintBlur(java.awt.Graphics2D graphics, java.awt.Shape[] history, double[] values)
          paints shapes at a given intensity
private static void paintBlur(java.awt.Graphics2D graphics, java.awt.Shape current, java.awt.geom.Point2D.Double movement, double[] values)
          fills a blur from where the shape used to be to its current location by translating -movement and drawing successively less transparent shapes while translating back to the original location.
static void paintExponentialBlur(java.awt.Graphics2D graphics, java.awt.Shape[] history, double base)
          paints shapes in an exponentially decreasing intensity
static void paintExponentialBlur(java.awt.Graphics2D graphics, java.awt.Shape[] history, int steps, double base)
          paints shapes at exponentially decreasing intensity
static void paintExponentialBlur(java.awt.Graphics2D graphics, java.awt.Shape current, java.awt.geom.Point2D.Double movement, int steps, double base)
          paints shapes in an exponentially decreasing intensity
static void paintLinearBlur(java.awt.Graphics2D graphics, java.awt.Shape[] history)
          paints shapes in an linearly decreasing intensity
static void paintLinearBlur(java.awt.Graphics2D graphics, java.awt.Shape[] history, int steps)
          paints shapes at linearly decreasing intensity
static void paintLinearBlur(java.awt.Graphics2D graphics, java.awt.Shape current, java.awt.geom.Point2D.Double movement, int steps)
          paints shapes in a linearly decreasing intensity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathBlur

public PathBlur()
Method Detail

paintBlur

private static void paintBlur(java.awt.Graphics2D graphics,
                              java.awt.Shape current,
                              java.awt.geom.Point2D.Double movement,
                              double[] values)
fills a blur from where the shape used to be to its current location by translating -movement and drawing successively less transparent shapes while translating back to the original location. This method only draws in a single color.

Parameters:
graphics - the graphics used for drawing
current - the current location of the shape
movement - the destination of the shape
values - the intensity values for drawing the shape

paintLinearBlur

public static void paintLinearBlur(java.awt.Graphics2D graphics,
                                   java.awt.Shape current,
                                   java.awt.geom.Point2D.Double movement,
                                   int steps)
paints shapes in a linearly decreasing intensity

Parameters:
graphics - the graphics used for drawing
current - the current location of the shape
movement - the destination of the shape
steps - how many steps to draw

paintExponentialBlur

public static void paintExponentialBlur(java.awt.Graphics2D graphics,
                                        java.awt.Shape current,
                                        java.awt.geom.Point2D.Double movement,
                                        int steps,
                                        double base)
paints shapes in an exponentially decreasing intensity

Parameters:
graphics - the graphics used for drawing
current - the current location of the shape
movement - the destination of the shape
steps - how many steps to draw
base - the base to exponentiate, should be less than 1

getLinearValues

private static double[] getLinearValues(int num)
gets linearly increasing values from 0 to 1

Parameters:
num - the steps for increasing
Returns:
an array of values from 0 to 1

getExponentialValues

private static double[] getExponentialValues(int num,
                                             double base)
gets exponentially increasing values from 0 to 1

Parameters:
num - the steps for increasing
base - the base for exponentiating
Returns:
an array of values from 0 to 1

paintExponentialBlur

public static void paintExponentialBlur(java.awt.Graphics2D graphics,
                                        java.awt.Shape[] history,
                                        double base)
paints shapes in an exponentially decreasing intensity

Parameters:
graphics - the graphics used for drawing
history - the shapes to draw
base - the base to exponentiate, should be less than 1

paintLinearBlur

public static void paintLinearBlur(java.awt.Graphics2D graphics,
                                   java.awt.Shape[] history)
paints shapes in an linearly decreasing intensity

Parameters:
graphics - the graphics used for drawing
history - the shapes to draw
base - the base to exponentiate, should be less than 1

paintBlur

public static void paintBlur(java.awt.Graphics2D graphics,
                             java.awt.Shape[] history,
                             double[] values)
paints shapes at a given intensity

Parameters:
graphics - the graphics used for drawing
history - the shapes to draw
values - the intensities corresponding to the shapes

paintLinearBlur

public static void paintLinearBlur(java.awt.Graphics2D graphics,
                                   java.awt.Shape[] history,
                                   int steps)
paints shapes at linearly decreasing intensity

Parameters:
graphics - the graphics used for drawing
history - the shapes to draw
steps - the number of steps for changing the intensity

paintExponentialBlur

public static void paintExponentialBlur(java.awt.Graphics2D graphics,
                                        java.awt.Shape[] history,
                                        int steps,
                                        double base)
paints shapes at exponentially decreasing intensity

Parameters:
graphics - the graphics used for drawing
history - the shapes to draw
steps - the number of steps for changing the intensity
base - the base to exponentiate for the densities

blend

private static java.awt.Color blend(java.awt.Color from,
                                    java.awt.Color to,
                                    double distance)
blends two color as a linear combination

Parameters:
from - the first color
to - the second color
distance - the amount of the second color between zero and one. One is all the second color and zero is none of the second color
Returns:
the linearly blended color