pascal hd
This commit is contained in:
parent
bca4858087
commit
85717fac5e
|
@ -1,7 +1,6 @@
|
|||
package com.bytezone.diskbrowser.applefile;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBuffer;
|
||||
|
@ -25,44 +24,33 @@ abstract class CharacterList extends AbstractFile
|
|||
List<Character> characters = new ArrayList<> ();
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public CharacterList (String name, byte[] buffer, int charsX, int charsY)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this (name, buffer, charsX, charsY, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public CharacterList (String name, byte[] buffer, int charsX, int charsY, int offset)
|
||||
public CharacterList (String name, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer);
|
||||
}
|
||||
|
||||
image = new BufferedImage ( //
|
||||
Utility.dimension (charsX, borderX, sizeX, gapX), //
|
||||
Utility.dimension (charsY, borderY, sizeY, gapY), //
|
||||
// ---------------------------------------------------------------------------------//
|
||||
void buildImage (int borderX, int borderY, int gapX, int gapY, int sizeX, int sizeY,
|
||||
int charsX)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int charsY = (characters.size () - 1) / charsX + 1;
|
||||
image = new BufferedImage ( //
|
||||
Utility.dimension (charsX, borderX, sizeX, gapX), //
|
||||
Utility.dimension (charsY, borderY, sizeY, gapY), //
|
||||
BufferedImage.TYPE_BYTE_GRAY);
|
||||
|
||||
Graphics2D g2d = image.createGraphics ();
|
||||
g2d.setComposite (AlphaComposite.getInstance (AlphaComposite.SRC_OVER, (float) 1.0));
|
||||
|
||||
if (false) // show gaps around the glyphs
|
||||
{
|
||||
g2d.setColor (new Color (245, 245, 245)); // match background
|
||||
g2d.fillRect (0, 0, image.getWidth (), image.getHeight ());
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
int x = borderX;
|
||||
int y = borderY;
|
||||
int count = 0;
|
||||
int ptr = offset;
|
||||
|
||||
while (ptr < buffer.length)
|
||||
for (Character character : characters)
|
||||
{
|
||||
Character c = createCharacter (buffer, ptr);
|
||||
characters.add (c);
|
||||
ptr += sizeY;
|
||||
|
||||
g2d.drawImage (c.image, x, y, null);
|
||||
g2d.drawImage (character.image, x, y, null);
|
||||
if (++count % charsX == 0)
|
||||
{
|
||||
x = borderX;
|
||||
|
@ -75,10 +63,6 @@ abstract class CharacterList extends AbstractFile
|
|||
g2d.dispose ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
abstract Character createCharacter (byte[] buffer, int ptr);
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getText ()
|
||||
|
@ -99,7 +83,14 @@ abstract class CharacterList extends AbstractFile
|
|||
class Character
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
BufferedImage image = new BufferedImage (sizeX, sizeY, BufferedImage.TYPE_BYTE_GRAY);
|
||||
BufferedImage image;
|
||||
|
||||
// -------------------------------------------------------------------------------//
|
||||
public Character (int sizeX, int sizeY)
|
||||
// -------------------------------------------------------------------------------//
|
||||
{
|
||||
image = new BufferedImage (sizeX, sizeY, BufferedImage.TYPE_BYTE_GRAY);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------//
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.bytezone.diskbrowser.applefile;
|
||||
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
|
@ -12,19 +10,26 @@ public class CharacterRom extends CharacterList
|
|||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private static final int charsX = 16;
|
||||
private static final int charsY = 6;
|
||||
private static final int HEADER_LENGTH = 0x100;
|
||||
|
||||
String description;
|
||||
List<Character> characters = new ArrayList<> ();
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public CharacterRom (String name, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer, charsX, charsY, HEADER_LENGTH);
|
||||
super (name, buffer);
|
||||
|
||||
description = HexFormatter.getCString (buffer, 16);
|
||||
int ptr = HEADER_LENGTH;
|
||||
|
||||
while (ptr < buffer.length)
|
||||
{
|
||||
characters.add (new CharacterRomCharacter (buffer, ptr));
|
||||
ptr += sizeY;
|
||||
}
|
||||
|
||||
buildImage (borderX, borderY, gapX, gapY, sizeX, sizeY, charsX);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -41,14 +46,6 @@ public class CharacterRom extends CharacterList
|
|||
&& buffer[5] == (byte) 0x07 && buffer[6] == (byte) 0x08;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
Character createCharacter (byte[] buffer, int ptr)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return new CharacterRomCharacter (buffer, ptr);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
class CharacterRomCharacter extends Character
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -57,6 +54,8 @@ public class CharacterRom extends CharacterList
|
|||
public CharacterRomCharacter (byte[] buffer, int ptr)
|
||||
// -------------------------------------------------------------------------------//
|
||||
{
|
||||
super (sizeX, sizeY);
|
||||
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.bytezone.diskbrowser.applefile;
|
||||
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// Found on Pascal disks
|
||||
// -----------------------------------------------------------------------------------//
|
||||
|
@ -10,23 +8,22 @@ public class Charset extends CharacterList
|
|||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private static final int charsX = 16;
|
||||
private static final int charsY = 8;
|
||||
|
||||
List<Character> characters = new ArrayList<> ();
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public Charset (String name, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer, charsX, charsY);
|
||||
}
|
||||
super (name, buffer);
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
Character createCharacter (byte[] buffer, int ptr)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return new CharsetCharacter (buffer, ptr);
|
||||
int ptr = 0;
|
||||
|
||||
while (ptr < buffer.length)
|
||||
{
|
||||
characters.add (new CharsetCharacter (buffer, ptr));
|
||||
ptr += sizeY;
|
||||
}
|
||||
|
||||
buildImage (borderX, borderY, gapX, gapY, sizeX, sizeY, charsX);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -37,6 +34,8 @@ public class Charset extends CharacterList
|
|||
public CharsetCharacter (byte[] buffer, int ptr)
|
||||
// -------------------------------------------------------------------------------//
|
||||
{
|
||||
super (sizeX, sizeY);
|
||||
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
ptr += sizeY; // start at the end and move backwards
|
||||
|
|
|
@ -1,180 +0,0 @@
|
|||
package com.bytezone.diskbrowser.applefile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// Brendan Robert's code from JACE
|
||||
|
||||
public class Command
|
||||
{
|
||||
public static enum TOKEN
|
||||
{
|
||||
END ((byte) 0x080, "END"),
|
||||
FOR ((byte) 0x081, "FOR"),
|
||||
NEXT ((byte) 0x082, "NEXT"),
|
||||
DATA ((byte) 0x083, "DATA"),
|
||||
INPUT ((byte) 0x084, "INPUT"),
|
||||
DEL ((byte) 0x085, "DEL"),
|
||||
DIM ((byte) 0x086, "DIM"),
|
||||
READ ((byte) 0x087, "READ"),
|
||||
GR ((byte) 0x088, "GR"),
|
||||
TEXT ((byte) 0x089, "TEXT"),
|
||||
PR ((byte) 0x08A, "PR#"),
|
||||
IN ((byte) 0x08B, "IN#"),
|
||||
CALL ((byte) 0x08C, "CALL"),
|
||||
PLOT ((byte) 0x08D, "PLOT"),
|
||||
HLIN ((byte) 0x08E, "HLIN"),
|
||||
VLIN ((byte) 0x08F, "VLIN"),
|
||||
HGR2 ((byte) 0x090, "HGR2"),
|
||||
HGR ((byte) 0x091, "HGR"),
|
||||
HCOLOR ((byte) 0x092, "HCOLOR="),
|
||||
HPLOT ((byte) 0x093, "HPLOT"),
|
||||
DRAW ((byte) 0x094, "DRAW"),
|
||||
XDRAW ((byte) 0x095, "XDRAW"),
|
||||
HTAB ((byte) 0x096, "HTAB"),
|
||||
HOME ((byte) 0x097, "HOME"),
|
||||
ROT ((byte) 0x098, "ROT="),
|
||||
SCALE ((byte) 0x099, "SCALE="),
|
||||
SHLOAD ((byte) 0x09A, "SHLOAD"),
|
||||
TRACE ((byte) 0x09B, "TRACE"),
|
||||
NOTRACE ((byte) 0x09C, "NOTRACE"),
|
||||
NORMAL ((byte) 0x09D, "NORMAL"),
|
||||
INVERSE ((byte) 0x09E, "INVERSE"),
|
||||
FLASH ((byte) 0x09F, "FLASH"),
|
||||
COLOR ((byte) 0x0A0, "COLOR="),
|
||||
POP ((byte) 0x0A1, "POP"),
|
||||
VTAB ((byte) 0x0A2, "VTAB"),
|
||||
HIMEM ((byte) 0x0A3, "HIMEM:"),
|
||||
LOMEM ((byte) 0x0A4, "LOMEM:"),
|
||||
ONERR ((byte) 0x0A5, "ONERR"),
|
||||
RESUME ((byte) 0x0A6, "RESUME"),
|
||||
RECALL ((byte) 0x0A7, "RECALL"),
|
||||
STORE ((byte) 0x0A8, "STORE"),
|
||||
SPEED ((byte) 0x0A9, "SPEED="),
|
||||
LET ((byte) 0x0AA, "LET"),
|
||||
GOTO ((byte) 0x0AB, "GOTO"),
|
||||
RUN ((byte) 0x0AC, "RUN"),
|
||||
IF ((byte) 0x0AD, "IF"),
|
||||
RESTORE ((byte) 0x0AE, "RESTORE"),
|
||||
AMPERSAND ((byte) 0x0AF, "&"),
|
||||
GOSUB ((byte) 0x0B0, "GOSUB"),
|
||||
RETURN ((byte) 0x0B1, "RETURN"),
|
||||
REM ((byte) 0x0B2, "REM"),
|
||||
STOP ((byte) 0x0B3, "STOP"),
|
||||
ONGOTO ((byte) 0x0B4, "ON"),
|
||||
WAIT ((byte) 0x0B5, "WAIT"),
|
||||
LOAD ((byte) 0x0B6, "LOAD"),
|
||||
SAVE ((byte) 0x0B7, "SAVE"),
|
||||
DEF ((byte) 0x0B8, "DEF"),
|
||||
POKE ((byte) 0x0B9, "POKE"),
|
||||
PRINT ((byte) 0x0BA, "PRINT"),
|
||||
CONT ((byte) 0x0BB, "CONT"),
|
||||
LIST ((byte) 0x0BC, "LIST"),
|
||||
CLEAR ((byte) 0x0BD, "CLEAR"),
|
||||
GET ((byte) 0x0BE, "GET"),
|
||||
NEW ((byte) 0x0BF, "NEW"),
|
||||
TAB ((byte) 0x0C0, "TAB("),
|
||||
TO ((byte) 0x0C1, "TO"),
|
||||
FN ((byte) 0x0C2, "FN"),
|
||||
SPC ((byte) 0x0c3, "SPC"),
|
||||
THEN ((byte) 0x0c4, "THEN"),
|
||||
AT ((byte) 0x0c5, "AT"),
|
||||
NOT ((byte) 0x0c6, "NOT"),
|
||||
STEP ((byte) 0x0c7, "STEP"),
|
||||
PLUS ((byte) 0x0c8, "+"),
|
||||
MINUS ((byte) 0x0c9, "-"),
|
||||
MULTIPLY ((byte) 0x0Ca, "*"),
|
||||
DIVIDE ((byte) 0x0Cb, "/"),
|
||||
POWER ((byte) 0x0Cc, "^"),
|
||||
AND ((byte) 0x0Cd, "AND"),
|
||||
OR ((byte) 0x0Ce, "OR"),
|
||||
GREATER ((byte) 0x0CF, ">"),
|
||||
EQUAL ((byte) 0x0d0, "="),
|
||||
LESS ((byte) 0x0d1, "<"),
|
||||
SGN ((byte) 0x0D2, "SGN"),
|
||||
INT ((byte) 0x0D3, "INT"),
|
||||
ABS ((byte) 0x0D4, "ABS"),
|
||||
USR ((byte) 0x0D5, "USR"),
|
||||
FRE ((byte) 0x0D6, "FRE"),
|
||||
SCREEN ((byte) 0x0D7, "SCRN("),
|
||||
PDL ((byte) 0x0D8, "PDL"),
|
||||
POS ((byte) 0x0D9, "POS"),
|
||||
SQR ((byte) 0x0DA, "SQR"),
|
||||
RND ((byte) 0x0DB, "RND"),
|
||||
LOG ((byte) 0x0DC, "LOG"),
|
||||
EXP ((byte) 0x0DD, "EXP"),
|
||||
COS ((byte) 0x0DE, "COS"),
|
||||
SIN ((byte) 0x0DF, "SIN"),
|
||||
TAN ((byte) 0x0E0, "TAN"),
|
||||
ATN ((byte) 0x0E1, "ATN"),
|
||||
PEEK ((byte) 0x0E2, "PEEK"),
|
||||
LEN ((byte) 0x0E3, "LEN"),
|
||||
STR ((byte) 0x0E4, "STR$"),
|
||||
VAL ((byte) 0x0E5, "VAL"),
|
||||
ASC ((byte) 0x0E6, "ASC"),
|
||||
CHR ((byte) 0x0E7, "CHR$"),
|
||||
LEFT ((byte) 0x0E8, "LEFT$"),
|
||||
RIGHT ((byte) 0x0E9, "RIGHT$"),
|
||||
MID ((byte) 0x0EA, "MID$");
|
||||
private final String str;
|
||||
private final byte b;
|
||||
|
||||
TOKEN (byte b, String str)
|
||||
{
|
||||
this.b = b;
|
||||
this.str = str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString ()
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
public static TOKEN fromByte (byte b)
|
||||
{
|
||||
for (TOKEN t : values ())
|
||||
if (t.b == b)
|
||||
return t;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ByteOrToken
|
||||
{
|
||||
byte b;
|
||||
TOKEN t;
|
||||
boolean isToken = false;
|
||||
|
||||
public ByteOrToken (byte b)
|
||||
{
|
||||
TOKEN t = TOKEN.fromByte (b);
|
||||
if (t != null)
|
||||
{
|
||||
isToken = true;
|
||||
this.t = t;
|
||||
}
|
||||
else
|
||||
{
|
||||
isToken = false;
|
||||
this.b = b;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString ()
|
||||
{
|
||||
return isToken ? " " + t.toString () + " " : String.valueOf ((char) b);
|
||||
}
|
||||
}
|
||||
List<ByteOrToken> parts = new ArrayList<ByteOrToken> ();
|
||||
|
||||
@Override
|
||||
public String toString ()
|
||||
{
|
||||
String out = "";
|
||||
for (ByteOrToken p : parts)
|
||||
out += p.toString ();
|
||||
return out;
|
||||
}
|
||||
}
|
|
@ -1,25 +1,29 @@
|
|||
package com.bytezone.diskbrowser.applefile;
|
||||
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class FontFile extends CharacterList
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private static final int charsX = 16;
|
||||
private static final int charsY = 6;
|
||||
|
||||
List<Character> characters = new ArrayList<Character> ();
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public FontFile (String name, byte[] buffer, int address)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer, charsX, charsY);
|
||||
super (name, buffer);
|
||||
|
||||
loadAddress = address;
|
||||
int ptr = 0;
|
||||
|
||||
while (ptr < buffer.length)
|
||||
{
|
||||
characters.add (new FontFileCharacter (buffer, ptr));
|
||||
ptr += sizeY;
|
||||
}
|
||||
|
||||
buildImage (borderX, borderY, gapX, gapY, sizeX, sizeY, charsX);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -34,14 +38,6 @@ public class FontFile extends CharacterList
|
|||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
Character createCharacter (byte[] buffer, int ptr)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return new FontFileCharacter (buffer, ptr);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
class FontFileCharacter extends Character
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -50,6 +46,8 @@ public class FontFile extends CharacterList
|
|||
public FontFileCharacter (byte[] buffer, int ptr)
|
||||
// -------------------------------------------------------------------------------//
|
||||
{
|
||||
super (sizeX, sizeY);
|
||||
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
|||
|
||||
public class PaletteFactory
|
||||
{
|
||||
private final List<Palette> palettes = new ArrayList<Palette> ();
|
||||
private final List<Palette> palettes = new ArrayList<> ();
|
||||
private int currentPalette;
|
||||
|
||||
public enum CycleDirection
|
||||
|
|
|
@ -22,7 +22,7 @@ public class PascalProcedure
|
|||
int codeEnd;
|
||||
int parmSize;
|
||||
int dataSize;
|
||||
List<PascalCodeStatement> statements = new ArrayList<PascalCodeStatement> ();
|
||||
List<PascalCodeStatement> statements = new ArrayList<> ();
|
||||
AssemblerProgram assembler;
|
||||
int jumpTable = -8;
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class PascalProcedure
|
|||
public List<PascalCodeStatement> extractStrings ()
|
||||
{
|
||||
decode ();
|
||||
List<PascalCodeStatement> strings = new ArrayList<PascalCodeStatement> ();
|
||||
List<PascalCodeStatement> strings = new ArrayList<> ();
|
||||
for (PascalCodeStatement cs : statements)
|
||||
if (cs.val == 166)
|
||||
strings.add (cs);
|
||||
|
|
|
@ -116,7 +116,7 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
|||
|
||||
private void buildProcedureList ()
|
||||
{
|
||||
procedures = new ArrayList<PascalProcedure> (totalProcedures);
|
||||
procedures = new ArrayList<> (totalProcedures);
|
||||
|
||||
for (int i = 1; i <= totalProcedures; i++)
|
||||
procedures.add (new PascalProcedure (buffer, i));
|
||||
|
|
|
@ -32,6 +32,9 @@ public class PascalText extends AbstractFile
|
|||
ptr += line.length () + 1;
|
||||
}
|
||||
|
||||
if (text.length () > 0)
|
||||
text.deleteCharAt (text.length () - 1);
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,12 @@ import java.util.Map;
|
|||
import com.bytezone.diskbrowser.prodos.ProdosConstants;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// see big red computer club folder
|
||||
public class QuickDrawFont extends AbstractFile
|
||||
// see IIGS System 6.0.1 - Disk 5 Fonts.po
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class QuickDrawFont extends CharacterList
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
Map<Integer, Character> characters = new HashMap<Integer, Character> ();
|
||||
Map<Integer, QuickDrawCharacter> qdCharacters = new HashMap<> ();
|
||||
|
||||
private boolean corrupt;
|
||||
private final int fileType;
|
||||
|
@ -51,7 +53,9 @@ public class QuickDrawFont extends AbstractFile
|
|||
|
||||
private BitSet[] strike; // bit image of all characters
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public QuickDrawFont (String name, byte[] buffer, int fileType, int auxType)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer);
|
||||
|
||||
|
@ -113,11 +117,14 @@ public class QuickDrawFont extends AbstractFile
|
|||
|
||||
createStrike ();
|
||||
createCharacters ();
|
||||
if (!corrupt)
|
||||
buildDisplay ();
|
||||
// buildDisplay ();
|
||||
buildImage (10, 10, 5, 5, widMax, fRectHeight,
|
||||
(int) (Math.sqrt (totalCharacters) + .5));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private void createStrike ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
// create bitset for each row
|
||||
strike = new BitSet[fRectHeight];
|
||||
|
@ -136,35 +143,35 @@ public class QuickDrawFont extends AbstractFile
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private void createCharacters ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
// System.out.printf ("Total chars: %d%n", totalCharacters);
|
||||
for (int i = 0, max = totalCharacters + 1; i < max; i++)
|
||||
{
|
||||
// index into the strike
|
||||
int location = HexFormatter.unsignedShort (buffer, locationTableOffset + i * 2);
|
||||
|
||||
// System.out.printf ("%3d %04X %n", i, location);
|
||||
int j = i + 1; // next character
|
||||
if (j < max)
|
||||
{
|
||||
int nextLocation =
|
||||
HexFormatter.unsignedShort (buffer, locationTableOffset + j * 2);
|
||||
int pixelWidth = nextLocation - location;
|
||||
// if (pixelWidth < 0)
|
||||
// {
|
||||
// System.out.println ("*********** Bad pixelWidth");
|
||||
// corrupt = true;
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (pixelWidth > 0)
|
||||
characters.put (i, new Character (location, pixelWidth));
|
||||
{
|
||||
QuickDrawCharacter c = new QuickDrawCharacter (location, pixelWidth);
|
||||
qdCharacters.put (i, c);
|
||||
characters.add (c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private void buildDisplay ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int inset = 10;
|
||||
int spacing = 5;
|
||||
|
@ -184,10 +191,10 @@ public class QuickDrawFont extends AbstractFile
|
|||
|
||||
for (int i = 0; i < totalCharacters + 1; i++)
|
||||
{
|
||||
int pos = characters.containsKey (i) ? i : lastChar + 1;
|
||||
Character character = characters.get (pos);
|
||||
int pos = qdCharacters.containsKey (i) ? i : lastChar + 1;
|
||||
QuickDrawCharacter character = qdCharacters.get (pos);
|
||||
|
||||
// how the character image to be drawn should be positioned with
|
||||
// how the character image to be drawn should be positioned with
|
||||
// respect to the current pen location
|
||||
// int offset = buffer[offsetWidthTableOffset + i * 2 + 1];
|
||||
// how far the pen should be advanced after the character is drawn
|
||||
|
@ -206,8 +213,10 @@ public class QuickDrawFont extends AbstractFile
|
|||
g2d.dispose ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ("Name : " + name + "\n\n");
|
||||
text.append ("File type : Font\n");
|
||||
|
@ -260,16 +269,21 @@ public class QuickDrawFont extends AbstractFile
|
|||
location, pixelWidth, offset, width));
|
||||
}
|
||||
|
||||
// text.append (super.getText ());
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
class Character
|
||||
// ---------------------------------------------------------------------------------//
|
||||
class QuickDrawCharacter extends Character
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
private final BufferedImage image;
|
||||
|
||||
public Character (int strikeOffset, int strikeWidth)
|
||||
// -------------------------------------------------------------------------------//
|
||||
public QuickDrawCharacter (int strikeOffset, int strikeWidth)
|
||||
// -------------------------------------------------------------------------------//
|
||||
{
|
||||
image = new BufferedImage (strikeWidth, fRectHeight, BufferedImage.TYPE_BYTE_GRAY);
|
||||
super (strikeWidth, fRectHeight);
|
||||
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
|
||||
int element = 0;
|
||||
|
|
|
@ -20,7 +20,7 @@ public class SHRPictureFile2 extends HiResImage
|
|||
switch (fileType)
|
||||
{
|
||||
case ProdosConstants.FILE_TYPE_PNT: // packed images
|
||||
doPnt (buffer);
|
||||
doPnt ();
|
||||
break;
|
||||
|
||||
case ProdosConstants.FILE_TYPE_PIC: // unpacked images
|
||||
|
@ -35,7 +35,7 @@ public class SHRPictureFile2 extends HiResImage
|
|||
createImage ();
|
||||
}
|
||||
|
||||
private void doPnt (byte[] buffer)
|
||||
private void doPnt ()
|
||||
{
|
||||
switch (auxType)
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
|
|||
|
||||
public class ShapeTable extends AbstractFile
|
||||
{
|
||||
private final List<Shape> shapes = new ArrayList<Shape> ();
|
||||
private final List<Shape> shapes = new ArrayList<> ();
|
||||
private static final int SIZE = 400;
|
||||
int maxWidth = 0;
|
||||
int maxHeight = 0;
|
||||
|
@ -326,7 +326,7 @@ public class ShapeTable extends AbstractFile
|
|||
|
||||
private List<String> split (String line)
|
||||
{
|
||||
List<String> list = new ArrayList<String> ();
|
||||
List<String> list = new ArrayList<> ();
|
||||
while (line.length () > 48)
|
||||
{
|
||||
list.add (line.substring (0, 47));
|
||||
|
|
|
@ -159,7 +159,7 @@ public class DiskFactory
|
|||
{
|
||||
if (debug)
|
||||
System.out.println (" ** hdv **");
|
||||
ProdosDisk prodosDisk = checkHardDisk (file);
|
||||
FormattedDisk prodosDisk = checkHardDisk (file);
|
||||
if (prodosDisk != null)
|
||||
return prodosDisk;
|
||||
|
||||
|
@ -520,7 +520,7 @@ public class DiskFactory
|
|||
return null;
|
||||
}
|
||||
|
||||
private static ProdosDisk checkHardDisk (File file)
|
||||
private static FormattedDisk checkHardDisk (File file)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
|
@ -555,6 +555,12 @@ public class DiskFactory
|
|||
System.out.println (" --> PRODOS hard disk");
|
||||
return new ProdosDisk (disk);
|
||||
}
|
||||
if (PascalDisk.isCorrectFormat (disk, debug))
|
||||
{
|
||||
if (debug)
|
||||
System.out.println (" --> Pascal hard disk");
|
||||
return new PascalDisk (disk);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -382,6 +382,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
|||
case FILE_TYPE_PNT:
|
||||
if (auxType == 2)
|
||||
file = new SHRPictureFile1 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
else if (endOfFile < 0x222)
|
||||
file = new DefaultAppleFile (name, exactBuffer);
|
||||
else
|
||||
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue