more graphics formats

This commit is contained in:
Denis Molony 2018-08-01 17:23:12 +10:00
parent a0ffb8e530
commit 21db7541bd
5 changed files with 72 additions and 61 deletions

View File

@ -23,25 +23,25 @@ public abstract class HiResImage extends AbstractFile
// $06 BIN $1FFF eof $1FF8/$1FFF/$2000/$4000 - OriginalHiResImage
// $06 BIN $2000 eof $1FF8/$1FFF/$2000/$4000 - OriginalHiResImage
// $06 BIN $4000 eof $1FF8/$1FFF/$2000/$4000 - OriginalHiResImage
// $06 BIN .3200 - ???
// $06 BIN .3201 - ???
// $06 BIN .3200 - SHRPictureFile2
// $06 BIN .3201 - SHRPictureFile2
// $08 PICT <$4000 Apple II Graphics File - ???
// $08 PICT $4000 Packed Hi-Res file - ???
// $08 PICT $4001 Packed Double Hi-Res file - ???
// $C0 PNT $0000 Paintworks Packed Super Hi-Res - 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 $0003 Packed IIGS QuickDraw II PICT File - SHRPictureFile2 *
// $C0 PNT $0004 Packed Super Hi-Res 3200 (Brooks) (yy) .3201? - SHRPictureFile2 *
// * $C0 PNT $0000 Paintworks Packed Super Hi-Res - 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 $0003 Packed IIGS QuickDraw II PICT File - SHRPictureFile2 *
// * $C0 PNT $0004 Packed Super Hi-Res 3200 (Brooks) .3201 - SHRPictureFile2
// $C0 PNT $8001 GTv background picture
// $C0 PNT $8005 DreamGraphix document
// $C0 PNT $8006 GIF
// * $C1 PIC $0000 IIGS Super Hi-Res Image (xx) - SHRPictureFile2
// $C1 PIC $0001 IIGS QuickDraw II PICT File - SHRPictureFile2 *
// * $C1 PIC $0002 Super Hi-Res 3200 (Brooks) (yy) .3200? - SHRPictureFile2
// * $C1 PIC $0000 IIGS Super Hi-Res Image (xx) - SHRPictureFile2
// $C1 PIC $0001 IIGS QuickDraw II PICT File - SHRPictureFile2 *
// * $C1 PIC $0002 Super Hi-Res 3200 (Brooks) .3200 - SHRPictureFile2
// $C1 PIC $8001 Allison raw image
// $C1 PIC $8002 Thunderscan
// $C1 PIC $8003 DreamGraphix
@ -164,9 +164,9 @@ public abstract class HiResImage extends AbstractFile
public String getText ()
{
String auxText = "";
StringBuilder text = new StringBuilder ("Image File : " + name);
text.append (String.format ("%nFile type : $%02X %s", fileType,
ProdosConstants.fileTypes[fileType]));
StringBuilder text = new StringBuilder ();
text.append (String.format ("Image File : %s%nFile type : $%02X %s%n", name,
fileType, ProdosConstants.fileTypes[fileType]));
switch (fileType)
{
@ -226,18 +226,16 @@ public abstract class HiResImage extends AbstractFile
}
if (!auxText.isEmpty ())
text.append (String.format ("%nAux type : $%04X %s", auxType, auxText));
text.append (String.format ("Aux type : $%04X %s%n", auxType, auxText));
text.append (String.format ("%nFile size : %,d", buffer.length));
text.append (String.format ("%nEOF : %,d", eof));
text.append (String.format ("File size : %,d%n", buffer.length));
text.append (String.format ("EOF : %,d%n", eof));
if (unpackedBuffer != null)
{
text.append (String.format ("%nUnpacked : %,d%n%n", unpackedBuffer.length));
// text.append (HexFormatter.format (unpackedBuffer));
}
text.append (String.format ("Unpacked : %,d%n", unpackedBuffer.length));
if (!failureReason.isEmpty ())
text.append (String.format ("%nFailure : %s", failureReason));
text.append (String.format ("Failure : %s%n", failureReason));
text.deleteCharAt (text.length () - 1);
return text.toString ();
}
@ -488,11 +486,6 @@ public abstract class HiResImage extends AbstractFile
this.id = id;
for (int i = 0; i < 16; i++)
{
// if (offset >= data.length)
// {
// System.out.println ("oops");
// return;
// }
entries[i] = new ColorEntry (data, offset);
offset += 2;
}

View File

@ -115,9 +115,9 @@ public class SHRPictureFile1 extends HiResImage
ColorTable colorTable = multipalBlock != null ? multipalBlock.colorTables[line]
: mainBlock.colorTables[lo & 0x0F];
boolean fillMode = (lo & 0x20) != 0;
if (fillMode)
System.out.println ("fillmode " + fillMode);
// boolean fillMode = (lo & 0x20) != 0;
// if (fillMode)
// System.out.println ("fillmode " + fillMode);
// 320 mode
for (int i = 0; i < 160; i++)

View File

