graphics changes

This commit is contained in:
Denis Molony 2018-07-28 22:00:02 +10:00
parent 70e54cad1e
commit f25e591d1a
10 changed files with 132 additions and 65 deletions

View File

@ -34,17 +34,20 @@ public abstract class HiResImage extends AbstractFile
// * $C0 PNT $0001 Packed IIGS Super Hi-Res Image (xx) - SHRPictureFile2 // * $C0 PNT $0001 Packed IIGS Super Hi-Res Image (xx) - SHRPictureFile2
// * $C0 PNT $0002 IIGS Super Hi-Res Picture File (APF) - SHRPictureFile // * $C0 PNT $0002 IIGS Super Hi-Res Picture File (APF) - SHRPictureFile
// $C0 PNT $0003 Packed IIGS QuickDraw II PICT File - SHRPictureFile2 * // $C0 PNT $0003 Packed IIGS QuickDraw II PICT File - SHRPictureFile2 *
// $C0 PNT $0004 Packed Super Hi-Res 3200 (Brooks) (yy) - SHRPictureFile2 * // $C0 PNT $0004 Packed Super Hi-Res 3200 (Brooks) (yy) .3201? - SHRPictureFile2 *
// $C0 PNT $8001 // $C0 PNT $8001 GTv background picture
// $C0 PNT $8005 // $C0 PNT $8005 DreamGraphix document
// $C0 PNT $8006 // $C0 PNT $8006 GIF
// * $C1 PIC $0000 IIGS Super Hi-Res Image (xx) - SHRPictureFile2 // * $C1 PIC $0000 IIGS Super Hi-Res Image (xx) - SHRPictureFile2
// $C1 PIC $0001 IIGS QuickDraw II PICT File - SHRPictureFile2 * // $C1 PIC $0001 IIGS QuickDraw II PICT File - SHRPictureFile2 *
// * $C1 PIC $0002 Super Hi-Res 3200 (Brooks) (yy) - SHRPictureFile2 // * $C1 PIC $0002 Super Hi-Res 3200 (Brooks) (yy) .3200? - SHRPictureFile2
// $C1 PIC $8001 // $C1 PIC $8001 Allison raw image
// $C1 PIC $8002 // $C1 PIC $8002 Thunderscan
// $C1 PIC $8003 // $C1 PIC $8003 DreamGraphix
// $C2 ANI Paintworks animation
// $C3 PAL Paintworks palette
protected static PaletteFactory paletteFactory = new PaletteFactory (); protected static PaletteFactory paletteFactory = new PaletteFactory ();
@ -190,6 +193,8 @@ public abstract class HiResImage extends AbstractFile
auxText = "Super Hi-Res Image (Apple Preferred)"; auxText = "Super Hi-Res Image (Apple Preferred)";
else if (auxType == 3) else if (auxType == 3)
auxText = "Packed QuickDraw II PICT File"; auxText = "Packed QuickDraw II PICT File";
else if (auxType == 4)
auxText = "Packed Super Hi-Res 3200 color image";
else else
auxText = "Unknown aux: " + auxType; auxText = "Unknown aux: " + auxType;
break; break;
@ -235,10 +240,26 @@ public abstract class HiResImage extends AbstractFile
// Super Hi-res IIGS // Super Hi-res IIGS
protected byte[] unpackBytes (byte[] buffer) protected byte[] unpackBytes (byte[] buffer)
{
for (int i = 1; i <= 4; i++)
try
{
byte[] newBuf = new byte[32768 * i]; // keep guessing
unpack (buffer, newBuf);
return newBuf;
}
catch (ArrayIndexOutOfBoundsException e)
{
}
return new byte[0];
}
private void unpack (byte[] buffer, byte[] newBuf) throws ArrayIndexOutOfBoundsException
{ {
// routine found here - http://kpreid.livejournal.com/4319.html // routine found here - http://kpreid.livejournal.com/4319.html
byte[] newBuf = new byte[32768]; // this might be wrong
byte[] fourBuf = new byte[4]; byte[] fourBuf = new byte[4];
int ptr = 0, newPtr = 0; int ptr = 0, newPtr = 0;
@ -276,8 +297,6 @@ public abstract class HiResImage extends AbstractFile
break; break;
} }
} }
return newBuf;
} }
// Super Hi-res IIGS // Super Hi-res IIGS

