- image = glyphCache.get(cell);
- }
- if (image == null) {
- // Generate glyph and draw it to an image.
- image = new BufferedImage(textWidth * 2, textHeight * 2,
- BufferedImage.TYPE_INT_ARGB);
- Graphics2D gr2 = image.createGraphics();
- gr2.setFont(doubleFont);
-
- // Draw the background rectangle, then the foreground character.
- gr2.setColor(SwingTerminal.attrToBackgroundColor(cell));
- gr2.fillRect(0, 0, image.getWidth(), image.getHeight());
- if (!cell.isBlink()
- || (cell.isBlink() && cursorBlinkVisible)
- ) {
- gr2.setColor(SwingTerminal.attrToForegroundColor(cell));
- char [] chars = new char[1];
- chars[0] = cell.getChar();
- gr2.drawChars(chars, 0, 1, doubleTextAdjustX,
- (textHeight * 2) - doubleMaxDescent + doubleTextAdjustY);
-
- if (cell.isUnderline() && (line.getDoubleHeight() != 1)) {
- gr2.fillRect(0, textHeight - 2, textWidth, 2);
- }
- }
- gr2.dispose();
-
- // Now save this generated image, using a new key that will not
- // be mutated by invertCell().
- Cell key = new Cell();
- key.setTo(cell);
- if (cell.isBlink() && !cursorBlinkVisible) {
- glyphCacheBlink.put(key, image);
- } else {
- glyphCache.put(key, image);
- }