|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--org.PingOO.DLAI.lib.graph.TextLine
|
+--org.PingOO.DLAI.lib.graph.RTextLine
This class is an extension of the TextLine Class that allows text to be rotated. To rotate the text the Component.createImage method is used. This means that this class needs to know the component that will receive the text. If the component is not known the text cannot be rotated and the class will fall back to the TextLine.draw method.
The text is rotated by running the image through an ImageFilter. This filter can easily be modified to rotate text through an arbitrary angle but unless the text is large the integer mapping will blur the text. Also positioning of arbitrarily rotated text becomes problematic.
| Inner Class Summary | |
protected class |
RTextLine.RotateTextFilter
This is an extension to the ImageFilter class that will rotate an image a multiple of 90 degrees. |
| Inner classes inherited from class org.PingOO.DLAI.lib.graph.TextLine |
TextLine.TextState |
| Field Summary | |
protected int |
angle
Rotation Angle of text in degrees |
private java.awt.Component |
component
|
private double |
cos
|
private double |
sin
|
| Fields inherited from class org.PingOO.DLAI.lib.graph.TextLine |
ALGEBRAIC,
ascent,
background,
CENTER,
color,
descent,
font,
fontname,
fontsize,
fontstyle,
height,
justification,
leading,
LEFT,
lg,
list,
maxAscent,
maxDescent,
MINIMUM_SIZE,
parse,
RIGHT,
SCIENTIFIC,
script_fraction,
sub_offset,
sup_offset,
text,
width |
| Constructor Summary | |
RTextLine()
Instantiate the class |
|
RTextLine(java.awt.Component c)
Instantiate the class. |
|
RTextLine(java.awt.Font f,
java.awt.Color c,
int j)
Instantiate the class |
|
RTextLine(java.awt.Font f,
java.awt.Color c,
int j,
int a)
Instantiate the class |
|
RTextLine(java.lang.String s)
Instantiate the class. |
|
RTextLine(java.lang.String s,
java.awt.Color c)
Instantiate the class |
|
RTextLine(java.lang.String s,
java.awt.Font f)
Instantiate the class |
|
RTextLine(java.lang.String s,
java.awt.Font f,
java.awt.Color c,
int j)
Instantiate the class |
|
| Method Summary | |
void |
copyState(RTextLine t)
Copy the state of the parsed Textline into the existing object. |
void |
draw(java.awt.Component comp,
java.awt.Graphics g,
int x,
int y)
Parse the text, rotate it then draw it to the screen. |
void |
draw(java.awt.Graphics g,
int x,
int y)
Parse the text then draw it. |
void |
draw(java.awt.Graphics g,
int x,
int y,
int j)
Parse the text then draw it. |
int |
getBottomEdge(java.awt.Graphics g)
Return the bottom edge of the rotated text. |
int |
getBottomEdge(java.awt.Graphics g,
int j)
Return the bottom edge of the rotated text. |
java.awt.Component |
getComponent()
|
int |
getLeftEdge(java.awt.Graphics g)
Return the left edge of the rotated text. |
int |
getLeftEdge(java.awt.Graphics g,
int j)
Return the left edge of the rotated text. |
int |
getRHeight(java.awt.Graphics g)
The height of the text after it has been rotated. |
int |
getRightEdge(java.awt.Graphics g)
Return the right edge of the rotated text. |
int |
getRightEdge(java.awt.Graphics g,
int j)
Return the right edge of the rotated text. |
int |
getRotation()
|
int |
getRWidth(java.awt.Graphics g)
The width of the text after it has been rotated. |
int |
getTopEdge(java.awt.Graphics g)
Return the top edge of the rotated text. |
int |
getTopEdge(java.awt.Graphics g,
int j)
Return the top edge of the rotated text. |
void |
setDrawingComponent(java.awt.Component c)
Set the Component the text will be drawn into. |
void |
setRotation(int angle)
Set the text rotation angle. |
void |
setRotation(int angle,
java.awt.Component c)
Set the Rotation and the Component that will be drawn into |
| Methods inherited from class org.PingOO.DLAI.lib.graph.TextLine |
charWidth,
copyState,
copyState,
getAscent,
getBackground,
getColor,
getDescent,
getFM,
getFont,
getFontName,
getFontSize,
getFontStyle,
getHeight,
getJustification,
getLeading,
getMaxAscent,
getMaxDescent,
getScriptFont,
getText,
getWidth,
isNull,
parseDouble,
parseDouble,
parseDouble,
parseText,
rebuildFont,
setBackground,
setColor,
setFont,
setFontName,
setFontSize,
setFontStyle,
setJustification,
setText |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected int angle
private double cos
private double sin
private java.awt.Component component
| Constructor Detail |
public RTextLine()
public RTextLine(java.lang.String s)
s - String to parse.public RTextLine(java.awt.Component c)
c - the Component the text will be drawn into.
public RTextLine(java.lang.String s,
java.awt.Font f)
s - String to parse.f - Font to use.
public RTextLine(java.lang.String s,
java.awt.Font f,
java.awt.Color c,
int j)
s - String to parse.f - Font to use.c - Color to usej - Justification
public RTextLine(java.lang.String s,
java.awt.Color c)
s - String to parse.c - Color to use
public RTextLine(java.awt.Font f,
java.awt.Color c,
int j,
int a)
f - Font to use.c - Color to usej - Justificationa - Rotation angle in degrees
public RTextLine(java.awt.Font f,
java.awt.Color c,
int j)
f - Font to use.c - Color to usej - Justification| Method Detail |
public void copyState(RTextLine t)
t - The TextLine to get the state information from.public void setRotation(int angle)
angle - The angle to rotate the textpublic void setDrawingComponent(java.awt.Component c)
c - The drawing component
public void setRotation(int angle,
java.awt.Component c)
angle - The angle to rotate the textc - The drawing componentpublic int getRotation()
public java.awt.Component getComponent()
public int getRWidth(java.awt.Graphics g)
g - Graphics context.public int getRHeight(java.awt.Graphics g)
g - Graphics context.public int getLeftEdge(java.awt.Graphics g)
g - Graphics context.public int getRightEdge(java.awt.Graphics g)
g - Graphics context.public int getTopEdge(java.awt.Graphics g)
g - Graphics context.public int getBottomEdge(java.awt.Graphics g)
g - Graphics context.
public int getLeftEdge(java.awt.Graphics g,
int j)
g - Graphics context.j - Text justification
public int getRightEdge(java.awt.Graphics g,
int j)
g - Graphics context.j - Text justification
public int getTopEdge(java.awt.Graphics g,
int j)
g - Graphics context.j - Text justification
public int getBottomEdge(java.awt.Graphics g,
int j)
g - Graphics context.j - Text justification
public void draw(java.awt.Graphics g,
int x,
int y)
g - Graphics contextx - pixel position of the texty - pixel position of the text
public void draw(java.awt.Graphics g,
int x,
int y,
int j)
g - Graphics contextx - pixel position of the texty - pixel position of the textj - justification of the text
public void draw(java.awt.Component comp,
java.awt.Graphics g,
int x,
int y)
g - Graphics contextx - pixel position of the texty - pixel position of the text
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||