APIdia Launch Partner
Top Fields Constructors Methods
com.badlogic.gdx.tools.hiero.unicodefont.effects

public Class ShadowEffect

extends Object
implements ConfigurableEffect
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect, com.badlogic.gdx.tools.hiero.unicodefont.effects.Effect
Imports
java.awt.AlphaComposite, .Color, .Composite, .Graphics2D, .RenderingHints, java.awt.image.BufferedImage, .ConvolveOp, .Kernel, java.util.ArrayList, .Iterator, .List, com.badlogic.gdx.tools.hiero.unicodefont.Glyph, .UnicodeFont

Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
private int
private int
private Color
public static final float[][]
GAUSSIAN_BLUR_KERNELS

The blur kernels applied across the effect

public static final int
NUM_KERNELS

The numberof kernels to apply

private float
private float
private float

Constructor Summary

AccessConstructor and Description
public
public
ShadowEffect(Color color, int xDistance, int yDistance, float opacity)

Method Summary

Modifier and TypeMethod and Description
private void
public void
draw(BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph)

Implements com.badlogic.gdx.tools.hiero.unicodefont.effects.Effect.draw.

Called to draw the effect.

private static float[][]

Returns:

The kernels generated
generateGaussianBlurKernels
(int
The number of kernels to generate
level
)

Generate the blur kernels which will be repeatedly applied when blurring images

private static float[][]

Returns:

The Pascal's triangle kernel
generatePascalsTriangle
(int
The level of the triangle to generate
level
)

Generate Pascal's triangle

public int
public int
public Color
public float
public List<E>
public float
public float
public void
setBlurKernelSize(int blurKernelSize)

Sets how many neighboring pixels are used to blur the shadow.

public void
setBlurPasses(int blurPasses)

Sets the number of times to apply a blur to the shadow.

public void
setColor(Color color)

public void
setOpacity(float opacity)

public void
public void
setXDistance(float distance)

Sets the pixels to offset the shadow on the x axis.

public void
setYDistance(float distance)

Sets the pixels to offset the shadow on the y axis.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

blurKernelSizeback to summary
private int blurKernelSize
blurPassesback to summary
private int blurPasses
colorback to summary
private Color color
GAUSSIAN_BLUR_KERNELSback to summary
public static final float[][] GAUSSIAN_BLUR_KERNELS

The blur kernels applied across the effect

NUM_KERNELSback to summary
public static final int NUM_KERNELS

The numberof kernels to apply

opacityback to summary
private float opacity
xDistanceback to summary
private float xDistance
yDistanceback to summary
private float yDistance

Constructor Detail

ShadowEffectback to summary
public ShadowEffect()
ShadowEffectback to summary
public ShadowEffect(Color color, int xDistance, int yDistance, float opacity)

Method Detail

blurback to summary
private void blur(BufferedImage image)
drawback to summary
public void draw(BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph)

Implements com.badlogic.gdx.tools.hiero.unicodefont.effects.Effect.draw.

Doc from com.badlogic.gdx.tools.hiero.unicodefont.effects.Effect.draw.

Called to draw the effect.

generateGaussianBlurKernelsback to summary
private static float[][] generateGaussianBlurKernels(int level)

Generate the blur kernels which will be repeatedly applied when blurring images

Parameters
level:int

The number of kernels to generate

Returns:float[][]

The kernels generated

generatePascalsTriangleback to summary
private static float[][] generatePascalsTriangle(int level)

Generate Pascal's triangle

Parameters
level:int

The level of the triangle to generate

Returns:float[][]

The Pascal's triangle kernel

getBlurKernelSizeback to summary
public int getBlurKernelSize()
getBlurPassesback to summary
public int getBlurPasses()
getColorback to summary
public Color getColor()
getOpacityback to summary
public float getOpacity()
getValuesback to summary
public List<E> getValues()

Implements com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect.getValues.

Doc from com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect.getValues.

Returns the list of Values for this effect. This list is not typically backed by the effect, so changes to the values will not take affect until setValues(List) is called.

getXDistanceback to summary
public float getXDistance()
getYDistanceback to summary
public float getYDistance()
setBlurKernelSizeback to summary
public void setBlurKernelSize(int blurKernelSize)

Sets how many neighboring pixels are used to blur the shadow. Set to 0 for no blur.

setBlurPassesback to summary
public void setBlurPasses(int blurPasses)

Sets the number of times to apply a blur to the shadow. Set to 0 for no blur.

setColorback to summary
public void setColor(Color color)
setOpacityback to summary
public void setOpacity(float opacity)
setValuesback to summary
public void setValues(List<E> values)

Implements com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect.setValues.

Doc from com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect.setValues.

Sets the list of Values for this effect.

setXDistanceback to summary
public void setXDistance(float distance)

Sets the pixels to offset the shadow on the x axis. The glyphs will need padding so the shadow doesn't get clipped.

setYDistanceback to summary
public void setYDistance(float distance)

Sets the pixels to offset the shadow on the y axis. The glyphs will need padding so the shadow doesn't get clipped.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.