org.apache.batik.gvt.renderer
Class StrokingTextPainter

java.lang.Object
  |
  +--org.apache.batik.gvt.renderer.BasicTextPainter
        |
        +--org.apache.batik.gvt.renderer.StrokingTextPainter
All Implemented Interfaces:
TextPainter

public class StrokingTextPainter
extends BasicTextPainter

More sophisticated implementation of TextPainter which renders the attributed character iterator of a TextNode. StrokingTextPainter includes support for stroke, fill, opacity, text-decoration, and other attributes.

See Also:
TextPainter, GVTAttributedCharacterIterator

Fields inherited from class org.apache.batik.gvt.renderer.BasicTextPainter
cachedACI, cachedHit, cachedMark
 
Constructor Summary
StrokingTextPainter()
           
 
Method Summary
protected  java.awt.geom.Rectangle2D getBounds(TextNode node, java.awt.font.FontRenderContext context, boolean includeDecoration, boolean includeStrokeWidth)
           
 java.awt.Shape getHighlightShape(Mark beginMark, Mark endMark)
          Return a Shape, in the coordinate system of the text layout, which encloses the text selection delineated by two Mark instances.
protected  java.awt.Shape getOutline(TextNode node, java.awt.font.FontRenderContext frc, boolean includeDecoration)
          Get a Shape in userspace coords which defines the textnode glyph outlines.
 int[] getSelected(java.text.AttributedCharacterIterator aci, Mark startMark, Mark finishMark)
          Returns an array of ints representing begin/end index pairs into an AttributedCharacterIterator which represents the text selection delineated by two Mark instances.
protected  Mark hitTest(double x, double y, java.text.AttributedCharacterIterator aci, TextNode node, GraphicsNodeRenderContext context)
           
 void paint(TextNode node, java.awt.Graphics2D g2d, GraphicsNodeRenderContext context)
          Paints the specified attributed character iterator using the specified Graphics2D and rendering context.
 Mark selectFirst(double x, double y, java.text.AttributedCharacterIterator aci, TextNode node, GraphicsNodeRenderContext context)
          Selects the first glyph in the text node.
 Mark selectLast(double x, double y, java.text.AttributedCharacterIterator aci, TextNode node, GraphicsNodeRenderContext context)
          Selects the last glyph in the text node.
 
Methods inherited from class org.apache.batik.gvt.renderer.BasicTextPainter
getBounds, getDecoratedBounds, getDecoratedShape, getPaintedBounds, getShape, getStrokeOutline, getTextLayoutFactory, selectAll, selectAt, selectTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrokingTextPainter

public StrokingTextPainter()
Method Detail

paint

public void paint(TextNode node,
                  java.awt.Graphics2D g2d,
                  GraphicsNodeRenderContext context)
Paints the specified attributed character iterator using the specified Graphics2D and rendering context. Note that the GraphicsNodeRenderContext contains a TextPainter reference.
Parameters:
shape - the shape to paint
g2d - the Graphics2D to use
context - the rendering context.
See Also:
TextPainter, GraphicsNodeRenderContext

getBounds

protected java.awt.geom.Rectangle2D getBounds(TextNode node,
                                              java.awt.font.FontRenderContext context,
                                              boolean includeDecoration,
                                              boolean includeStrokeWidth)
Overrides:
getBounds in class BasicTextPainter

getOutline

protected java.awt.Shape getOutline(TextNode node,
                                    java.awt.font.FontRenderContext frc,
                                    boolean includeDecoration)
Get a Shape in userspace coords which defines the textnode glyph outlines.
Overrides:
getOutline in class BasicTextPainter
Parameters:
node - the TextNode to measure
frc - the font rendering context.
includeDecoration - whether to include text decoration outlines.

hitTest

protected Mark hitTest(double x,
                       double y,
                       java.text.AttributedCharacterIterator aci,
                       TextNode node,
                       GraphicsNodeRenderContext context)
Overrides:
hitTest in class BasicTextPainter

selectFirst

public Mark selectFirst(double x,
                        double y,
                        java.text.AttributedCharacterIterator aci,
                        TextNode node,
                        GraphicsNodeRenderContext context)
Selects the first glyph in the text node.

selectLast

public Mark selectLast(double x,
                       double y,
                       java.text.AttributedCharacterIterator aci,
                       TextNode node,
                       GraphicsNodeRenderContext context)
Selects the last glyph in the text node.

getSelected

public int[] getSelected(java.text.AttributedCharacterIterator aci,
                         Mark startMark,
                         Mark finishMark)
Returns an array of ints representing begin/end index pairs into an AttributedCharacterIterator which represents the text selection delineated by two Mark instances. Note: The Mark instances passed must have been instantiated by an instance of this enclosing TextPainter implementation.

getHighlightShape

public java.awt.Shape getHighlightShape(Mark beginMark,
                                        Mark endMark)
Return a Shape, in the coordinate system of the text layout, which encloses the text selection delineated by two Mark instances. Note: The Mark instances passed must have been instantiated by an instance of this enclosing TextPainter implementation.


Copyright © 2001 Apache Software Foundation. All Rights Reserved.