|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuavsim.graphics.text.VectorText
public class VectorText
Renders text strings as scalable vector line drawings. ASCII characters 32 through 126 are supported; any other character appears as a small diamond that indicates it is undefined. In addition, ASCII 127 and 128 are special left and right arrows, respectively.
| Field Summary | |
|---|---|
private java.awt.Graphics2D |
_graphics
the graphics context |
private static int |
ANCHOR_SIZE
the size of the anchor in pixels |
private static double |
ITALICS_GRADIENT
the slant run over rise for italic characters |
private static boolean |
SHOW_ANCHOR
whether to show the anchor for the text string. |
| Constructor Summary | |
|---|---|
VectorText(java.awt.Graphics2D graphics)
Creates a vector text object. |
|
| Method Summary | |
|---|---|
static double |
calculateAngle(double x,
double y)
Calculates the vector angle from a Cartesian coordinate. |
static double |
calculateRadius(double x,
double y)
Calculates the vector length from a Cartesian coordinate. |
java.awt.Polygon |
generateBoundingPolygon(java.lang.String text,
TextProperties textProperties,
java.awt.Point anchor)
Generates a bounding polygon for a formatted text string. |
private int[][][] |
generateText(java.lang.String text,
TextProperties textProperties)
Generates the staging grid of vector line segments corresponding to a formatted text string. |
static java.awt.Dimension |
getTextDimensions(java.lang.String text,
TextProperties textProperties)
Determines the bounding box of a formatted text string in its canonical form (i.e., not rotated). |
static java.awt.Point |
getTextOrigin(java.lang.String text,
TextProperties textProperties)
Determines the origin of the bounding box of a formatted text string in its canonical form (i.e., not rotated). |
void |
renderText(java.lang.String text,
TextProperties textProperties,
java.awt.Point anchor)
Renders a text string as scalable vector line drawing. |
private void |
renderText(java.lang.String text,
TextProperties textProperties,
java.awt.Point anchor,
int[][][] stagingGrid)
Renders the staging grid. |
static java.awt.Point |
rotatePoint(double angleDegrees,
double radius)
Generates a screen coordinate from an angle and radius. |
static int |
round(double value)
Rounds a value to the nearest integer. |
static java.awt.Point |
transformPoint(int x,
int y,
java.awt.Point origin,
java.awt.Point anchor,
double angleDegrees)
Transforms a point by rotating and translating it. |
private void |
transformText(java.lang.String text,
TextProperties textProperties,
java.awt.Point anchor,
int[][][] stagingGrid)
Transforms the staging grid according to through rotation and translation. |
static int |
translate(int value,
int anchor)
Translates a value offset by an anchor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final java.awt.Graphics2D _graphics
private static final int ANCHOR_SIZE
private static final double ITALICS_GRADIENT
private static final boolean SHOW_ANCHOR
| Constructor Detail |
|---|
public VectorText(java.awt.Graphics2D graphics)
graphics - - the graphics context| Method Detail |
|---|
public static double calculateAngle(double x,
double y)
x - - the x valuey - - the y value
public static double calculateRadius(double x,
double y)
x - - the x valuey - - the y value
public java.awt.Polygon generateBoundingPolygon(java.lang.String text,
TextProperties textProperties,
java.awt.Point anchor)
text - - the texttextProperties - - the text propertiesanchor - - the text anchor
private int[][][] generateText(java.lang.String text,
TextProperties textProperties)
text - - the texttextProperties - - the text properties
public static java.awt.Dimension getTextDimensions(java.lang.String text,
TextProperties textProperties)
text - - the texttextProperties - - the text properties
public static java.awt.Point getTextOrigin(java.lang.String text,
TextProperties textProperties)
text - - the texttextProperties - - the text properties
public void renderText(java.lang.String text,
TextProperties textProperties,
java.awt.Point anchor)
text - - the texttextProperties - - the text propertiesanchor - - the text anchor
private void renderText(java.lang.String text,
TextProperties textProperties,
java.awt.Point anchor,
int[][][] stagingGrid)
text - - the texttextProperties - - the text propertiesanchor - - the text anchorstagingGrid - -the grid as [char_index][segment_index][x1,y1,x2,y2]
public static java.awt.Point rotatePoint(double angleDegrees,
double radius)
angleDegrees - - the angle in mathematical degreesradius - - the radius
public static int round(double value)
value - - the value
public static java.awt.Point transformPoint(int x,
int y,
java.awt.Point origin,
java.awt.Point anchor,
double angleDegrees)
x - - the x valuey - - the y valueorigin - - the origin about which to rotate the pointanchor - - the target position to translate the rotated point toangleDegrees - - the angle of rotation in degrees
private void transformText(java.lang.String text,
TextProperties textProperties,
java.awt.Point anchor,
int[][][] stagingGrid)
text - - the texttextProperties - - the text propertiesanchor - - the text anchorstagingGrid - -the grid as [char_index][segment_index][x1,y1,x2,y2], which is updated in place
public static int translate(int value,
int anchor)
value - - the valueanchor - - the anchor to add to the value
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||