com.jhlabs.image

Class CellularFilter

Implemented Interfaces:
BufferedImageOp, Cloneable, Function2D
Known Direct Subclasses:
CrystallizeFilter, PointillizeFilter

public class CellularFilter
extends WholeImageFilter
implements Function2D, Cloneable

A filter which produces an image with a cellular texture.

Nested Class Summary

class
CellularFilter.Point

Field Summary

static int
HEXAGONAL
static int
OCTAGONAL
static int
RANDOM
static int
SQUARE
static int
TRIANGULAR
float
amount
protected float
angle
protected float
angleCoefficient
float
bias
protected float[]
coefficients
protected Colormap
colormap
float
distancePower
float
gain
protected int
gridType
protected float
m00
protected float
m01
protected float
m10
protected float
m11
protected Random
random
protected float
randomness
protected CellularFilter.Point[]
results
protected float
scale
protected float
stretch
float
turbulence
boolean
useColor

Fields inherited from class com.jhlabs.image.WholeImageFilter

originalSpace, transformedSpace

Constructor Summary

CellularFilter()
Construct a WholeImageFilter.

Method Summary

Object
clone()
float
evaluate(float x, float y)
protected int[]
filterPixels(int width, int height, int[] inPixels, Rectangle transformedSpace)
Actually filter the pixels.
float
getAmount()
Get the amount of texture.
float
getAngle()
Returns the angle of the texture.
float
getAngleCoefficient()
float
getCoefficient(int i)
Colormap
getColormap()
Get the colormap to be used for the filter.
float
getDistancePower()
float
getF1()
float
getF2()
float
getF3()
float
getF4()
float
getGradientCoefficient()
int
getGridType()
int
getPixel(int x, int y, int[] inPixels, int width, int height)
float
getRandomness()
float
getScale()
Returns the scale of the texture.
float
getStretch()
Returns the stretch factor of the texture.
float
getTurbulence()
Returns the turbulence of the effect.
void
setAmount(float amount)
Set the amount of effect.
void
setAngle(float angle)
Specifies the angle of the texture.
void
setAngleCoefficient(float angleCoefficient)
void
setCoefficient(int i, float v)
void
setColormap(Colormap colormap)
Set the colormap to be used for the filter.
void
setDistancePower(float distancePower)
void
setF1(float v)
void
setF2(float v)
void
setF3(float v)
void
setF4(float v)
void
setGradientCoefficient(float gradientCoefficient)
void
setGridType(int gridType)
void
setRandomness(float randomness)
void
setScale(float scale)
Specifies the scale of the texture.
void
setStretch(float stretch)
Specifies the stretch factor of the texture.
void
setTurbulence(float turbulence)
Specifies the turbulence of the texture.
String
toString()
float
turbulence2(float x, float y, float freq)

Methods inherited from class com.jhlabs.image.WholeImageFilter

filter, filterPixels, transformSpace

Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp

clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRGB, getRenderingHints, setRGB

Field Details

HEXAGONAL

public static final int HEXAGONAL
Field Value:
2

OCTAGONAL

public static final int OCTAGONAL
Field Value:
3

RANDOM

public static final int RANDOM
Field Value:
0

SQUARE

public static final int SQUARE
Field Value:
1

TRIANGULAR

public static final int TRIANGULAR
Field Value:
4

amount

public float amount

angle

protected float angle

angleCoefficient

protected float angleCoefficient

bias

public float bias

coefficients

protected float[] coefficients

colormap

protected Colormap colormap

distancePower

public float distancePower

gain

public float gain

gridType

protected int gridType

m00

protected float m00

m01

protected float m01

m10

protected float m10

m11

protected float m11

random

protected Random random

randomness

protected float randomness

results

protected CellularFilter.Point[] results

scale

protected float scale

stretch

protected float stretch

turbulence

public float turbulence

useColor

public boolean useColor

Constructor Details

CellularFilter

public CellularFilter()
Construct a WholeImageFilter.

Method Details

clone

public Object clone()
Overrides:
clone in interface AbstractBufferedImageOp

evaluate

public float evaluate(float x,
                      float y)
Specified by:
evaluate in interface Function2D

filterPixels

protected int[] filterPixels(int width,
                             int height,
                             int[] inPixels,
                             Rectangle transformedSpace)
Actually filter the pixels.
Overrides:
filterPixels in interface WholeImageFilter
Parameters:
width - the image width
height - the image height
inPixels - the image pixels
transformedSpace - the output bounds
Returns:
the output pixels

getAmount

public float getAmount()
Get the amount of texture.
Returns:
the amount

getAngle

public float getAngle()
Returns the angle of the texture.
Returns:
the angle of the texture.

getAngleCoefficient

public float getAngleCoefficient()

getCoefficient

public float getCoefficient(int i)

getColormap

public Colormap getColormap()
Get the colormap to be used for the filter.
Returns:
the colormap

getDistancePower

public float getDistancePower()

getF1

public float getF1()

getF2

public float getF2()

getF3

public float getF3()

getF4

public float getF4()

getGradientCoefficient

public float getGradientCoefficient()

getGridType

public int getGridType()

getPixel

public int getPixel(int x,
                    int y,
                    int[] inPixels,
                    int width,
                    int height)

getRandomness

public float getRandomness()

getScale

public float getScale()
Returns the scale of the texture.
Returns:
the scale of the texture.

getStretch

public float getStretch()
Returns the stretch factor of the texture.
Returns:
the stretch factor of the texture.

getTurbulence

public float getTurbulence()
Returns the turbulence of the effect.
Returns:
the turbulence of the effect.

setAmount

public void setAmount(float amount)
Set the amount of effect.
Parameters:
amount - the amount

setAngle

public void setAngle(float angle)
Specifies the angle of the texture.
Parameters:
angle - the angle of the texture.

setAngleCoefficient

public void setAngleCoefficient(float angleCoefficient)

setCoefficient

public void setCoefficient(int i,
                           float v)

setColormap

public void setColormap(Colormap colormap)
Set the colormap to be used for the filter.
Parameters:
colormap - the colormap
See Also:
getColormap()

setDistancePower

public void setDistancePower(float distancePower)

setF1

public void setF1(float v)

setF2

public void setF2(float v)

setF3

public void setF3(float v)

setF4

public void setF4(float v)

setGradientCoefficient

public void setGradientCoefficient(float gradientCoefficient)

setGridType

public void setGridType(int gridType)

setRandomness

public void setRandomness(float randomness)

setScale

public void setScale(float scale)
Specifies the scale of the texture.
Parameters:
scale - the scale of the texture.

setStretch

public void setStretch(float stretch)
Specifies the stretch factor of the texture.
Parameters:
stretch - the stretch factor of the texture.

setTurbulence

public void setTurbulence(float turbulence)
Specifies the turbulence of the texture.
Parameters:
turbulence - the turbulence of the texture.

toString

public String toString()

turbulence2

public float turbulence2(float x,
                         float y,
                         float freq)