View File

@ -41,9 +41,28 @@ public class SHRPictureFile1 extends HiResImage
blocks.add (multipalBlock); blocks.add (multipalBlock);
break; break;
case "PALETTES":
System.out.println ("PALETTES not written");
blocks.add (new Block (kind, data));
break;
case "MASK":
System.out.println ("MASK not written");
blocks.add (new Block (kind, data));
break;
case "PATS":
System.out.println ("PATS not written");
blocks.add (new Block (kind, data));
break;
case "SCIB":
System.out.println ("SCIB not written");
blocks.add (new Block (kind, data));
break;
// case "SuperConvert": // case "SuperConvert":
// case "EOA ": // DeluxePaint // case "EOA ": // DeluxePaint
// case "PATS":
// case "Platinum Paint": // case "Platinum Paint":
// blocks.add (new Block (kind, data)); // blocks.add (new Block (kind, data));
// break; // break;

View File

@ -25,6 +25,17 @@ public class SHRPictureFile2 extends HiResImage
case 0: case 0:
System.out.printf ( System.out.printf (
"%s: PNT aux 0 (Paintworks Packed SHR Image) not written yet%n", name); "%s: PNT aux 0 (Paintworks Packed SHR Image) not written yet%n", name);
int background = HexFormatter.intValue (buffer[0x20], buffer[0x21]);
byte[] palette = new byte[32];
byte[] patterns = new byte[512];
byte[] data = new byte[buffer.length - 0x222];
System.arraycopy (buffer, 0x00, palette, 0, palette.length);
System.arraycopy (buffer, 0x22, patterns, 0, patterns.length);
System.arraycopy (buffer, 0x0222, data, 0, data.length);
this.buffer = unpackBytes (data);
break; break;
case 1: // packed version of PIC/$00 case 1: // packed version of PIC/$00
@ -52,7 +63,7 @@ public class SHRPictureFile2 extends HiResImage
colorTables = new ColorTable[200]; colorTables = new ColorTable[200];
for (int i = 0; i < colorTables.length; i++) for (int i = 0; i < colorTables.length; i++)
{ {
colorTables[i] = new ColorTable (i, buffer, 32000 + i * 32); colorTables[i] = new ColorTable (i, this.buffer, 32000 + i * 32);
colorTables[i].reverse (); colorTables[i].reverse ();
} }
break; break;
@ -173,6 +184,7 @@ public class SHRPictureFile2 extends HiResImage
text.append ("\nScreen lines\n\n"); text.append ("\nScreen lines\n\n");
for (int i = 0; i < 200; i++) for (int i = 0; i < 200; i++)
{ {
text.append (String.format ("Line: %02X %<3d%n", i));
text.append (HexFormatter.format (buffer, i * 160, 160)); text.append (HexFormatter.format (buffer, i * 160, 160));
text.append ("\n\n"); text.append ("\n\n");
} }

View File

