Class 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 Detail

      • 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 a GlyphRenderer that paints individual glyphs with different transforms.
        Parameters:
        text - the initial text
        scaleFunction - maps times to glyph scales
        translateFunction - maps times to glyph translations
        colorFunction - maps times to colors
        glyphDelay - 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 on
        width - the width of the graphics area
        height - the height of the graphics area