Draw the text.
log("\tCreating Text \"" + strText + "\"");
Color couloir = ColorMapper.getColorByName(color);
int width = 1;
int height = 1;
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR_PRE);
Graphics2D graphics = (Graphics2D) bi.getGraphics();
graphics.setRenderingHint(
RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.setRenderingHint(
RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
Font f = new Font(font, Font.PLAIN, point);
FontMetrics fmetrics = graphics.getFontMetrics(f);
height = fmetrics.getMaxAscent() + fmetrics.getMaxDescent();
width = fmetrics.stringWidth(strText);
bi = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR_PRE);
graphics = (Graphics2D) bi.getGraphics();
graphics.setRenderingHint(
RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.setRenderingHint(
RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
graphics.setFont(f);
graphics.setColor(couloir);
graphics.drawString(strText, 0, height - fmetrics.getMaxDescent());
PlanarImage image = PlanarImage.wrapRenderedImage(bi);
return image;