mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-12-01 09:50:32 +00:00
pretty lines
This commit is contained in:
parent
ca5253a56c
commit
7a9c73ce9c
@ -8,7 +8,9 @@ import java.awt.image.DataBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
abstract class CharacterList extends AbstractFile
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
static final int borderX = 3;
|
||||
static final int borderY = 3;
|
||||
@ -20,12 +22,16 @@ 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)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer);
|
||||
|
||||
@ -67,15 +73,21 @@ abstract class CharacterList extends AbstractFile
|
||||
g2d.dispose ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
abstract Character createCharacter (byte[] buffer, int ptr);
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
int dimension (int chars, int border, int size, int gap)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return border * 2 + chars * (size + gap) - gap;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ("Name : " + name + "\n\n");
|
||||
|
||||
@ -88,12 +100,16 @@ abstract class CharacterList extends AbstractFile
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
class Character
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
BufferedImage image = new BufferedImage (sizeX, sizeY, BufferedImage.TYPE_BYTE_GRAY);
|
||||
|
||||
// -------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String toString ()
|
||||
// -------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
|
@ -5,7 +5,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// see graffidisk.v1.0.2mg
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class CharacterRom extends CharacterList
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private static final int charsX = 16;
|
||||
private static final int charsY = 6;
|
||||
@ -13,7 +15,9 @@ public class CharacterRom extends CharacterList
|
||||
String description;
|
||||
List<Character> characters = new ArrayList<> ();
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public CharacterRom (String name, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer, charsX, charsY, 256);
|
||||
|
||||
@ -23,7 +27,9 @@ public class CharacterRom extends CharacterList
|
||||
assert sizeY == (buffer[6] & 0xFF);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public static boolean isRom (byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (buffer.length != 0x400)
|
||||
return false;
|
||||
@ -34,15 +40,21 @@ public class CharacterRom extends CharacterList
|
||||
&& buffer[2] == (byte) 0x53 && buffer[3] == (byte) 0x10;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
Character createCharacter (byte[] buffer, int ptr)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return new CharacterRomCharacter (buffer, ptr);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
class CharacterRomCharacter extends Character
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
// -------------------------------------------------------------------------------//
|
||||
public CharacterRomCharacter (byte[] buffer, int ptr)
|
||||
// -------------------------------------------------------------------------------//
|
||||
{
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
|
@ -5,27 +5,37 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// Found on Pascal disks
|
||||
// -----------------------------------------------------------------------------------//
|
||||
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);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
Character createCharacter (byte[] buffer, int ptr)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return new CharsetCharacter (buffer, ptr);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
class CharsetCharacter extends Character
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
// -------------------------------------------------------------------------------//
|
||||
public CharsetCharacter (byte[] buffer, int ptr)
|
||||
// -------------------------------------------------------------------------------//
|
||||
{
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
|
@ -4,21 +4,27 @@ 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);
|
||||
|
||||
loadAddress = address;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public static boolean isFont (byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (buffer.length % 8 != 0)
|
||||
return false;
|
||||
@ -28,15 +34,21 @@ public class FontFile extends CharacterList
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
Character createCharacter (byte[] buffer, int ptr)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return new FontFileCharacter (buffer, ptr);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
class FontFileCharacter extends Character
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
// -------------------------------------------------------------------------------//
|
||||
public FontFileCharacter (byte[] buffer, int ptr)
|
||||
// -------------------------------------------------------------------------------//
|
||||
{
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user