*/
package jexer.backend;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
newImage = new BufferedImage(cells.size() * getTextWidth(),
getTextHeight(), BufferedImage.TYPE_INT_ARGB);
- java.awt.Graphics gr = newImage.getGraphics();
+ Graphics gr = newImage.getGraphics();
+ if (gr instanceof Graphics2D) {
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_RENDERING,
+ RenderingHints.VALUE_RENDER_QUALITY);
+ }
gr.drawImage(image, 0, 0, newImage.getWidth(),
newImage.getHeight(), null, null);
gr.dispose();
newImage = new BufferedImage(cells.size() * getTextWidth(),
getTextHeight(), BufferedImage.TYPE_INT_ARGB);
- java.awt.Graphics gr = newImage.getGraphics();
+ Graphics gr = newImage.getGraphics();
+ if (gr instanceof Graphics2D) {
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_RENDERING,
+ RenderingHints.VALUE_RENDER_QUALITY);
+ }
gr.drawImage(image, 0, 0, newImage.getWidth(),
newImage.getHeight(), null, null);
gr.dispose();
newImage = new BufferedImage(cells.size() * getTextWidth(),
getTextHeight(), BufferedImage.TYPE_INT_ARGB);
- java.awt.Graphics gr = newImage.getGraphics();
+ Graphics gr = newImage.getGraphics();
+ if (gr instanceof Graphics2D) {
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_RENDERING,
+ RenderingHints.VALUE_RENDER_QUALITY);
+ }
gr.drawImage(image, 0, 0, newImage.getWidth(),
newImage.getHeight(), null, null);
gr.dispose();
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
+import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
// Draw the background rectangle, then the foreground character.
assert (cell.isImage());
+
+ // Enable anti-aliasing
+ if (gr instanceof Graphics2D) {
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_RENDERING,
+ RenderingHints.VALUE_RENDER_QUALITY);
+ }
+
gr.setColor(cell.getBackground());
gr.fillRect(xPixel, yPixel, textWidth, textHeight);
cellColor.setBackColor(cell.getForeColor());
}
+ // Enable anti-aliasing
+ if (gr instanceof Graphics2D) {
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ ((Graphics2D) gr).setRenderingHint(RenderingHints.KEY_RENDERING,
+ RenderingHints.VALUE_RENDER_QUALITY);
+ }
+
// Draw the background rectangle, then the foreground character.
gr2.setColor(attrToBackgroundColor(cellColor));
gr2.fillRect(gr2x, gr2y, textWidth, textHeight);
+
// Handle blink and underline
if (!cell.isBlink()
|| (cell.isBlink() && cursorBlinkVisible)