Package com.jgoodies.animation.renderer
Class GlyphRenderer
- java.lang.Object
-
- com.jgoodies.animation.renderer.AbstractTextRenderer
-
- com.jgoodies.animation.renderer.GlyphRenderer
-
- All Implemented Interfaces:
AnimationRenderer
public final class GlyphRenderer extends AbstractTextRenderer
Renders the glyphs of a string with individual scaling, transform, and color.- Version:
- $Revision: 1.9 $
-
-
Field Summary
Fields Modifier and Type Field Description private AnimationFunction<java.awt.Color>
colorFunction
private long
glyphDelay
private AnimationFunction<java.lang.Float>
scaleFunction
private long
time
-
Fields inherited from class com.jgoodies.animation.renderer.AbstractTextRenderer
cachedGlyphShapes, cachedGlyphVector, cachedTextAscent, cachedTextHeight, cachedTextWidth, capitalMAscent
-
-
Constructor Summary
Constructors Constructor Description GlyphRenderer(java.lang.String text, AnimationFunction<java.lang.Float> scaleFunction, AnimationFunction<java.lang.Float> translateFunction, AnimationFunction<java.awt.Color> colorFunction, long glyphDelay)
Constructs aGlyphRenderer
that paints individual glyphs with different transforms.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.awt.Color
colorAt(int glyphIndex)
long
getTime()
private long
relativeTime(int glyphIndex)
void
render(java.awt.Graphics2D g2, int width, int height)
Renders the text.private float
scaleAt(int glyphIndex)
void
setTime(long time)
-
Methods inherited from class com.jgoodies.animation.renderer.AbstractTextRenderer
ensureValidCache, getAdjustedAscent, getAdjustedDescent, getColor, getFont, getHeightMode, getText, invalidateCache, isCacheValid, setCacheValid, setColor, setFont, setHeightMode, setText, validateCache
-
-
-
-
Field Detail
-
colorFunction
private final AnimationFunction<java.awt.Color> colorFunction
-
scaleFunction
private final AnimationFunction<java.lang.Float> scaleFunction
-
glyphDelay
private final long glyphDelay
-
time
private long time
-
-
Constructor Detail
-
GlyphRenderer
public GlyphRenderer(java.lang.String text, AnimationFunction<java.lang.Float> scaleFunction, AnimationFunction<java.lang.Float> translateFunction, AnimationFunction<java.awt.Color> colorFunction, long glyphDelay)
Constructs aGlyphRenderer
that paints individual glyphs with different transforms.- Parameters:
text
- the initial textscaleFunction
- maps times to glyph scalestranslateFunction
- maps times to glyph translationscolorFunction
- maps times to colorsglyphDelay
- a time delay between the glyph animations
-
-
Method Detail
-
getTime
public long getTime()
-
setTime
public void setTime(long time)
-
relativeTime
private long relativeTime(int glyphIndex)
-
scaleAt
private float scaleAt(int glyphIndex)
-
colorAt
private java.awt.Color colorAt(int glyphIndex)
-
render
public void render(java.awt.Graphics2D g2, int width, int height)
Renders the text. Firstly, ensures a valid cache, then sets the color, and finally paints the cached glyph shaped, using individual transforms.- Parameters:
g2
- the graphics object to render onwidth
- the width of the graphics areaheight
- the height of the graphics area
-
-