/** * Draws a string that is aligned by one anchor point and rotated about * another anchor point. * * @param text the text. * @param g2 the graphics device. * @param x the x-coordinate for positioning the text. * @param y the y-coordinate for positioning the text. * @param textAnchor the text anchor. * @param angle the rotation angle (in radians). * @param rotationAnchor the rotation anchor. */ public static void drawRotatedString(final String text, final Graphics2D g2, final float x, final float y, final TextAnchor textAnchor, final double angle, final TextAnchor rotationAnchor) { if (text == null || text.equals("")) { return; } final float[] textAdj = deriveTextBoundsAnchorOffsets(g2, text, textAnchor); final float[] rotateAdj = deriveRotationAnchorOffsets(g2, text, rotationAnchor); drawRotatedString(text, g2, x + textAdj[0], y + textAdj[1], angle, x + textAdj[0] + rotateAdj[0], y + textAdj[1] + rotateAdj[1]); }
/** * Draws a string that is aligned by one anchor point and rotated about * another anchor point. * * @param text the text. * @param g2 the graphics device. * @param x the x-coordinate for positioning the text. * @param y the y-coordinate for positioning the text. * @param textAnchor the text anchor. * @param angle the rotation angle (in radians). * @param rotationAnchor the rotation anchor. */ public static void drawRotatedString(final String text, final Graphics2D g2, final float x, final float y, final TextAnchor textAnchor, final double angle, final TextAnchor rotationAnchor) { if (text == null || text.equals("")) { return; } final float[] textAdj = deriveTextBoundsAnchorOffsets(g2, text, textAnchor); final float[] rotateAdj = deriveRotationAnchorOffsets(g2, text, rotationAnchor); drawRotatedString(text, g2, x + textAdj[0], y + textAdj[1], angle, x + textAdj[0] + rotateAdj[0], y + textAdj[1] + rotateAdj[1]); }
/** * Draws a string that is aligned by one anchor point and rotated about * another anchor point. * * @param text the text. * @param g2 the graphics device. * @param x the x-coordinate for positioning the text. * @param y the y-coordinate for positioning the text. * @param textAnchor the text anchor. * @param angle the rotation angle (in radians). * @param rotationAnchor the rotation anchor. */ public static void drawRotatedString(String text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, TextAnchor rotationAnchor) { if (text == null || text.equals("")) { return; } if (angle == 0.0) { drawAlignedString(text, g2, x, y, textAnchor); } else { float[] textAdj = deriveTextBoundsAnchorOffsets(g2, text, textAnchor); float[] rotateAdj = deriveRotationAnchorOffsets(g2, text, rotationAnchor); drawRotatedString(text, g2, x + textAdj[0], y + textAdj[1], angle, x + textAdj[0] + rotateAdj[0], y + textAdj[1] + rotateAdj[1]); } }
+ textAdj[1]); final float[] rotateAdj = deriveRotationAnchorOffsets(g2, text, rotationAnchor); if (logger.isDebugEnabled()) {
+ textAdj[1]); float[] rotateAdj = deriveRotationAnchorOffsets(g2, text, rotationAnchor); if (logger.isDebugEnabled()) {
+ textAdj[1]); final float[] rotateAdj = deriveRotationAnchorOffsets(g2, text, rotationAnchor); if (logger.isDebugEnabled()) {