public class CachedLabelSceneObject extends LabelSceneObject
LabelSceneObject
that draws the text on a cached BufferedImage
. This speeds up
drawing when animating text, but the quality might be less.LabelSceneObject
ORIGIN_TOP_LEFT
Constructor and Description |
---|
CachedLabelSceneObject() |
CachedLabelSceneObject(String text) |
Modifier and Type | Method and Description |
---|---|
protected void |
paint(Graphics2D g,
long elapsedTime)
Paint this SceneObject.
|
void |
setColor(Color color) |
void |
setDrawBoundingBox(boolean drawBoundingBox)
Change the drawing state of the bounding box.
|
void |
setFont(Font font)
Set the font used to draw the text.
|
void |
setFontFlags(int fontFlags)
Set the font flags as specified by
Font.layoutGlyphVector(java.awt.font.FontRenderContext, char[], int, int, int) |
void |
setHorizontalTextOrientation(Orientation.HorizontalOrientation horizontalTextOrientation)
Set the horizontal orientation of the drawn text
|
void |
setOutlineColor(Color outlineColor)
Set the color for outline painting
|
void |
setOutlinePaint(Paint outlinePaint)
Set the
Paint , that is used for drawing outlines |
void |
setPaint(Paint paint)
Set the
Paint , that is used for drawing |
void |
setScaleStrategy(FontScaleStrategy scaleStrategy)
Set the used
FontScaleStrategy . |
void |
setSize(int width,
int height) |
void |
setSize(Size size)
Set the size of this
SceneObject |
void |
setStroke(Stroke stroke)
Set the
Stroke , that is used for text drawing |
void |
setText(String text)
Set the text, this label will draw
|
void |
setVerticalTextOrientation(Orientation.VerticalOrientation verticalTextOrientation)
Set the vertical orientation of the drawn text
|
getFont, getFontFlags, getHorizontalTextOrientation, getOutlinePaint, getPaint, getScaleStrategy, getStroke, getText, getVerticalTextOrientation
collides, collidesBoundingBox, collidesExactly, consumes, consumesBoundingBox, consumesExactly, getHeight, getOrigin, getPosition, getPreciseHeight, getPreciseWidth, getPreciseX, getPreciseY, getRectangle, getRenderingOptions, getSize, getTopLeftPosition, getWidth, getX, getY, isDrawBoundingBox, paintAbsoluteOnScene, paintOnScene, paintOnScene, paintOnScene, paintOnScene, setPosition, setPosition, setRenderingOptions, setTopLeftPosition
public CachedLabelSceneObject(String text)
public CachedLabelSceneObject()
protected void paint(Graphics2D g, long elapsedTime)
SceneObject
SceneObject
it is
important, that the object is drawn in it's actual state.paint
in class LabelSceneObject
g
- Graphics Object for paintingelapsedTime
- Elapsed time since the last call to this methodpublic void setText(String text)
LabelSceneObject
setText
in class LabelSceneObject
text
- The text that will be drawnpublic void setSize(int width, int height)
setSize
in class SceneObject
width
- Width of this ScreenObjectheight
- Height of this ScreenObjectSceneObject.setSize(Size)
public void setSize(Size size)
SceneObject
SceneObject
setSize
in class SceneObject
size
- Size of this ScreenObjectpublic void setColor(Color color)
setColor
in class LabelSceneObject
color
- The color for drawing the stringLabelSceneObject.setPaint(Paint)
public void setFont(Font font)
LabelSceneObject
setFont
in class LabelSceneObject
font
- Used font for drawingpublic void setFontFlags(int fontFlags)
LabelSceneObject
Font.layoutGlyphVector(java.awt.font.FontRenderContext, char[], int, int, int)
setFontFlags
in class LabelSceneObject
fontFlags
- The flags used for creating the GlyphVector
public void setDrawBoundingBox(boolean drawBoundingBox)
SceneObject
setDrawBoundingBox
in class SceneObject
drawBoundingBox
- true if the bounding box should be paintedpublic void setHorizontalTextOrientation(Orientation.HorizontalOrientation horizontalTextOrientation)
LabelSceneObject
setHorizontalTextOrientation
in class LabelSceneObject
horizontalTextOrientation
- Horizontal orientation of the drawn textpublic void setOutlineColor(Color outlineColor)
LabelSceneObject
setOutlineColor
in class LabelSceneObject
outlineColor
- Color for outline paintingLabelSceneObject.setOutlinePaint(Paint)
public void setOutlinePaint(Paint outlinePaint)
LabelSceneObject
Paint
, that is used for drawing outlinessetOutlinePaint
in class LabelSceneObject
outlinePaint
- The paint used for drawing outlinespublic void setPaint(Paint paint)
LabelSceneObject
Paint
, that is used for drawingsetPaint
in class LabelSceneObject
paint
- The paint used for drawingpublic void setStroke(Stroke stroke)
LabelSceneObject
Stroke
, that is used for text drawingsetStroke
in class LabelSceneObject
stroke
- The stroke used for text drawingpublic void setVerticalTextOrientation(Orientation.VerticalOrientation verticalTextOrientation)
LabelSceneObject
setVerticalTextOrientation
in class LabelSceneObject
verticalTextOrientation
- Vertical orientation of the drawn textpublic void setScaleStrategy(FontScaleStrategy scaleStrategy)
LabelSceneObject
FontScaleStrategy
. If the scale strategy is not
FontScaleStrategy.NoScale
the size of the Font
is ignored.setScaleStrategy
in class LabelSceneObject
scaleStrategy
- The strategy, that will be used fore scaling the textCopyright © 2017. All rights reserved.