@ -36,7 +36,7 @@ class DataPanel extends JTabbedPane
JTextArea formattedText; JTextArea formattedText;
ImagePanel imagePanel; // internal class ImagePanel imagePanel; // internal class
boolean debug; boolean debugMode;
boolean imageVisible = false; boolean imageVisible = false;
@ -182,7 +182,7 @@ class DataPanel extends JTabbedPane
public void setDebug (boolean value) public void setDebug (boolean value)
{ {
debug = value; debugMode = value;
if (currentDataSource instanceof VisicalcFile) if (currentDataSource instanceof VisicalcFile)
{ {
@ -271,7 +271,7 @@ class DataPanel extends JTabbedPane
} }
BufferedImage image = dataSource.getImage (); BufferedImage image = dataSource.getImage ();
if (image == null || debug) if (image == null || debugMode)
removeImage (); removeImage ();
else else
{ {

View File

@ -15,8 +15,7 @@ public class DebuggingAction extends AbstractAction
{ {
super ("Debugging"); super ("Debugging");
putValue (Action.SHORT_DESCRIPTION, "Show debugging information"); putValue (Action.SHORT_DESCRIPTION, "Show debugging information");
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("ctrl D")); putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("meta D"));
// putValue (Action.MNEMONIC_KEY, KeyEvent.VK_D);
this.owner = owner; this.owner = owner;
} }

View File

@ -39,32 +39,32 @@ public class MenuHandler
JMenu helpMenu = new JMenu ("Help"); JMenu helpMenu = new JMenu ("Help");
// File menu items // File menu items
JMenuItem rootItem = new JMenuItem ("Set root folder..."); final JMenuItem rootItem = new JMenuItem ("Set root folder...");
JMenuItem refreshTreeItem = new JMenuItem ("Refresh current tree"); final JMenuItem refreshTreeItem = new JMenuItem ("Refresh current tree");
JMenuItem executeDiskItem; JMenuItem executeDiskItem;
JMenuItem printItem = new JMenuItem ("Print output panel..."); final JMenuItem printItem = new JMenuItem ("Print output panel...");
JMenuItem closeTabItem = new JMenuItem (); final JMenuItem closeTabItem = new JMenuItem ();
JMenuItem duplicateItem = new JMenuItem (); final JMenuItem duplicateItem = new JMenuItem ();
FontAction fontAction; final FontAction fontAction;
// Format menu items // Format menu items
final JMenuItem lineWrapItem = new JCheckBoxMenuItem ("Line wrap"); final JMenuItem lineWrapItem = new JCheckBoxMenuItem ("Line wrap");
final JMenuItem showLayoutItem = new JCheckBoxMenuItem ("Show layout panel"); final JMenuItem showLayoutItem = new JCheckBoxMenuItem ("Show layout panel");
JMenuItem showCatalogItem = new JCheckBoxMenuItem ("Show catalog panel"); final JMenuItem showCatalogItem = new JCheckBoxMenuItem ("Show catalog panel");
JMenuItem showFreeSectorsItem = new JCheckBoxMenuItem ("Show free sectors"); final JMenuItem showFreeSectorsItem = new JCheckBoxMenuItem ("Show free sectors");
JMenuItem sector256Item = new JRadioButtonMenuItem ("256 byte sectors"); final JMenuItem sector256Item = new JRadioButtonMenuItem ("256 byte sectors");
JMenuItem sector512Item = new JRadioButtonMenuItem ("512 byte blocks"); final JMenuItem sector512Item = new JRadioButtonMenuItem ("512 byte blocks");
JMenuItem interleave0Item = new JRadioButtonMenuItem (new InterleaveAction (0)); final JMenuItem interleave0Item = new JRadioButtonMenuItem (new InterleaveAction (0));
JMenuItem interleave1Item = new JRadioButtonMenuItem (new InterleaveAction (1)); final JMenuItem interleave1Item = new JRadioButtonMenuItem (new InterleaveAction (1));
JMenuItem interleave2Item = new JRadioButtonMenuItem (new InterleaveAction (2)); final JMenuItem interleave2Item = new JRadioButtonMenuItem (new InterleaveAction (2));
JMenuItem interleave3Item = new JRadioButtonMenuItem (new InterleaveAction (3)); final JMenuItem interleave3Item = new JRadioButtonMenuItem (new InterleaveAction (3));
JMenuItem colourQuirksItem = new JCheckBoxMenuItem ("Colour quirks"); final JMenuItem colourQuirksItem = new JCheckBoxMenuItem ("Colour quirks");
JMenuItem monochromeItem = new JCheckBoxMenuItem ("Monochrome"); final JMenuItem monochromeItem = new JCheckBoxMenuItem ("Monochrome");
JMenuItem debuggingItem = new JCheckBoxMenuItem ("Debugging"); final JMenuItem debuggingItem = new JCheckBoxMenuItem ("Debugging");
JMenuItem nextPaletteItem = new JMenuItem ("Next Palette"); final JMenuItem nextPaletteItem = new JMenuItem ("Next Palette");
JMenuItem prevPaletteItem = new JMenuItem ("Previous Palette"); final JMenuItem prevPaletteItem = new JMenuItem ("Previous Palette");
ButtonGroup paletteGroup = new ButtonGroup (); ButtonGroup paletteGroup = new ButtonGroup ();

View File

@ -240,8 +240,12 @@ class FileEntry extends CatalogEntry implements ProdosConstants
file = new OriginalHiResImage (name, exactBuffer, auxType); file = new OriginalHiResImage (name, exactBuffer, auxType);
else if (name.endsWith (".BMP") && HiResImage.isBmp (exactBuffer)) else if (name.endsWith (".BMP") && HiResImage.isBmp (exactBuffer))
file = new OriginalHiResImage (name, exactBuffer, auxType); file = new OriginalHiResImage (name, exactBuffer, auxType);
else if (name.endsWith (".3200") || name.endsWith (".3201")) // unknown image file else if (name.endsWith (".3200")) // $C1/02
file = new AssemblerProgram (name, exactBuffer, auxType); // file = new AssemblerProgram (name, exactBuffer, auxType);
file = new SHRPictureFile2 (name, exactBuffer, 0xC1, 0x02, endOfFile);
else if (name.endsWith (".3201")) // $C0/04
file = new DefaultAppleFile (name, exactBuffer);
// file = new SHRPictureFile2 (name, exactBuffer, 0xC0, 0x04, endOfFile);
else if (name.endsWith (".FNT") && FontFile.isFont (exactBuffer)) else if (name.endsWith (".FNT") && FontFile.isFont (exactBuffer))
file = new FontFile (name, exactBuffer); file = new FontFile (name, exactBuffer);
else if (ShapeTable.isShapeTable (exactBuffer)) else if (ShapeTable.isShapeTable (exactBuffer))
@ -370,6 +374,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
case FILE_TYPE_PASCAL_VOLUME: case FILE_TYPE_PASCAL_VOLUME:
case FILE_TYPE_GEO: case FILE_TYPE_GEO:
case FILE_TYPE_LDF: case FILE_TYPE_LDF:
case FILE_TYPE_ANI:
case FILE_TYPE_PAL:
file = new DefaultAppleFile (name, exactBuffer); file = new DefaultAppleFile (name, exactBuffer);
break; break;

View File

@ -21,6 +21,8 @@ public interface ProdosConstants
int FILE_TYPE_GSOS_FILE_SYSTEM_TRANSLATOR = 0xBD; int FILE_TYPE_GSOS_FILE_SYSTEM_TRANSLATOR = 0xBD;
int FILE_TYPE_PNT = 0xC0; int FILE_TYPE_PNT = 0xC0;
int FILE_TYPE_PIC = 0xC1; int FILE_TYPE_PIC = 0xC1;
int FILE_TYPE_ANI = 0xC2;
int FILE_TYPE_PAL = 0xC3;
int FILE_TYPE_FONT = 0xC8; int FILE_TYPE_FONT = 0xC8;
int FILE_TYPE_FINDER = 0xC9; int FILE_TYPE_FINDER = 0xC9;
int FILE_TYPE_ICN = 0xCA; int FILE_TYPE_ICN = 0xCA;

View File

@ -6,7 +6,7 @@ import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.disk.FormattedDisk; import com.bytezone.diskbrowser.disk.FormattedDisk;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
class ProdosDirectory extends AbstractFile class ProdosDirectory extends AbstractFile implements ProdosConstants
{ {
private static final String NO_DATE = "<NO DATE>"; private static final String NO_DATE = "<NO DATE>";
private static final String newLine = String.format ("%n"); private static final String newLine = String.format ("%n");
@ -79,14 +79,24 @@ class ProdosDirectory extends AbstractFile
switch (fileType) switch (fileType)
{ {
case 4: // Text file case FILE_TYPE_TEXT:
int aux = HexFormatter.intValue (buffer[i + 31], buffer[i + 32]); int aux = HexFormatter.intValue (buffer[i + 31], buffer[i + 32]);
subType = String.format ("R=%5d", aux); subType = String.format ("R=%5d", aux);
break; break;
case 6: // BIN file case FILE_TYPE_BINARY:
case FILE_TYPE_PNT:
case FILE_TYPE_PIC:
aux = HexFormatter.intValue (buffer[i + 31], buffer[i + 32]); aux = HexFormatter.intValue (buffer[i + 31], buffer[i + 32]);
subType = String.format ("A=$%4X", aux); subType = String.format ("A=$%4X", aux);
if (fileType == FILE_TYPE_PNT && aux == 0)
System.out.printf ("found $C0/00 %s%n", name);
if (fileType == FILE_TYPE_PNT && aux == 3)
System.out.printf ("found $C0/03 %s%n", name);
if (fileType == FILE_TYPE_PNT && aux == 4)
System.out.printf ("found $C0/04 %s%n", name);
if (fileType == FILE_TYPE_PIC && aux == 1)
System.out.printf ("found $C1/01 %s%n", name);
break; break;
case 0x1A: // AWP file case 0x1A: // AWP file

View File

@ -219,29 +219,6 @@ public class ProdosDisk extends AbstractFormattedDisk
this); this);
} }
@Override
public String toString ()
{
StringBuffer text = new StringBuffer ();
String newLine = String.format ("%n");
VolumeDirectoryHeader volumeDirectory = (VolumeDirectoryHeader) headerEntries.get (0);
String timeC = volumeDirectory.created == null ? ""
: df.format (volumeDirectory.created.getTime ());
text.append ("Volume name : " + volumeDirectory.name + newLine);
text.append ("Creation date : " + timeC + newLine);
text.append ("ProDOS version : " + volumeDirectory.version + newLine);
text.append ("Min ProDOS version : " + volumeDirectory.minVersion + newLine);
text.append ("Access rights : " + volumeDirectory.access + newLine);
text.append ("Entry length : " + volumeDirectory.entryLength + newLine);
text.append ("Entries per block : " + volumeDirectory.entriesPerBlock + newLine);
text.append ("File count : " + volumeDirectory.fileCount + newLine);
text.append ("Bitmap block : " + volumeDirectory.bitMapBlock + newLine);
text.append ("Total blocks : " + volumeDirectory.totalBlocks + newLine);
return text.toString ();
}
@Override @Override
public DataSource getFormattedSector (DiskAddress da) public DataSource getFormattedSector (DiskAddress da)
{ {
@ -275,4 +252,27 @@ public class ProdosDisk extends AbstractFormattedDisk
return ((VolumeDirectoryHeader) headerEntries.get (0)).getSectors (); return ((VolumeDirectoryHeader) headerEntries.get (0)).getSectors ();
return fileEntries.get (fileNo - 1).getSectors (); return fileEntries.get (fileNo - 1).getSectors ();
} }
@Override
public String toString ()
{
StringBuffer text = new StringBuffer ();
String newLine = String.format ("%n");
VolumeDirectoryHeader volumeDirectory = (VolumeDirectoryHeader) headerEntries.get (0);
String timeC = volumeDirectory.created == null ? ""
: df.format (volumeDirectory.created.getTime ());
text.append ("Volume name : " + volumeDirectory.name + newLine);
text.append ("Creation date : " + timeC + newLine);
text.append ("ProDOS version : " + volumeDirectory.version + newLine);
text.append ("Min ProDOS version : " + volumeDirectory.minVersion + newLine);
text.append ("Access rights : " + volumeDirectory.access + newLine);
text.append ("Entry length : " + volumeDirectory.entryLength + newLine);
text.append ("Entries per block : " + volumeDirectory.entriesPerBlock + newLine);
text.append ("File count : " + volumeDirectory.fileCount + newLine);
text.append ("Bitmap block : " + volumeDirectory.bitMapBlock + newLine);
text.append ("Total blocks : " + volumeDirectory.totalBlocks + newLine);
return text.toString ();
}
} }