public class AWTDrawVisitor extends AbstractAWTDrawVisitor
IDrawVisitor
interface for the AWT
widget toolkit, allowing molecules to be rendered with toolkits based on
AWT, like the Java reference graphics platform Swing.transform
Constructor and Description |
---|
AWTDrawVisitor(Graphics2D graphics)
Constructs a new
IDrawVisitor using the AWT widget toolkit,
taking a Graphics2D object to which the chemical content
is drawn. |
Modifier and Type | Method and Description |
---|---|
static AWTDrawVisitor |
forVectorGraphics(Graphics2D g2)
Create a draw visitor that will be rendering to a vector graphics output.
|
Graphics2D |
getGraphics()
Returns the
Graphics2D for for this visitor. |
RendererModel |
getRendererModel()
Returns the current
RendererModel . |
Map<Integer,BasicStroke> |
getStrokeMap()
Returns the current stroke map.
|
void |
setFontManager(IFontManager fontManager)
The font manager must be set by any renderer that uses this class!
This manager is needed to keep track of fonts of the right size.
|
void |
setRendererModel(RendererModel rendererModel)
Sets the
RendererModel this IDrawVisitor should use. |
void |
setRounding(boolean val)
Set whether we should we round coordinates to ints, this tries to circumvent
graphical glitches from AWT where floating points are truncated (e.g.
|
void |
visit(IRenderingElement element)
Translates a
IRenderingElement into a widget toolkit specific
rendering element. |
getTextBasePoint, getTextBounds, getTextBounds, setTransform, transformPoint, transformPoint
public AWTDrawVisitor(Graphics2D graphics)
IDrawVisitor
using the AWT widget toolkit,
taking a Graphics2D
object to which the chemical content
is drawn.graphics
- Graphics2D
to which will be drawnpublic RendererModel getRendererModel()
RendererModel
.public Map<Integer,BasicStroke> getStrokeMap()
Map
with Integer as keys and BasicStroke
s.public Graphics2D getGraphics()
Graphics2D
for for this visitor.Graphics2D
objectpublic static AWTDrawVisitor forVectorGraphics(Graphics2D g2)
g2
- graphics environmentpublic void setRounding(boolean val)
val
- rounding modepublic void visit(IRenderingElement element)
IRenderingElement
into a widget toolkit specific
rendering element.element
- Abstract rendering element reflecting some part of the
chemical drawing.public void setFontManager(IFontManager fontManager)
fontManager
- the IFontManager
to be usedpublic void setRendererModel(RendererModel rendererModel)
RendererModel
this IDrawVisitor
should use.rendererModel
- the RendererModel
to be usedCopyright © 2021. All rights reserved.