com.jgoodies.animation.renderer

Class AbstractTextRenderer

Implemented Interfaces:
AnimationRenderer
Known Direct Subclasses:
BasicTextRenderer, GlyphRenderer

public abstract class AbstractTextRenderer
extends java.lang.Object
implements AnimationRenderer

An abstract superclass that helps implementing typographic animation renderers.
Version:
$Revision: 1.1 $
Author:
Karsten Lentzsch

Field Summary

protected Shape[]
cachedGlyphShapes
protected GlyphVector
cachedGlyphVector
protected float
cachedTextAscent
protected float
cachedTextHeight
protected float
cachedTextWidth
protected float
capitalMAscent

Method Summary

protected void
ensureValidCache(Graphics2D g2)
protected float
getAdjustedAscent()
Computes and answers the text ascent using the current height mode.
protected float
getAdjustedDescent()
Computes and answers the text descent using the current height mode.
Color
getColor()
Font
getFont()
HeightMode
getHeightMode()
String
getText()
protected void
invalidateCache()
Invalidates the cache.
protected boolean
isCacheValid()
protected void
setCacheValid(boolean b)
void
setColor(Color color)
void
setFont(Font newFont)
Sets the renderer's font.
void
setHeightMode(HeightMode heightMode)
void
setText(String newText)
Sets the renderer's text.
protected void
validateCache(Graphics2D g2)
Validates the cache, here: creates a GlyphVector and computes and stores its size information.

Field Details

cachedGlyphShapes

protected Shape[] cachedGlyphShapes

cachedGlyphVector

protected GlyphVector cachedGlyphVector

cachedTextAscent

protected float cachedTextAscent

cachedTextHeight

protected float cachedTextHeight

cachedTextWidth

protected float cachedTextWidth

capitalMAscent

protected float capitalMAscent

Method Details

ensureValidCache

protected void ensureValidCache(Graphics2D g2)

getAdjustedAscent

protected float getAdjustedAscent()
Computes and answers the text ascent using the current height mode.
Returns:
the ascent adjusted using the current height mode

getAdjustedDescent

protected float getAdjustedDescent()
Computes and answers the text descent using the current height mode.
Returns:
the descent adjusted to the current height mode

getColor

public Color getColor()

getFont

public Font getFont()

getHeightMode

public HeightMode getHeightMode()

getText

public String getText()

invalidateCache

protected void invalidateCache()
Invalidates the cache.

isCacheValid

protected boolean isCacheValid()

setCacheValid

protected void setCacheValid(boolean b)

setColor

public void setColor(Color color)

setFont

public void setFont(Font newFont)
Sets the renderer's font.
Parameters:
newFont - the font to be set

setHeightMode

public void setHeightMode(HeightMode heightMode)

setText

public void setText(String newText)
Sets the renderer's text.
Parameters:
newText - the text to be set

validateCache

protected void validateCache(Graphics2D g2)
Validates the cache, here: creates a GlyphVector and computes and stores its size information.
Parameters:
g2 - the Graphics object used to get the font render context

Copyright © 2001-2006 JGoodies Karsten Lentzsch. All Rights Reserved.