com.github.cage.image
Class Rippler

java.lang.Object
  extended by com.github.cage.image.Rippler

public class Rippler
extends Object

A filter to generate ripple (wave) effected images. Uses a transformed sinus wave for this. This class is thread safe.

Author:
akiraly

Nested Class Summary
static class Rippler.AxisConfig
          Class to respresent wave tranforming information for an axis.
 
Constructor Summary
Rippler(Rippler.AxisConfig vertical, Rippler.AxisConfig horizontal)
          Constructor.
 
Method Summary
protected  int[] calcDeltaArray(Rippler.AxisConfig axisConfig, int num)
          Calculates wave delta array.
 BufferedImage filter(BufferedImage src, BufferedImage dest)
          Draws a rippled (waved) variant of source into destination.
 Rippler.AxisConfig getHorizontal()
           
 Rippler.AxisConfig getVertical()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rippler

public Rippler(Rippler.AxisConfig vertical,
               Rippler.AxisConfig horizontal)
Constructor.

Parameters:
vertical - config to calculate waving deltas from x axis (so to modify y values), not null
horizontal - config to calculate waving deltas from y axis (so to modify x values), not null
Method Detail

filter

public BufferedImage filter(BufferedImage src,
                            BufferedImage dest)
Draws a rippled (waved) variant of source into destination.

Parameters:
src - to be transformed, not null
dest - to hold the result, not null
Returns:
dest is returned

calcDeltaArray

protected int[] calcDeltaArray(Rippler.AxisConfig axisConfig,
                               int num)
Calculates wave delta array.

Parameters:
axisConfig - config object to transform the wave, not null
num - number of points needed, positive
Returns:
the calculated num length delta array

getVertical

public Rippler.AxisConfig getVertical()
Returns:
vertical config, not null

getHorizontal

public Rippler.AxisConfig getHorizontal()
Returns:
horizontal config, not null


Copyright © 2011. All Rights Reserved.