Package org.jfree.chart.util
Class AttrStringUtils
java.lang.Object
org.jfree.chart.util.AttrStringUtils
Some
AttributedString
utilities.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static float[]
deriveRotationAnchorOffsets
(Graphics2D g2, AttributedString text, TextAnchor anchor) A utility method that calculates the rotation anchor offsets for a string.private static float[]
deriveTextBoundsAnchorOffsets
(Graphics2D g2, AttributedString text, TextAnchor anchor, Rectangle2D textBounds) static void
drawRotatedString
(AttributedString text, Graphics2D g2, double angle, float x, float y) Draws the attributed string at(x, y)
, rotated by the specified angle about(x, y)
.static void
drawRotatedString
(AttributedString text, Graphics2D g2, float textX, float textY, double angle, float rotateX, float rotateY) Draws the attributed string at(textX, textY)
, rotated by the specified angle about(rotateX, rotateY)
.static void
drawRotatedString
(AttributedString text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, float rotationX, float rotationY) Draws the string anchored to(x, y)
, rotated by the specified angle about(rotationX, rotationY)
.static void
drawRotatedString
(AttributedString text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, TextAnchor rotationAnchor) Draws a rotated string.static Rectangle2D
getTextBounds
(AttributedString text, Graphics2D g2) Returns the bounds for the attributed string.private static boolean
isBaseline
(TextAnchor anchor) private static boolean
isBottom
(TextAnchor anchor) private static boolean
isHalfAscent
(TextAnchor anchor) private static boolean
isHalfHeight
(TextAnchor anchor) private static boolean
isHorizontalCenter
(TextAnchor anchor) private static boolean
isHorizontalLeft
(TextAnchor anchor) private static boolean
isHorizontalRight
(TextAnchor anchor) private static boolean
isTop
(TextAnchor anchor)
-
Constructor Details
-
AttrStringUtils
private AttrStringUtils()
-
-
Method Details
-
getTextBounds
Returns the bounds for the attributed string.- Parameters:
text
- the attributed string (null
not permitted).g2
- the graphics target (null
not permitted).- Returns:
- The bounds (never
null
).
-
drawRotatedString
public static void drawRotatedString(AttributedString text, Graphics2D g2, double angle, float x, float y) Draws the attributed string at(x, y)
, rotated by the specified angle about(x, y)
.- Parameters:
text
- the attributed string (null
not permitted).g2
- the graphics output target.angle
- the angle.x
- the x-coordinate.y
- the y-coordinate.
-
drawRotatedString
public static void drawRotatedString(AttributedString text, Graphics2D g2, float textX, float textY, double angle, float rotateX, float rotateY) Draws the attributed string at(textX, textY)
, rotated by the specified angle about(rotateX, rotateY)
.- Parameters:
text
- the attributed string (null
not permitted).g2
- the graphics output target.textX
- the x-coordinate for the text.textY
- the y-coordinate for the text.angle
- the rotation angle (in radians).rotateX
- the x-coordinate for the rotation point.rotateY
- the y-coordinate for the rotation point.
-
drawRotatedString
public static void drawRotatedString(AttributedString text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, float rotationX, float rotationY) Draws the string anchored to(x, y)
, rotated by the specified angle about(rotationX, rotationY)
.- Parameters:
text
- the text (null
not permitted).g2
- the graphics target.x
- the x-coordinate for the text location.y
- the y-coordinate for the text location.textAnchor
- the text anchor point.angle
- the rotation (in radians).rotationX
- the x-coordinate for the rotation point.rotationY
- the y-coordinate for the rotation point.
-
drawRotatedString
public static void drawRotatedString(AttributedString text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, TextAnchor rotationAnchor) Draws a rotated string.- Parameters:
text
- the text to draw.g2
- the graphics target.x
- the x-coordinate for the text location.y
- the y-coordinate for the text location.textAnchor
- the text anchor point.angle
- the rotation (in radians).rotationAnchor
- the rotation anchor point.
-
deriveTextBoundsAnchorOffsets
private static float[] deriveTextBoundsAnchorOffsets(Graphics2D g2, AttributedString text, TextAnchor anchor, Rectangle2D textBounds) -
deriveRotationAnchorOffsets
private static float[] deriveRotationAnchorOffsets(Graphics2D g2, AttributedString text, TextAnchor anchor) A utility method that calculates the rotation anchor offsets for a string. These offsets are relative to the text starting coordinate (BASELINE_LEFT).- Parameters:
g2
- the graphics device.text
- the text.anchor
- the anchor point.- Returns:
- The offsets.
-
isTop
-
isBaseline
-
isHalfAscent
-
isHalfHeight
-
isBottom
-
isHorizontalLeft
-
isHorizontalCenter
-
isHorizontalRight
-