@ -39,22 +39,15 @@ public class SHRPictureFile2 extends HiResImage
{
switch (auxType)
{
case 0:
System.out.printf (
"%s: PNT aux 0 (Paintworks Packed SHR Image) not written yet%n", name);
int background = HexFormatter.intValue (buffer[0x20], buffer[0x21]);
case 0: // packed Paintworks SHR
controlBytes = new byte[200]; // all pointing to 0th color table
colorTables = new ColorTable[1];
colorTables[0] = new ColorTable (0, this.buffer, 0);
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);
failureReason = "not written yet";
this.buffer = unpackBytes (data);
break;
case 1: // packed version of PIC/$00
@ -71,8 +64,9 @@ public class SHRPictureFile2 extends HiResImage
break;
case 3: // packed version of PIC/$01
System.out.printf ("%s: PNT aux 3 (Packed IIGS SHR Image) not written yet%n",
name);
System.out.printf ("%s: PNT aux 3 (QuickDraw PICT) not written yet%n", name);
failureReason = "not written yet";
// Apple IIGS Tech Note #46
// https://www.prepressure.com/library/file-formats/pict
this.buffer = unpackBytes (buffer);
@ -80,22 +74,33 @@ public class SHRPictureFile2 extends HiResImage
int rect1 = HexFormatter.unsignedLong (this.buffer, 2);
int rect2 = HexFormatter.unsignedLong (this.buffer, 6);
int version = HexFormatter.unsignedShort (this.buffer, 10); // $8211
break;
case 4: // packed version of PIC/$02
System.out.printf ("%s: PNT aux 4 (Packed SHR Brooks Image) not tested yet%n",
name);
this.buffer = unpackBytes (buffer);
case 99: // testing .3201 binary files
// 00000 - 00003 'APP' 0x00
// 00004 - 06403 200 color tables of 32 bytes each (one color table per scan line)
// 06404 - eof packed pixel data --> 32,000 bytes
colorTables = new ColorTable[200];
for (int i = 0; i < colorTables.length; i++)
{
colorTables[i] = new ColorTable (i, this.buffer, 32000 + i * 32);
colorTables[i] = new ColorTable (i, this.buffer, 4 + i * 32);
colorTables[i].reverse ();
}
data = new byte[buffer.length - 6404]; // skip APP. and color tables
System.arraycopy (buffer, 6404, data, 0, data.length);
this.buffer = unpackBytes (data);
break;
default:
System.out.printf ("%s: PNT unknown aux: %04X%n", name, auxType);
failureReason = "unknown PNT aux";
}
}
@ -104,7 +109,7 @@ public class SHRPictureFile2 extends HiResImage
switch (auxType)
{
case 0: // unpacked version of PNT/$01
case 0x4100:
case 0x4100: // no idea what this is
// 00000 - 31999 pixel data 32,000 bytes
// 32000 - 32199 200 control bytes (one per scan line)
// 32200 - 32255 empty
@ -119,7 +124,8 @@ public class SHRPictureFile2 extends HiResImage
break;
case 1: // unpacked version of PNT/$03
System.out.printf ("%s: PIC aux 1 not written yet%n", name);
System.out.printf ("%s: PIC aux 1 (QuickDraw PICT) not written yet%n", name);
failureReason = "not written yet";
break;
case 2: // unpacked version of PNT/$04, .3200
@ -142,6 +148,7 @@ public class SHRPictureFile2 extends HiResImage
default:
System.out.println ("PIC unknown aux " + auxType);
failureReason = "unknown PIC aux";
}
}
@ -158,10 +165,22 @@ public class SHRPictureFile2 extends HiResImage
int element = 0;
int ptr = 0;
ColorTable colorTable = null;
for (int row = 0; row < 200; row++)
{
ColorTable colorTable =
controlBytes != null ? colorTables[controlBytes[row] & 0x0F] : colorTables[row];
if (controlBytes != null)
{
int controlByte = controlBytes[row];
int mode = controlByte & 0x80;
int index = controlByte & 0x0F;
int fillMode = controlByte & 0x20;
colorTable = colorTables[index];
if (mode != 0)
System.out.println ("640!!!");
}
else
colorTable = colorTables[row];
for (int col = 0; col < 160; col++)
{
@ -180,7 +199,7 @@ public class SHRPictureFile2 extends HiResImage
public String getText ()
{
StringBuilder text = new StringBuilder (super.getText ());
text.append ("\n\n");
text.append ("\n");
if (controlBytes != null)
{

View File

@ -241,11 +241,10 @@ class FileEntry extends CatalogEntry implements ProdosConstants
else if (name.endsWith (".BMP") && HiResImage.isBmp (exactBuffer))
file = new OriginalHiResImage (name, exactBuffer, auxType);
else if (name.endsWith (".3200")) // $C1/02
// 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);
// file = new DefaultAppleFile (name, exactBuffer);
file = new SHRPictureFile2 (name, exactBuffer, 0xC0, 99, endOfFile);
else if (name.endsWith (".FNT") && FontFile.isFont (exactBuffer))
file = new FontFile (name, exactBuffer);
else if (ShapeTable.isShapeTable (exactBuffer))

View File

@ -89,14 +89,14 @@ class ProdosDirectory extends AbstractFile implements ProdosConstants
case FILE_TYPE_PIC:
aux = HexFormatter.intValue (buffer[i + 31], buffer[i + 32]);
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);
// 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;
case 0x1A: // AWP file