diff --git a/src/com/bytezone/diskbrowser/applefile/FontFile.java b/src/com/bytezone/diskbrowser/applefile/FontFile.java index e3fff11..8abbdb8 100644 --- a/src/com/bytezone/diskbrowser/applefile/FontFile.java +++ b/src/com/bytezone/diskbrowser/applefile/FontFile.java @@ -1,5 +1,9 @@ package com.bytezone.diskbrowser.applefile; +import java.awt.AlphaComposite; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.awt.image.DataBuffer; import java.util.ArrayList; import java.util.List; @@ -11,13 +15,30 @@ public class FontFile extends AbstractFile { super (name, buffer); + image = new BufferedImage (8 * (7 + 4), 12 * (8 + 4), BufferedImage.TYPE_BYTE_GRAY); + Graphics2D g2d = image.createGraphics (); + g2d.setComposite (AlphaComposite.getInstance (AlphaComposite.SRC_OVER, (float) 1.0)); + int ptr = 0; + int x = 2; + int y = 2; + int count = 0; + while (ptr < buffer.length) { Character c = new Character (buffer, ptr); ptr += 8; characters.add (c); + + g2d.drawImage (c.image, x, y, null); + x += 7 + 4; + if (++count % 8 == 0) + { + x = 2; + y += 8 + 4; + } } + g2d.dispose (); } @Override @@ -48,9 +69,15 @@ public class FontFile extends AbstractFile class Character { String[] lines = new String[8]; + private final BufferedImage image; public Character (byte[] buffer, int ptr) { + // draw the image + image = new BufferedImage (7, 8, BufferedImage.TYPE_BYTE_GRAY); + DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); + int element = 0; + for (int i = 0; i < 8; i++) { int b = buffer[ptr + i] & 0xFF; @@ -59,6 +86,8 @@ public class FontFile extends AbstractFile s = s.replace ('0', ' '); s = s.replace ('1', 'O'); s = new StringBuilder (s).reverse ().toString (); + for (byte ch : s.getBytes ()) + dataBuffer.setElem (element++, ch == ' ' ? 0 : 255); lines[i] = s; } } diff --git a/src/com/bytezone/diskbrowser/applefile/ShapeTable.java b/src/com/bytezone/diskbrowser/applefile/ShapeTable.java index a2cc587..fbfc2d1 100755 --- a/src/com/bytezone/diskbrowser/applefile/ShapeTable.java +++ b/src/com/bytezone/diskbrowser/applefile/ShapeTable.java @@ -64,12 +64,10 @@ public class ShapeTable extends AbstractFile int y = 10; int count = 0; Graphics2D g2d = image.createGraphics (); + g2d.setComposite (AlphaComposite.getInstance (AlphaComposite.SRC_OVER, (float) 1.0)); for (Shape shape : shapes) { - // System.out.println (shape); - g2d.setComposite ( - AlphaComposite.getInstance (AlphaComposite.SRC_OVER, (float) 1.0)); g2d.drawImage (shape.image, x, y, null); x += maxWidth + 5; if (++count % cols == 0) diff --git a/src/com/bytezone/diskbrowser/dos/AbstractCatalogEntry.java b/src/com/bytezone/diskbrowser/dos/AbstractCatalogEntry.java index f50bb93..39a42f5 100644 --- a/src/com/bytezone/diskbrowser/dos/AbstractCatalogEntry.java +++ b/src/com/bytezone/diskbrowser/dos/AbstractCatalogEntry.java @@ -260,6 +260,9 @@ abstract class AbstractCatalogEntry implements AppleFileSource && reportedLength == 0x14FA) return true; + // if (name.endsWith (".PAC")) + // return true; + if (name.equals ("BBROS LOGO SCRUNCHED") && reportedLength == 0x0FED) return true;