There was a PHP application that's purpose was to print text over a number of pre-defined PNG images. It worked without issues and printed antialiased text in any given font and color. What are the special considerations when printing over the existing images in Java?
I tired to use Graphics2D calls to print over the same images, but it is not working with the code below.
String imName = Config.getBlanketImage();
File file = new File(imName);
// BufferedImage im = new BufferedImage(400, 600, BufferedImage.TYPE_INT_ARGB);
// graphics.setColor(new Color(bColor.getRed(), bColor.getGreen(), bColor.getBlue()));
// graphics.fillRect(0, 0, im.getWidth(), im.getHeight());
BufferedImage im = ImageIO.read(file);
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
graphics.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
graphics.setFont(drawFont);
graphics.setColor(new Color(aColor.getRed(), aColor.getGreen(), a.getBlue()));
graphics.drawString(Config.getText1(), x, y);
The text comes across in a completely wrong color - the shades of background, sometimes surrounded by thin line of black pixels. I cannot post images and only 2 links, so screw the samples. But if I commented out the first three lines and uncommented the commented out lines and printed over a brand new image, the colors would be correct and anti-aliasing would be on.
I tried with and without the rendering hints and it did not make any difference whatsoever, just showing all that I tried.