Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.batik.ext.awt.image.rendered
Class TurbulencePatternRed

    java.lang.Object
      org.apache.batik.ext.awt.image.rendered.AbstractRed
          org.apache.batik.ext.awt.image.rendered.TurbulencePatternRed

All Implemented Interfaces:
  RenderedImage, CachableRed

    public final class TurbulencePatternRed

extends AbstractRed

This class creates a RenderedImage in conformance to the one defined for the feTurbulence filter of the SVG specification. What follows is my high-level description of how the noise is generated. This is not contained in the SVG spec, just the algorithm for doing it. This is provided in the hope that someone will figure out a clever way to accelerate parts of the function. gradient contains a long list of random unit vectors. For each point we are to generate noise for we do two things. first we use the latticeSelector to 'co-mingle' the integer portions of x and y (this allows us to have a one-dimensional array of gradients that appears 2 dimensional, by using the co-mingled index). We do this for [x,y], [x+1,y], [x,y+1], and [x+1, y+1], this gives us the four gradient vectors that surround the point (b00, b10, ...) Next we construct the four vectors from the grid points (where the gradient vectors are defined) [these are rx0, rx1, ry0, ry1]. We then take the dot product between the gradient vectors and the grid point vectors (this gives the portion of the grid point vector that projects along the gradient vector for each grid point). These four dot projects are then combined with linear interpolation. The weight factor for the linear combination is the result of applying the 's' curve function to the fractional part of x and y (rx0, ry0). The S curve function get's it's name because it looks a bit like as 'S' from 0->1.

Field Summary

Fields inherited from class org.apache.batik.ext.awt.image.rendered.AbstractRed
`bounds, cm, minTileX, minTileY, numXTiles, numYTiles, props, sm, srcs, tileGridXOff, tileGridYOff, tileHeight, tileWidth`

Constructor Summary
`TurbulencePatternRed(double baseFrequencyX, double baseFrequencyY, int numOctaves, int seed, boolean isFractalNoise, Rectangle2D tile, AffineTransform txf, Rectangle devRect, ColorSpace cs, boolean alpha)`

Method Summary
`WritableRaster` | `copyData(WritableRaster dest)` Generates a Perlin noise pattern into dest Raster.
`double` | `getBaseFrequencyX()`
`double` | `getBaseFrequencyY()`
`boolean[]` | `getChannels()`
`int` | `getNumOctaves()`
`int` | `getSeed()`
`Rectangle2D` | `getTile()`
`boolean` | `isFractalNoise()`
`int` | `random(int seed)`
`int` | `setupSeed(int seed)`

Methods inherited from class org.apache.batik.ext.awt.image.rendered.AbstractRed
`copyBand, copyToRaster, getBounds, getColorModel, getData, getData, getDependencyRegion, getDirtyRegion, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getPropertyNames, getSampleModel, getSources, getTile, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth, getXTile, getYTile, init, init, makeTile, updateTileGridInfo`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TurbulencePatternRed

    public TurbulencePatternRed(double baseFrequencyX,
                                double baseFrequencyY,
                                int numOctaves,
                                int seed,
                                boolean isFractalNoise,
                                Rectangle2D tile,
                                AffineTransform txf,
                                Rectangle devRect,
                                ColorSpace cs,
                                boolean alpha)

Parameters:
  `baseFrequencyX` - x-axis base frequency for the noise function along the x-axis
  `baseFrequencyY` - y-axis base frequency for the noise function along the x-axis
  `numOctaves` - number of octaves in the noise function. Positive integral value.
  `seed` - starting number for the pseudo random number generator
  `isFractalNoise` - defines whether the filter performs a fractal noise or a turbulence function.
  `tile` - defines the tile size. May be null if stitchTiles is false. Otherwise, should not be null.
  `txf` - The affine transform from device to user space.
  `cs` - The Colorspace to output.
  `alpha` - True if the data should have an alpha channel.

Method Detail

### getBaseFrequencyX

    public double getBaseFrequencyX()

### getBaseFrequencyY

    public double getBaseFrequencyY()

### getNumOctaves

    public int getNumOctaves()

### getSeed

    public int getSeed()

### getTile

    public Rectangle2D getTile()

### isFractalNoise

    public boolean isFractalNoise()

### getChannels

    public boolean[] getChannels()

### setupSeed

    public final int setupSeed(int seed)

### random

    public final int random(int seed)

### copyData

    public WritableRaster copyData(WritableRaster dest)

  Generates a Perlin noise pattern into dest Raster.

  Parameters:
    `dest` - Raster to fill with the pattern.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Apache Software Foundation. All Rights Reserved.