public static Rectangle2D drawAlignedString(string text, Graphics2D g2, float x, float y, TextAnchor anchor) { Rectangle2D.Double @double = new Rectangle2D.Double(); float[] numArray = TextUtilities.deriveTextBoundsAnchorOffsets(g2, text, anchor, (Rectangle2D) @double); ((Rectangle2D) @double).setRect((double) (x + numArray[0]), (double) (y + numArray[1] + numArray[2]), ((RectangularShape) @double).getWidth(), ((RectangularShape) @double).getHeight()); g2.drawString(text, x + numArray[0], y + numArray[1]); return (Rectangle2D) @double; }
public static void drawRotatedString(string text, Graphics2D g2, float textX, float textY, double angle, float rotateX, float rotateY) { if (text == null || String.instancehelper_equals(text, (object) "")) return; AffineTransform transform = g2.getTransform(); AffineTransform rotateInstance = AffineTransform.getRotateInstance(angle, (double) rotateX, (double) rotateY); g2.transform(rotateInstance); if (TextUtilities.useDrawRotatedStringWorkaround) { TextLayout.__\u003Cclinit\u003E(); new TextLayout(text, ((Graphics) g2).getFont(), g2.getFontRenderContext()).draw(g2, textX, textY); } else g2.drawString(text, textX, textY); g2.setTransform(transform); }