Prevents the ImageFilter from being used in the draw function, unless the back/foreground colors have changed.
@@ -118,6 +118,7 @@ public class AsciiCharacter {
// Retrieve character image & set colors:
Image image = bufferedImage;
+ if (backgroundColor != Color.BLACK || foregroundColor != Color.WHITE) {
final ImageFilter filter = new RGBImageFilter() {
@Override
public int filterRGB(int x, int y, int rgb) {
@@ -134,6 +135,7 @@ public class AsciiCharacter {
};
image = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(image.getSource(), filter));
+ }
// Draw character:
final int fontWidth = font.getWidth();
