|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectShape3D
edu.cmu.sun.components.Text2DView
public class Text2DView
Renders text in LG3D by mapping a bitmap onto a polygon. This class was heavily based off of code from Sun Microsystems. This class is used because LG3D does not yet have a text system. The Shape3D that is created is aligned on the lwoer left point at the decender line. Other text functions usuially place text at the baseline. Be careful of this distinction. (If this doesn't make sense, look for typography diagrams to show the parts of a font.)
| Field Summary | |
|---|---|
private boolean |
bold
|
private static java.awt.FontMetrics |
fontMetrics
Font metrics * |
private static int |
fontQuality
Font quality * |
private IndexedGeometryArray |
geometry
Indexed geometry * |
protected float |
h
|
private float |
height
Height * |
private static int |
HEIGHT_MARGIN
Margin height * |
private float |
heightRatio
Height ration * |
static int |
MAX_FONT_QUALITY
Max font quality * |
static int |
MIN_FONT_QUALITY
Min font quality * |
private float |
prevAdjustedWidth
|
private static java.awt.Color |
textColor
Text color * |
private static java.awt.Font |
textFont
Text properties * |
private boolean |
vertical
|
protected float |
w
|
private float |
width
Width * |
private static int |
WIDTH_MARGIN
Margin width * |
private float |
widthRatio
Width ratio * |
| Constructor Summary | |
|---|---|
Text2DView(java.lang.String text,
float size,
int quality)
Class constructor that create a 2D text object. |
|
Text2DView(java.lang.String text,
float size,
int quality,
boolean bold)
|
|
Text2DView(java.lang.String text,
float size,
int quality,
java.awt.Color theColor)
Constructor to create non-black 2D text object |
|
Text2DView(java.lang.String text,
float size,
int quality,
java.awt.Color color,
float alpha)
Class constructor that create a 2D text object with user specified color and alpha. |
|
| Method Summary | |
|---|---|
java.awt.image.BufferedImage |
createMultilineImage(java.util.ArrayList<java.lang.String> textLines,
int maxLineLength,
int indentPixels)
|
void |
createText2DColorTransp(java.lang.String text,
float size,
int quality,
java.awt.Color color,
float alpha)
Create a 2D text object with a transperancy. |
private Texture |
createTexture(java.lang.String text)
Create a texture for the text. |
private java.awt.image.BufferedImage |
createTextureImage(java.lang.String text)
Create a buffered image from the text. |
float |
getHeight()
|
private int |
getRoundUptoPow2(int n)
Round up method. |
float |
getWidth()
|
private void |
setFontQuality(int quality)
Set the font quality between 12pt and 122pt |
void |
setWidth(float maxWidth)
Sets the width of the text |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int WIDTH_MARGIN
private static final int HEIGHT_MARGIN
public static final int MAX_FONT_QUALITY
public static final int MIN_FONT_QUALITY
private static java.awt.Font textFont
private static java.awt.Color textColor
private static java.awt.FontMetrics fontMetrics
private static int fontQuality
private float width
private float height
protected float w
protected float h
private IndexedGeometryArray geometry
private float widthRatio
private float heightRatio
private float prevAdjustedWidth
private boolean vertical
private boolean bold
| Constructor Detail |
|---|
public Text2DView(java.lang.String text,
float size,
int quality,
boolean bold)
public Text2DView(java.lang.String text,
float size,
int quality)
text - string to createsize - of the text objectquality - of the font used. Ranges from MAX_FONT_QUALITY = 10 to
MIN_FONT_QUALITY = 1;
public Text2DView(java.lang.String text,
float size,
int quality,
java.awt.Color theColor)
public Text2DView(java.lang.String text,
float size,
int quality,
java.awt.Color color,
float alpha)
text - string to createsize - of the text objectquality - of the font used. Ranges from MAX_FONT_QUALITY = 10 to
MIN_FONT_QUALITY = 1color - of the textalpha - /transparency of the text| Method Detail |
|---|
public void setWidth(float maxWidth)
maxWidth - of the text
public void createText2DColorTransp(java.lang.String text,
float size,
int quality,
java.awt.Color color,
float alpha)
text - string to createsize - of the text objectquality - of the font used.color - of the textalpha - /transparency of the textprivate void setFontQuality(int quality)
quality - of the font of which to be set.
public java.awt.image.BufferedImage createMultilineImage(java.util.ArrayList<java.lang.String> textLines,
int maxLineLength,
int indentPixels)
private java.awt.image.BufferedImage createTextureImage(java.lang.String text)
text - string to display.
private int getRoundUptoPow2(int n)
n - is the number to round up.
private Texture createTexture(java.lang.String text)
text - string to texture.
public float getHeight()
public float getWidth()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||