svoid drawCenteredText(Graphics2D g, S text, int x, int y, int w, int h, Color color) { g.setColor(color); FontMetrics fm = g.getFontMetrics(); Pt p = centerTextInRect(fm, text, rect(x, y, w, h)); g.drawString(text, p.x, p.y); } static BufferedImage drawCenteredText(BufferedImage image, S text, Color color default black()) { if (image != null) drawCenteredText(antiAliasGraphics(image), text, 0, 0, image.getWidth(), image.getHeight(), color); ret image; } static BufferedImage drawCenteredText(BufferedImage image, S text, Color color default black(), Font font) { if (image != null) { var g = antiAliasGraphics(image); if (font != null) g.setFont(font); drawCenteredText(g, text, 0, 0, image.getWidth(), image.getHeight(), color); } ret image; }