Class JOGLTextRenderer2d
- java.lang.Object
-
- org.jzy3d.plot3d.text.AbstractTextRenderer
-
- org.jzy3d.plot3d.text.renderers.jogl.JOGLTextRenderer2d
-
- All Implemented Interfaces:
ITextRenderer
public class JOGLTextRenderer2d extends AbstractTextRenderer implements ITextRenderer
Render 2D texts using JOGLTextRenderer
. The text color is defined either byTextRenderer.setColor(java.awt.Color)
or inside the implementation ofTextRenderer.RenderDelegate.draw(java.awt.Graphics2D, String, int, int)
if theTextRenderer
is initialized with a non nullTextRenderer.RenderDelegate
. Note that Jzy3d and JOGL behave differently with text rendering- Jzy3d's text color is defined for each string.
- JOGL's text color is defined globally and can not be changed consistently afterward if it
uses a
TextRenderer.RenderDelegate
.
- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field Description protected Font
awtFont
protected AWTTextLayout
layout
protected com.jogamp.opengl.util.awt.TextRenderer.RenderDelegate
renderDelegate
protected com.jogamp.opengl.util.awt.TextRenderer
renderer
protected float
scaleFactor
-
Fields inherited from class org.jzy3d.plot3d.text.AbstractTextRenderer
NO_ROTATION, NO_SCENE_OFFSET, NO_SCREEN_OFFSET, spaceTransformer
-
-
Constructor Summary
Constructors Constructor Description JOGLTextRenderer2d()
JOGLTextRenderer2d(Font font)
JOGLTextRenderer2d(Font font, com.jogamp.opengl.util.awt.TextRenderer.RenderDelegate renderDelegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configureRenderer()
BoundingBox3d
drawText(IPainter painter, Font font, String s, Coord3d position, float rotation, Horizontal horizontal, Vertical vertical, Color color, Coord2d screenOffset, Coord3d sceneOffset)
The main text renderer method to implement.protected void
drawText2D(IPainter painter, Font font, String text, Coord3d position, Color color, float rotation, Horizontal horizontal, Vertical vertical)
Draws a 2D text (facing camera) at the specified 3D position.protected void
resetTextColor(Color color)
-
Methods inherited from class org.jzy3d.plot3d.text.AbstractTextRenderer
drawText, drawText, drawText, drawText, drawText, drawText, getSpaceTransformer, setSpaceTransformer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jzy3d.plot3d.text.ITextRenderer
drawText, drawText, drawText, drawText, drawText, drawText, getSpaceTransformer, setSpaceTransformer
-
-
-
-
Field Detail
-
awtFont
protected Font awtFont
-
renderer
protected com.jogamp.opengl.util.awt.TextRenderer renderer
-
renderDelegate
protected com.jogamp.opengl.util.awt.TextRenderer.RenderDelegate renderDelegate
-
scaleFactor
protected float scaleFactor
-
layout
protected AWTTextLayout layout
-
-
Constructor Detail
-
JOGLTextRenderer2d
public JOGLTextRenderer2d()
-
JOGLTextRenderer2d
public JOGLTextRenderer2d(Font font)
-
JOGLTextRenderer2d
public JOGLTextRenderer2d(Font font, com.jogamp.opengl.util.awt.TextRenderer.RenderDelegate renderDelegate)
- Parameters:
font
- text font, style and size.renderDelegate
- may be null if no particular custom styling should be applied.
-
-
Method Detail
-
drawText
public BoundingBox3d drawText(IPainter painter, Font font, String s, Coord3d position, float rotation, Horizontal horizontal, Vertical vertical, Color color, Coord2d screenOffset, Coord3d sceneOffset)
Description copied from interface:ITextRenderer
The main text renderer method to implement. Other are shortcuts implemented byAbstractTextRenderer
.- Specified by:
drawText
in interfaceITextRenderer
-
drawText2D
protected void drawText2D(IPainter painter, Font font, String text, Coord3d position, Color color, float rotation, Horizontal horizontal, Vertical vertical)
Draws a 2D text (facing camera) at the specified 3D position.
-
resetTextColor
protected void resetTextColor(Color color)
-
configureRenderer
protected void configureRenderer()
-
-