NASA World Wind

gov.nasa.worldwind.render
Class PatternFactory

java.lang.Object
  extended by gov.nasa.worldwind.render.PatternFactory

public class PatternFactory
extends Object

Static class to creates tilable patterns.

The createPattern() method draws a shape inside a usually square bitmap, so that it will match if tiled.

Each pattern supports a scale factor between zero and one - default is .5. With a scale of zero no pattern will be produced. With a scale of one the pattern will cover all the background.


Field Summary
static String GRADIENT_HLINEAR
           
static String GRADIENT_VLINEAR
           
static String PATTERN_CIRCLE
           
static String PATTERN_CIRCLES
           
static String PATTERN_DIAGONAL_DOWN
           
static String PATTERN_DIAGONAL_UP
           
static String PATTERN_HLINE
           
static String PATTERN_HVLINE
           
static String PATTERN_SQUARE
           
static String PATTERN_SQUARES
           
static String PATTERN_TRIANGLE_UP
           
static String PATTERN_VLINE
           
 
Constructor Summary
PatternFactory()
           
 
Method Summary
static BufferedImage blur(BufferedImage sourceImage)
          Blurs an image.
static BufferedImage blur(BufferedImage sourceImage, int kernelSize)
          Blurs an image with a specified convolution matrix size.
static BufferedImage createPattern(String pattern)
          Draws a pattern using the default scale (.5), bitmap dimensions (32x32) and colors (light grey over a transparent background).
static BufferedImage createPattern(String pattern, Color lineColor)
          Draws a pattern with a given Color using the default scale (.5), bitmap dimensions (32x32) and backgound color (transparent).
static BufferedImage createPattern(String pattern, Dimension size, float scale, Color lineColor)
          Draws a pattern with a given scale, Color and bitmap dimensions, using the default backgound color (transparent).
static BufferedImage createPattern(String pattern, Dimension size, float scale, Color lineColor, Color backColor)
          Draws a pattern with the given scale, Colors and bitmap dimensions.
static BufferedImage createPattern(String pattern, float scale)
          Draws a pattern with a given scale using the default bitmap dimensions (32x32) and colors (light grey over a transparent background).
static BufferedImage createPattern(String pattern, float scale, Color lineColor)
          Draws a pattern with a given scale and Color using the default bitmap dimensions (32x32) and backgound color (transparent).
static BufferedImage createPattern(String pattern, float scale, Color lineColor, Color backColor)
          Draws a pattern with a given scale and Colors using the default bitmap dimensions (32x32).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRADIENT_HLINEAR

public static final String GRADIENT_HLINEAR
See Also:
Constant Field Values

GRADIENT_VLINEAR

public static final String GRADIENT_VLINEAR
See Also:
Constant Field Values

PATTERN_CIRCLE

public static final String PATTERN_CIRCLE
See Also:
Constant Field Values

PATTERN_CIRCLES

public static final String PATTERN_CIRCLES
See Also:
Constant Field Values

PATTERN_DIAGONAL_DOWN

public static final String PATTERN_DIAGONAL_DOWN
See Also:
Constant Field Values

PATTERN_DIAGONAL_UP

public static final String PATTERN_DIAGONAL_UP
See Also:
Constant Field Values

PATTERN_HLINE

public static final String PATTERN_HLINE
See Also:
Constant Field Values

PATTERN_HVLINE

public static final String PATTERN_HVLINE
See Also:
Constant Field Values

PATTERN_SQUARE

public static final String PATTERN_SQUARE
See Also:
Constant Field Values

PATTERN_SQUARES

public static final String PATTERN_SQUARES
See Also:
Constant Field Values

PATTERN_TRIANGLE_UP

public static final String PATTERN_TRIANGLE_UP
See Also:
Constant Field Values

PATTERN_VLINE

public static final String PATTERN_VLINE
See Also:
Constant Field Values
Constructor Detail

PatternFactory

public PatternFactory()
Method Detail

blur

public static BufferedImage blur(BufferedImage sourceImage)
Blurs an image.

Parameters:
sourceImage - the image to blur.
Returns:
the blurred image.

blur

public static BufferedImage blur(BufferedImage sourceImage,
                                 int kernelSize)
Blurs an image with a specified convolution matrix size.

Parameters:
sourceImage - the image to blur.
kernelSize - the convolution matrix size.
Returns:
the blurred image.

createPattern

public static BufferedImage createPattern(String pattern)
Draws a pattern using the default scale (.5), bitmap dimensions (32x32) and colors (light grey over a transparent background).

Parameters:
pattern - the pattern to draw. See PatternFactory static constants.
Returns:
the corresponding BufferedImage.

createPattern

public static BufferedImage createPattern(String pattern,
                                          Color lineColor)
Draws a pattern with a given Color using the default scale (.5), bitmap dimensions (32x32) and backgound color (transparent).

Parameters:
pattern - the pattern to draw. See PatternFactory static constants.
lineColor - the pattern Color.
Returns:
the corresponding BufferedImage.

createPattern

public static BufferedImage createPattern(String pattern,
                                          Dimension size,
                                          float scale,
                                          Color lineColor)
Draws a pattern with a given scale, Color and bitmap dimensions, using the default backgound color (transparent).

Parameters:
pattern - the pattern to draw. See PatternFactory static constants.
size - the Dimension of the BufferedImage produced.
scale - the scale at which the pattern should be drawn (0 to 1).
lineColor - the pattern Color.
Returns:
the corresponding BufferedImage.

createPattern

public static BufferedImage createPattern(String pattern,
                                          Dimension size,
                                          float scale,
                                          Color lineColor,
                                          Color backColor)
Draws a pattern with the given scale, Colors and bitmap dimensions.

Parameters:
pattern - the pattern to draw. See PatternFactory static constants.
size - the Dimension of the BufferedImage produced.
scale - the scale at which the pattern should be drawn (0 to 1).
lineColor - the pattern Color.
backColor - the pattern background Color.
Returns:
the corresponding BufferedImage.

createPattern

public static BufferedImage createPattern(String pattern,
                                          float scale)
Draws a pattern with a given scale using the default bitmap dimensions (32x32) and colors (light grey over a transparent background).

Parameters:
pattern - the pattern to draw. See PatternFactory static constants.
scale - the scale at which the pattern should be drawn (0 to 1).
Returns:
the corresponding BufferedImage.

createPattern

public static BufferedImage createPattern(String pattern,
                                          float scale,
                                          Color lineColor)
Draws a pattern with a given scale and Color using the default bitmap dimensions (32x32) and backgound color (transparent).

Parameters:
pattern - the pattern to draw. See PatternFactory static constants.
scale - the scale at which the pattern should be drawn (0 to 1).
lineColor - the pattern Color.
Returns:
the corresponding BufferedImage.

createPattern

public static BufferedImage createPattern(String pattern,
                                          float scale,
                                          Color lineColor,
                                          Color backColor)
Draws a pattern with a given scale and Colors using the default bitmap dimensions (32x32).

Parameters:
pattern - the pattern to draw. See PatternFactory static constants.
scale - the scale at which the pattern should be drawn (0 to 1).
lineColor - the pattern Color.
backColor - the pattern background Color.
Returns:
the corresponding BufferedImage.

NASA World Wind