com.sun.lwuit.util
Class Effects

java.lang.Object
  extended by com.sun.lwuit.util.Effects

public class Effects
extends java.lang.Object

Static utility class useful for simple visual effects that don't quite fit anywhere else in the core API.


Method Summary
static void growShrink(Component c, int duration)
          Deprecated. use Component.growShrink instead
static Image reflectionImage(Image source)
          Takes the given image and appends an effect of reflection bellow it that is similar to the way elements appear in water beneath them.
static Image reflectionImage(Image source, float mirrorRatio, int alphaRatio)
          Takes the given image and appends an effect of reflection bellow it that is similar to the way elements appear in water beneath them.
static Image reflectionImage(Image source, float mirrorRatio, int alphaRatio, int spacing)
          Takes the given image and appends an effect of reflection bellow it that is similar to the way elements appear in water beneath them.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

reflectionImage

public static Image reflectionImage(Image source)
Takes the given image and appends an effect of reflection bellow it that is similar to the way elements appear in water beneath them. This method shouldn't be used when numAlpha is very low.

Parameters:
source - image to add the reflection effect to
Returns:
new image with a reflection effect for the source image

reflectionImage

public static Image reflectionImage(Image source,
                                    float mirrorRatio,
                                    int alphaRatio)
Takes the given image and appends an effect of reflection bellow it that is similar to the way elements appear in water beneath them. This method shouldn't be used when numAlpha is very low.

Parameters:
source - image to add the reflection effect to
mirrorRatio - generally less than 1, a mirror ration of 0.5f will create a mirror image half the height of the image, 0.75f will create a 3 quarter height mirror etc.
alphaRatio - starting point for the alpha value in the mirror, this should be a number between 0 - 255 (recommended larger than 0) indicating the opacity of the closest pixel. For a mirror thats completely opaque use 255. A recommended value would be between 128 to 90.
Returns:
new image with a reflection effect for the source image

reflectionImage

public static Image reflectionImage(Image source,
                                    float mirrorRatio,
                                    int alphaRatio,
                                    int spacing)
Takes the given image and appends an effect of reflection bellow it that is similar to the way elements appear in water beneath them. This method shouldn't be used when numAlpha is very low.

Parameters:
source - image to add the reflection effect to
mirrorRatio - generally less than 1, a mirror ration of 0.5f will create a mirror image half the height of the image, 0.75f will create a 3 quarter height mirror etc.
alphaRatio - starting point for the alpha value in the mirror, this should be a number between 0 - 255 (recommended larger than 0) indicating the opacity of the closest pixel. For a mirror thats completely opaque use 255. A recommended value would be between 128 to 90.
spacing - the distance in pixels between the image and its reflection
Returns:
new image with a reflection effect for the source image

growShrink

public static void growShrink(Component c,
                              int duration)
Deprecated. use Component.growShrink instead

Grows or shrinks the given component to its new preferred size, this method essentially takes a component whose preferred size has changed and creates a "growing" effect that lasts for the duration. Notice that some components (such as text areas) don't report proper preferred size untill they are laid out once. Hence the first time around a text area (or container containing a text area) will not produce the expected effect. This can be solved by invoking revalidate before the call to this method only the first time around!

Parameters:
c - the component to grow/shrink, its size must be different from its preferred size
duration - the duration in milliseconds for the grow/shrink animation