mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-10 15:31:28 +00:00
more pics
This commit is contained in:
parent
d4b84e8dfa
commit
d4908d91a9
@ -1,7 +1,6 @@
|
|||||||
package com.bytezone.diskbrowser.applefile;
|
package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.Color;
|
||||||
import java.awt.image.DataBuffer;
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -9,6 +8,7 @@ import java.util.List;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import com.bytezone.diskbrowser.prodos.ProdosConstants;
|
import com.bytezone.diskbrowser.prodos.ProdosConstants;
|
||||||
|
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||||
|
|
||||||
public abstract class HiResImage extends AbstractFile
|
public abstract class HiResImage extends AbstractFile
|
||||||
{
|
{
|
||||||
@ -127,16 +127,17 @@ public abstract class HiResImage extends AbstractFile
|
|||||||
{
|
{
|
||||||
String auxText = "";
|
String auxText = "";
|
||||||
StringBuilder text = new StringBuilder ("Image File : " + name);
|
StringBuilder text = new StringBuilder ("Image File : " + name);
|
||||||
text.append (String.format ("%nFile type : $%02X", fileType));
|
text.append (String.format ("%nFile type : $%02X %s", fileType,
|
||||||
|
ProdosConstants.fileTypes[fileType]));
|
||||||
|
|
||||||
switch (fileType)
|
switch (fileType)
|
||||||
{
|
{
|
||||||
case ProdosConstants.FILE_TYPE_PICT:
|
case ProdosConstants.FILE_TYPE_PICT: // 0x08
|
||||||
if (auxType < 0x4000)
|
if (auxType < 0x4000)
|
||||||
{
|
{
|
||||||
auxText = "Graphics File";
|
auxText = "Apple II Graphics File";
|
||||||
byte mode = buffer[0x78]; // 0-7
|
byte mode = buffer[0x78]; // 0-7
|
||||||
System.out.println ("Prodos PICT, mode=" + mode);
|
System.out.println ("Prodos PICT, mode=" + mode); // see mode table above
|
||||||
}
|
}
|
||||||
else if (auxType == 0x4000)
|
else if (auxType == 0x4000)
|
||||||
auxText = "Packed Hi-Res File";
|
auxText = "Packed Hi-Res File";
|
||||||
@ -144,8 +145,10 @@ public abstract class HiResImage extends AbstractFile
|
|||||||
auxText = "Packed Double Hi-Res File";
|
auxText = "Packed Double Hi-Res File";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ProdosConstants.FILE_TYPE_PNT:
|
case ProdosConstants.FILE_TYPE_PNT: // 0xC0
|
||||||
if (auxType == 1)
|
if (auxType == 0)
|
||||||
|
auxText = "Paintworks Packed SHR Image";
|
||||||
|
else if (auxType == 1)
|
||||||
auxText = "Packed Super Hi-Res Image";
|
auxText = "Packed Super Hi-Res Image";
|
||||||
else if (auxType == 2)
|
else if (auxType == 2)
|
||||||
auxText = "Super Hi-Res Image (Apple Preferred)";
|
auxText = "Super Hi-Res Image (Apple Preferred)";
|
||||||
@ -153,7 +156,7 @@ public abstract class HiResImage extends AbstractFile
|
|||||||
auxText = "Packed QuickDraw II PICT File";
|
auxText = "Packed QuickDraw II PICT File";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ProdosConstants.FILE_TYPE_PIC:
|
case ProdosConstants.FILE_TYPE_PIC: // 0xC1
|
||||||
if (auxType == 0)
|
if (auxType == 0)
|
||||||
auxText = "Super Hi-res Screen Image";
|
auxText = "Super Hi-res Screen Image";
|
||||||
else if (auxType == 1)
|
else if (auxType == 1)
|
||||||
@ -176,27 +179,6 @@ public abstract class HiResImage extends AbstractFile
|
|||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void makeScreen (byte[] buffer)
|
|
||||||
{
|
|
||||||
image = new BufferedImage (320, 200, BufferedImage.TYPE_BYTE_GRAY);
|
|
||||||
DataBuffer db = image.getRaster ().getDataBuffer ();
|
|
||||||
|
|
||||||
int element = 0;
|
|
||||||
int ptr = 0;
|
|
||||||
for (int row = 0; row < 200; row++)
|
|
||||||
for (int col = 0; col < 160; col++)
|
|
||||||
{
|
|
||||||
int pix1 = (buffer[ptr] & 0xF0) >> 4;
|
|
||||||
int pix2 = buffer[ptr] & 0x0F;
|
|
||||||
if (pix1 > 0)
|
|
||||||
db.setElem (element, 255);
|
|
||||||
if (pix2 > 0)
|
|
||||||
db.setElem (element + 1, 255);
|
|
||||||
element += 2;
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unpack the Apple PackBytes format.
|
* Unpack the Apple PackBytes format.
|
||||||
*
|
*
|
||||||
@ -216,7 +198,7 @@ public abstract class HiResImage extends AbstractFile
|
|||||||
{
|
{
|
||||||
// routine found here - http://kpreid.livejournal.com/4319.html
|
// routine found here - http://kpreid.livejournal.com/4319.html
|
||||||
|
|
||||||
byte[] newBuf = new byte[32768];
|
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;
|
||||||
@ -258,6 +240,58 @@ public abstract class HiResImage extends AbstractFile
|
|||||||
return newBuf;
|
return newBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Super Hi-res IIGS
|
||||||
|
protected int unpackLine (byte[] buffer, byte[] newBuf, int newPtr)
|
||||||
|
{
|
||||||
|
byte[] fourBuf = new byte[4];
|
||||||
|
|
||||||
|
int ptr = 0;
|
||||||
|
while (ptr < buffer.length)
|
||||||
|
{
|
||||||
|
int type = (buffer[ptr] & 0xC0) >> 6; // 0-3
|
||||||
|
int count = (buffer[ptr++] & 0x3F) + 1; // 1-64
|
||||||
|
|
||||||
|
if (ptr >= buffer.length)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
while (count-- != 0)
|
||||||
|
if (newPtr < unpackedBuffer.length && ptr < buffer.length)
|
||||||
|
newBuf[newPtr++] = buffer[ptr++];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
byte b = buffer[ptr++];
|
||||||
|
while (count-- != 0)
|
||||||
|
if (newPtr < unpackedBuffer.length)
|
||||||
|
newBuf[newPtr++] = b;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
if (ptr < buffer.length)
|
||||||
|
fourBuf[i] = buffer[ptr++];
|
||||||
|
while (count-- != 0)
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
if (newPtr < unpackedBuffer.length)
|
||||||
|
newBuf[newPtr++] = fourBuf[i];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
b = buffer[ptr++];
|
||||||
|
count *= 4;
|
||||||
|
while (count-- != 0)
|
||||||
|
if (newPtr < unpackedBuffer.length)
|
||||||
|
newBuf[newPtr++] = b;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newPtr;
|
||||||
|
}
|
||||||
|
|
||||||
// Beagle Bros routine to expand a hi-res screen
|
// Beagle Bros routine to expand a hi-res screen
|
||||||
private byte[] unscrunch (byte[] src)
|
private byte[] unscrunch (byte[] src)
|
||||||
{
|
{
|
||||||
@ -337,4 +371,114 @@ public abstract class HiResImage extends AbstractFile
|
|||||||
{
|
{
|
||||||
return paletteFactory.getPalettes ();
|
return paletteFactory.getPalettes ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ColorTable
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
ColorEntry[] entries = new ColorEntry[16];
|
||||||
|
|
||||||
|
public ColorTable ()
|
||||||
|
{
|
||||||
|
// default empty table
|
||||||
|
id = -1;
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
entries[i] = new ColorEntry ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColorTable (int id, byte[] data, int offset)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
entries[i] = new ColorEntry (data, offset);
|
||||||
|
offset += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String toLine ()
|
||||||
|
{
|
||||||
|
|
||||||
|
StringBuilder text = new StringBuilder ();
|
||||||
|
|
||||||
|
text.append (String.format (" %X", id));
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
text.append (String.format (" %04X", entries[i].value));
|
||||||
|
|
||||||
|
return text.toString ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void reverse ()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
ColorEntry temp = entries[i];
|
||||||
|
entries[i] = entries[15 - i];
|
||||||
|
entries[15 - i] = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString ()
|
||||||
|
{
|
||||||
|
StringBuilder text = new StringBuilder ();
|
||||||
|
|
||||||
|
text.append (String.format ("%2d ColorTable%n", id));
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
text.append (String.format (" %2d: %04X", i, entries[i].value));
|
||||||
|
text.append ("\n");
|
||||||
|
for (int i = 8; i < 16; i++)
|
||||||
|
text.append (String.format (" %2d: %04X", i, entries[i].value));
|
||||||
|
|
||||||
|
return text.toString ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ColorEntry
|
||||||
|
{
|
||||||
|
int value; // 0RGB
|
||||||
|
Color color;
|
||||||
|
|
||||||
|
public ColorEntry ()
|
||||||
|
{
|
||||||
|
// default empty entry
|
||||||
|
value = 0;
|
||||||
|
color = new Color (0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColorEntry (byte[] data, int offset)
|
||||||
|
{
|
||||||
|
value = HexFormatter.unsignedShort (data, offset);
|
||||||
|
|
||||||
|
int red = ((value >> 8) & 0x0f) * 17;
|
||||||
|
int green = ((value >> 4) & 0x0f) * 17;
|
||||||
|
int blue = (value & 0x0f) * 17;
|
||||||
|
color = new Color (red, green, blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString ()
|
||||||
|
{
|
||||||
|
return String.format ("ColorEntry: %04X", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DirEntry
|
||||||
|
{
|
||||||
|
int numBytes;
|
||||||
|
int mode;
|
||||||
|
|
||||||
|
public DirEntry (byte[] data, int offset)
|
||||||
|
{
|
||||||
|
numBytes = HexFormatter.unsignedShort (data, offset);
|
||||||
|
mode = HexFormatter.unsignedShort (data, offset + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString ()
|
||||||
|
{
|
||||||
|
return String.format ("Bytes: %5d, mode: %02X", numBytes, mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package com.bytezone.diskbrowser.applefile;
|
package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.DataBuffer;
|
import java.awt.image.DataBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -48,7 +47,24 @@ public class SHRPictureFile extends HiResImage
|
|||||||
@Override
|
@Override
|
||||||
protected void createMonochromeImage ()
|
protected void createMonochromeImage ()
|
||||||
{
|
{
|
||||||
makeScreen (unpackedBuffer);
|
// makeScreen (unpackedBuffer);
|
||||||
|
image = new BufferedImage (320, 200, BufferedImage.TYPE_BYTE_GRAY);
|
||||||
|
DataBuffer db = image.getRaster ().getDataBuffer ();
|
||||||
|
|
||||||
|
int element = 0;
|
||||||
|
int ptr = 0;
|
||||||
|
for (int row = 0; row < 200; row++)
|
||||||
|
for (int col = 0; col < 160; col++)
|
||||||
|
{
|
||||||
|
int pix1 = (unpackedBuffer[ptr] & 0xF0) >> 4;
|
||||||
|
int pix2 = unpackedBuffer[ptr] & 0x0F;
|
||||||
|
if (pix1 > 0)
|
||||||
|
db.setElem (element, 255);
|
||||||
|
if (pix2 > 0)
|
||||||
|
db.setElem (element + 1, 255);
|
||||||
|
element += 2;
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -220,58 +236,6 @@ public class SHRPictureFile extends HiResImage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Super Hi-res IIGS
|
|
||||||
protected int unpackLine (byte[] buffer, byte[] newBuf, int newPtr)
|
|
||||||
{
|
|
||||||
byte[] fourBuf = new byte[4];
|
|
||||||
|
|
||||||
int ptr = 0;
|
|
||||||
while (ptr < buffer.length)
|
|
||||||
{
|
|
||||||
int type = (buffer[ptr] & 0xC0) >> 6; // 0-3
|
|
||||||
int count = (buffer[ptr++] & 0x3F) + 1; // 1-64
|
|
||||||
|
|
||||||
if (ptr >= buffer.length)
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
while (count-- != 0)
|
|
||||||
if (newPtr < unpackedBuffer.length && ptr < buffer.length)
|
|
||||||
newBuf[newPtr++] = buffer[ptr++];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
byte b = buffer[ptr++];
|
|
||||||
while (count-- != 0)
|
|
||||||
if (newPtr < unpackedBuffer.length)
|
|
||||||
newBuf[newPtr++] = b;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
if (ptr < buffer.length)
|
|
||||||
fourBuf[i] = buffer[ptr++];
|
|
||||||
while (count-- != 0)
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
if (newPtr < unpackedBuffer.length)
|
|
||||||
newBuf[newPtr++] = fourBuf[i];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
b = buffer[ptr++];
|
|
||||||
count *= 4;
|
|
||||||
while (count-- != 0)
|
|
||||||
if (newPtr < unpackedBuffer.length)
|
|
||||||
newBuf[newPtr++] = b;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isEmpty (byte[] buffer)
|
private boolean isEmpty (byte[] buffer)
|
||||||
{
|
{
|
||||||
for (byte b : buffer)
|
for (byte b : buffer)
|
||||||
@ -340,104 +304,4 @@ public class SHRPictureFile extends HiResImage
|
|||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ColorTable
|
|
||||||
{
|
|
||||||
int id;
|
|
||||||
ColorEntry[] entries = new ColorEntry[16];
|
|
||||||
|
|
||||||
public ColorTable ()
|
|
||||||
{
|
|
||||||
// default empty table
|
|
||||||
id = -1;
|
|
||||||
for (int i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
entries[i] = new ColorEntry ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColorTable (int id, byte[] data, int offset)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
for (int i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
entries[i] = new ColorEntry (data, offset);
|
|
||||||
offset += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String toLine ()
|
|
||||||
{
|
|
||||||
|
|
||||||
StringBuilder text = new StringBuilder ();
|
|
||||||
|
|
||||||
text.append (String.format (" %X", id));
|
|
||||||
for (int i = 0; i < 16; i++)
|
|
||||||
text.append (String.format (" %04X", entries[i].value));
|
|
||||||
|
|
||||||
return text.toString ();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString ()
|
|
||||||
{
|
|
||||||
StringBuilder text = new StringBuilder ();
|
|
||||||
|
|
||||||
text.append (String.format ("%2d ColorTable%n", id));
|
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
text.append (String.format (" %2d: %04X", i, entries[i].value));
|
|
||||||
text.append ("\n");
|
|
||||||
for (int i = 8; i < 16; i++)
|
|
||||||
text.append (String.format (" %2d: %04X", i, entries[i].value));
|
|
||||||
|
|
||||||
return text.toString ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ColorEntry
|
|
||||||
{
|
|
||||||
int value; // 0RGB
|
|
||||||
Color color;
|
|
||||||
|
|
||||||
public ColorEntry ()
|
|
||||||
{
|
|
||||||
// default empty entry
|
|
||||||
value = 0;
|
|
||||||
color = new Color (0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColorEntry (byte[] data, int offset)
|
|
||||||
{
|
|
||||||
value = HexFormatter.unsignedShort (data, offset);
|
|
||||||
|
|
||||||
int red = ((value >> 8) & 0x0f) * 17;
|
|
||||||
int green = ((value >> 4) & 0x0f) * 17;
|
|
||||||
int blue = (value & 0x0f) * 17;
|
|
||||||
color = new Color (red, green, blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString ()
|
|
||||||
{
|
|
||||||
return String.format ("ColorEntry: %04X", value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DirEntry
|
|
||||||
{
|
|
||||||
int numBytes;
|
|
||||||
int mode;
|
|
||||||
|
|
||||||
public DirEntry (byte[] data, int offset)
|
|
||||||
{
|
|
||||||
numBytes = HexFormatter.unsignedShort (data, offset);
|
|
||||||
mode = HexFormatter.unsignedShort (data, offset + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString ()
|
|
||||||
{
|
|
||||||
return String.format ("Bytes: %5d, mode: %02X", numBytes, mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,16 +1,63 @@
|
|||||||
package com.bytezone.diskbrowser.applefile;
|
package com.bytezone.diskbrowser.applefile;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.DataBuffer;
|
||||||
|
|
||||||
|
import com.bytezone.diskbrowser.prodos.ProdosConstants;
|
||||||
|
|
||||||
public class SHRPictureFile2 extends HiResImage
|
public class SHRPictureFile2 extends HiResImage
|
||||||
{
|
{
|
||||||
|
ColorTable[] colorTables;
|
||||||
|
byte[] scb;
|
||||||
|
|
||||||
public SHRPictureFile2 (String name, byte[] buffer, int fileType, int auxType, int eof)
|
public SHRPictureFile2 (String name, byte[] buffer, int fileType, int auxType, int eof)
|
||||||
{
|
{
|
||||||
super (name, buffer, fileType, auxType, eof);
|
super (name, buffer, fileType, auxType, eof);
|
||||||
|
|
||||||
// type $C0.0001 - packed SHR
|
if (fileType == ProdosConstants.FILE_TYPE_PIC) // 0xC1
|
||||||
// type $C1.0001 - unpacked SHR
|
{
|
||||||
// type $C1.0002 -
|
if (auxType == 0)
|
||||||
// System.out.println (buffer.length);
|
{
|
||||||
|
scb = new byte[200];
|
||||||
|
System.arraycopy (buffer, 32000, scb, 0, scb.length);
|
||||||
|
|
||||||
|
colorTables = new ColorTable[16];
|
||||||
|
for (int i = 0; i < colorTables.length; i++)
|
||||||
|
colorTables[i] = new ColorTable (i, buffer, 32256 + i * 32);
|
||||||
|
}
|
||||||
|
else if (auxType == 1)
|
||||||
|
{
|
||||||
|
System.out.println ("0xC1 aux 1 not written");
|
||||||
|
}
|
||||||
|
else if (auxType == 2) // Brooks
|
||||||
|
{
|
||||||
|
colorTables = new ColorTable[200];
|
||||||
|
for (int i = 0; i < colorTables.length; i++)
|
||||||
|
{
|
||||||
|
colorTables[i] = new ColorTable (i, buffer, 32000 + i * 32);
|
||||||
|
colorTables[i].reverse ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
System.out.println ("unknown aux " + auxType);
|
||||||
|
}
|
||||||
|
else if (fileType == ProdosConstants.FILE_TYPE_PNT) // 0xC0
|
||||||
|
{
|
||||||
|
if (auxType == 0)
|
||||||
|
{
|
||||||
|
System.out.println ("0xC0 aux 0 not written");
|
||||||
|
}
|
||||||
|
else if (auxType == 1)
|
||||||
|
{
|
||||||
|
System.out.println ("0xC0 aux 1 not written");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
System.out.println ("unknown aux " + auxType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
System.out.println ("unknown filetype " + fileType);
|
||||||
|
|
||||||
|
createImage ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -21,6 +68,48 @@ public class SHRPictureFile2 extends HiResImage
|
|||||||
@Override
|
@Override
|
||||||
protected void createColourImage ()
|
protected void createColourImage ()
|
||||||
{
|
{
|
||||||
|
image = new BufferedImage (320, 200, BufferedImage.TYPE_INT_RGB);
|
||||||
|
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||||
|
|
||||||
|
int element = 0;
|
||||||
|
int ptr = 0;
|
||||||
|
for (int row = 0; row < 200; row++)
|
||||||
|
{
|
||||||
|
ColorTable colorTable =
|
||||||
|
scb != null ? colorTables[scb[row] & 0x0F] : colorTables[row];
|
||||||
|
|
||||||
|
for (int col = 0; col < 160; col++)
|
||||||
|
{
|
||||||
|
int left = (buffer[ptr] & 0xF0) >> 4;
|
||||||
|
int right = buffer[ptr] & 0x0F;
|
||||||
|
|
||||||
|
dataBuffer.setElem (element++, colorTable.entries[left].color.getRGB ());
|
||||||
|
dataBuffer.setElem (element++, colorTable.entries[right].color.getRGB ());
|
||||||
|
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText ()
|
||||||
|
{
|
||||||
|
StringBuilder text = new StringBuilder (super.getText ());
|
||||||
|
text.append ("\n\n");
|
||||||
|
|
||||||
|
if (scb != null)
|
||||||
|
for (int i = 0; i < scb.length; i++)
|
||||||
|
text.append (String.format ("%3d %02X%n", i, scb[i]));
|
||||||
|
|
||||||
|
for (ColorTable colorTable : colorTables)
|
||||||
|
{
|
||||||
|
text.append (colorTable);
|
||||||
|
text.append ("\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
text.deleteCharAt (text.length () - 1);
|
||||||
|
text.deleteCharAt (text.length () - 1);
|
||||||
|
|
||||||
|
return text.toString ();
|
||||||
|
}
|
||||||
}
|
}
|
@ -17,8 +17,7 @@ public class NextPaletteAction extends AbstractAction
|
|||||||
{
|
{
|
||||||
super ("Next Palette");
|
super ("Next Palette");
|
||||||
putValue (Action.SHORT_DESCRIPTION, "Select next color palette");
|
putValue (Action.SHORT_DESCRIPTION, "Select next color palette");
|
||||||
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("alt N"));
|
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("meta alt N"));
|
||||||
// putValue (Action.MNEMONIC_KEY, KeyEvent.VK_N);
|
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.buttonGroup = buttonGroup;
|
this.buttonGroup = buttonGroup;
|
||||||
}
|
}
|
||||||
@ -27,7 +26,6 @@ public class NextPaletteAction extends AbstractAction
|
|||||||
public void actionPerformed (ActionEvent e)
|
public void actionPerformed (ActionEvent e)
|
||||||
{
|
{
|
||||||
Palette palette = owner.cyclePalette (CycleDirection.FORWARDS);
|
Palette palette = owner.cyclePalette (CycleDirection.FORWARDS);
|
||||||
// owner.selectPalette (palette);
|
|
||||||
|
|
||||||
if (palette != null)
|
if (palette != null)
|
||||||
{
|
{
|
||||||
|
@ -17,8 +17,7 @@ public class PreviousPaletteAction extends AbstractAction
|
|||||||
{
|
{
|
||||||
super ("Previous Palette");
|
super ("Previous Palette");
|
||||||
putValue (Action.SHORT_DESCRIPTION, "Select previous color palette");
|
putValue (Action.SHORT_DESCRIPTION, "Select previous color palette");
|
||||||
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("alt P"));
|
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("meta alt P"));
|
||||||
// putValue (Action.MNEMONIC_KEY, KeyEvent.VK_P);
|
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.buttonGroup = buttonGroup;
|
this.buttonGroup = buttonGroup;
|
||||||
}
|
}
|
||||||
@ -27,7 +26,6 @@ public class PreviousPaletteAction extends AbstractAction
|
|||||||
public void actionPerformed (ActionEvent e)
|
public void actionPerformed (ActionEvent e)
|
||||||
{
|
{
|
||||||
Palette palette = owner.cyclePalette (CycleDirection.BACKWARDS);
|
Palette palette = owner.cyclePalette (CycleDirection.BACKWARDS);
|
||||||
// owner.selectPalette (palette);
|
|
||||||
|
|
||||||
if (palette != null)
|
if (palette != null)
|
||||||
{
|
{
|
||||||
|
@ -352,7 +352,9 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
|||||||
file = new IconFile (name, exactBuffer);
|
file = new IconFile (name, exactBuffer);
|
||||||
break;
|
break;
|
||||||
case FILE_TYPE_PNT:
|
case FILE_TYPE_PNT:
|
||||||
if (auxType == 1)
|
if (auxType == 0)
|
||||||
|
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||||
|
else if (auxType == 1)
|
||||||
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||||
else if (auxType == 2)
|
else if (auxType == 2)
|
||||||
file = new SHRPictureFile (name, exactBuffer, fileType, auxType, endOfFile);
|
file = new SHRPictureFile (name, exactBuffer, fileType, auxType, endOfFile);
|
||||||
@ -361,13 +363,13 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
|||||||
new OriginalHiResImage (name, exactBuffer, fileType, auxType, endOfFile);
|
new OriginalHiResImage (name, exactBuffer, fileType, auxType, endOfFile);
|
||||||
break;
|
break;
|
||||||
case FILE_TYPE_PIC:
|
case FILE_TYPE_PIC:
|
||||||
if (auxType == 1)
|
// if (auxType == 1)
|
||||||
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||||
else if (auxType == 2)
|
// else if (auxType == 2)
|
||||||
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
// file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||||
else
|
// else
|
||||||
file =
|
// file =
|
||||||
new OriginalHiResImage (name, exactBuffer, fileType, auxType, endOfFile);
|
// new OriginalHiResImage (name, exactBuffer, fileType, auxType, endOfFile);
|
||||||
break;
|
break;
|
||||||
case FILE_TYPE_FONT:
|
case FILE_TYPE_FONT:
|
||||||
file = new QuickDrawFont (name, exactBuffer, fileType, auxType);
|
file = new QuickDrawFont (name, exactBuffer, fileType, auxType);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user