This commit is contained in:
Denis Molony 2018-07-30 18:44:29 +10:00
parent f25e591d1a
commit 7366aa19c7
6 changed files with 76 additions and 72 deletions

View File

@ -103,9 +103,9 @@ public abstract class HiResImage extends AbstractFile
createColourImage (); createColourImage ();
} }
protected abstract void createMonochromeImage (); abstract void createMonochromeImage ();
protected abstract void createColourImage (); abstract void createColourImage ();
public void checkPalette () public void checkPalette ()
{ {
@ -185,30 +185,44 @@ public abstract class HiResImage extends AbstractFile
break; break;
case ProdosConstants.FILE_TYPE_PNT: // 0xC0 case ProdosConstants.FILE_TYPE_PNT: // 0xC0
if (auxType == 0) // see Asimov disks/images/gs/programming/fta_code/GIFT5.SDK switch (auxType)
{
case 0:
auxText = "Paintworks Packed SHR Image"; auxText = "Paintworks Packed SHR Image";
else if (auxType == 1) break;
case 1:
auxText = "Packed Super Hi-Res Image"; auxText = "Packed Super Hi-Res Image";
else if (auxType == 2) break;
case 2:
auxText = "Super Hi-Res Image (Apple Preferred)"; auxText = "Super Hi-Res Image (Apple Preferred)";
else if (auxType == 3) break;
case 3:
auxText = "Packed QuickDraw II PICT File"; auxText = "Packed QuickDraw II PICT File";
else if (auxType == 4) break;
case 4:
auxText = "Packed Super Hi-Res 3200 color image"; auxText = "Packed Super Hi-Res 3200 color image";
else break;
default:
auxText = "Unknown aux: " + auxType; auxText = "Unknown aux: " + auxType;
}
break; break;
case ProdosConstants.FILE_TYPE_PIC: // 0xC1 case ProdosConstants.FILE_TYPE_PIC: // 0xC1
if (auxType == 0) switch (auxType)
{
case 0:
auxText = "Super Hi-res Screen Image"; auxText = "Super Hi-res Screen Image";
else if (auxType == 1) break;
case 1:
auxText = "QuickDraw PICT File"; auxText = "QuickDraw PICT File";
else if (auxType == 2) break;
case 2:
auxText = "Super Hi-Res 3200 color image"; auxText = "Super Hi-Res 3200 color image";
else break;
default:
auxText = "Unknown aux: " + auxType; auxText = "Unknown aux: " + auxType;
} }
}
if (!auxText.isEmpty ()) if (!auxText.isEmpty ())
text.append (String.format ("%nAux type : $%04X %s", auxType, auxText)); text.append (String.format ("%nAux type : $%04X %s", auxType, auxText));
@ -256,6 +270,7 @@ public abstract class HiResImage extends AbstractFile
return new byte[0]; return new byte[0];
} }
// this should call unpackLine()
private void unpack (byte[] buffer, byte[] newBuf) throws ArrayIndexOutOfBoundsException 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
@ -461,10 +476,8 @@ public abstract class HiResImage extends AbstractFile
// default empty table // default empty table
id = -1; id = -1;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{
entries[i] = new ColorEntry (); entries[i] = new ColorEntry ();
} }
}
public ColorTable (int id, byte[] data, int offset) public ColorTable (int id, byte[] data, int offset)
{ {

View File

@ -62,6 +62,7 @@ public class SHRPictureFile1 extends HiResImage
break; break;
// case "SuperConvert": // case "SuperConvert":
// case "NOTE":
// case "EOA ": // DeluxePaint // case "EOA ": // DeluxePaint
// case "Platinum Paint": // case "Platinum Paint":
// blocks.add (new Block (kind, data)); // blocks.add (new Block (kind, data));
@ -79,7 +80,7 @@ public class SHRPictureFile1 extends HiResImage
} }
@Override @Override
protected void createMonochromeImage () void createMonochromeImage ()
{ {
image = new BufferedImage (320, 200, BufferedImage.TYPE_BYTE_GRAY); image = new BufferedImage (320, 200, BufferedImage.TYPE_BYTE_GRAY);
DataBuffer db = image.getRaster ().getDataBuffer (); DataBuffer db = image.getRaster ().getDataBuffer ();
@ -101,18 +102,25 @@ public class SHRPictureFile1 extends HiResImage
} }
@Override @Override
protected void createColourImage () void createColourImage ()
{ {
image = new BufferedImage (320, mainBlock.numScanLines, BufferedImage.TYPE_INT_RGB); image = new BufferedImage (mainBlock.pixelsPerScanLine, mainBlock.numScanLines,
BufferedImage.TYPE_INT_RGB);
DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
if (mainBlock.pixelsPerScanLine != 320)
System.out.println ("Pixels per scanline: " + mainBlock.pixelsPerScanLine);
int element = 0; int element = 0;
int ptr = 0; int ptr = 0;
for (int row = 0; row < mainBlock.numScanLines; row++) for (int row = 0; row < mainBlock.numScanLines; row++)
{ {
DirEntry dirEntry = mainBlock.scanLineDirectory[row]; DirEntry dirEntry = mainBlock.scanLineDirectory[row];
// int hi = dirEntry.mode & 0xFF00; int hi = dirEntry.mode & 0xFF00; // always 0
int lo = dirEntry.mode & 0x00FF; int lo = dirEntry.mode & 0x00FF; // mode bit if hi == 0
if (hi != 0)
System.out.println ("hi not zero");
ColorTable colorTable = multipalBlock != null ? multipalBlock.colorTables[row] ColorTable colorTable = multipalBlock != null ? multipalBlock.colorTables[row]
: mainBlock.colorTables[lo & 0x0F]; : mainBlock.colorTables[lo & 0x0F];
@ -121,6 +129,7 @@ public class SHRPictureFile1 extends HiResImage
if (fillMode) if (fillMode)
System.out.println ("fillmode " + fillMode); System.out.println ("fillmode " + fillMode);
// 320 mode
for (int col = 0; col < 160; col++) for (int col = 0; col < 160; col++)
{ {
int left = (unpackedBuffer[ptr] & 0xF0) >> 4; int left = (unpackedBuffer[ptr] & 0xF0) >> 4;
@ -206,10 +215,10 @@ public class SHRPictureFile1 extends HiResImage
{ {
int masterMode; // 0 = Brooks, 0 = PNT 320 80 = PNT 640 int masterMode; // 0 = Brooks, 0 = PNT 320 80 = PNT 640
int pixelsPerScanLine; // 320 or 640 int pixelsPerScanLine; // 320 or 640
int numColorTables; // 1 = Brooks, 16 = Other int numColorTables; // 1 = Brooks, 16 = Other (may be zero)
ColorTable[] colorTables; ColorTable[] colorTables; // [numColorTables]
int numScanLines; int numScanLines; // >0
DirEntry[] scanLineDirectory; DirEntry[] scanLineDirectory; // [numScanLines]
byte[][] packedScanLines; byte[][] packedScanLines;
public Main (String kind, byte[] data) public Main (String kind, byte[] data)

View File

@ -9,7 +9,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class SHRPictureFile2 extends HiResImage public class SHRPictureFile2 extends HiResImage
{ {
ColorTable[] colorTables; ColorTable[] colorTables;
byte[] scb; byte[] controlBytes;
// see Graphics & Animation.2mg // see Graphics & Animation.2mg
@ -40,8 +40,8 @@ public class SHRPictureFile2 extends HiResImage
case 1: // packed version of PIC/$00 case 1: // packed version of PIC/$00
this.buffer = unpackBytes (buffer); this.buffer = unpackBytes (buffer);
scb = new byte[200]; controlBytes = new byte[200];
System.arraycopy (this.buffer, 32000, scb, 0, scb.length); System.arraycopy (this.buffer, 32000, controlBytes, 0, controlBytes.length);
colorTables = new ColorTable[16]; colorTables = new ColorTable[16];
for (int i = 0; i < colorTables.length; i++) for (int i = 0; i < colorTables.length; i++)
@ -83,8 +83,8 @@ public class SHRPictureFile2 extends HiResImage
switch (auxType) switch (auxType)
{ {
case 0: // unpacked version of PNT/$01 case 0: // unpacked version of PNT/$01
scb = new byte[200]; controlBytes = new byte[200];
System.arraycopy (buffer, 32000, scb, 0, scb.length); System.arraycopy (buffer, 32000, controlBytes, 0, controlBytes.length);
colorTables = new ColorTable[16]; colorTables = new ColorTable[16];
for (int i = 0; i < colorTables.length; i++) for (int i = 0; i < colorTables.length; i++)
@ -117,12 +117,12 @@ public class SHRPictureFile2 extends HiResImage
} }
@Override @Override
protected void createMonochromeImage () void createMonochromeImage ()
{ {
} }
@Override @Override
protected void createColourImage () void createColourImage ()
{ {
image = new BufferedImage (320, 200, BufferedImage.TYPE_INT_RGB); image = new BufferedImage (320, 200, BufferedImage.TYPE_INT_RGB);
DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
@ -132,7 +132,7 @@ public class SHRPictureFile2 extends HiResImage
for (int row = 0; row < 200; row++) for (int row = 0; row < 200; row++)
{ {
ColorTable colorTable = ColorTable colorTable =
scb != null ? colorTables[scb[row] & 0x0F] : colorTables[row]; controlBytes != null ? colorTables[controlBytes[row] & 0x0F] : colorTables[row];
for (int col = 0; col < 160; col++) for (int col = 0; col < 160; col++)
{ {
@ -153,13 +153,13 @@ public class SHRPictureFile2 extends HiResImage
StringBuilder text = new StringBuilder (super.getText ()); StringBuilder text = new StringBuilder (super.getText ());
text.append ("\n\n"); text.append ("\n\n");
if (scb != null) if (controlBytes != null)
{ {
text.append ("SCB\n---\n"); text.append ("SCB\n---\n");
for (int i = 0; i < scb.length; i += 8) for (int i = 0; i < controlBytes.length; i += 8)
{ {
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
text.append (String.format (" %3d: %02X ", i + j, scb[i + j])); text.append (String.format (" %3d: %02X ", i + j, controlBytes[i + j]));
text.append ("\n"); text.append ("\n");
} }
text.append ("\n"); text.append ("\n");

View File

@ -45,7 +45,7 @@ public class MenuHandler
final JMenuItem printItem = new JMenuItem ("Print output panel..."); final JMenuItem printItem = new JMenuItem ("Print output panel...");
final JMenuItem closeTabItem = new JMenuItem (); final JMenuItem closeTabItem = new JMenuItem ();
final JMenuItem duplicateItem = new JMenuItem (); final JMenuItem duplicateItem = new JMenuItem ();
final FontAction fontAction; final FontAction fontAction = new FontAction ();
// Format menu items // Format menu items
final JMenuItem lineWrapItem = new JCheckBoxMenuItem ("Line wrap"); final JMenuItem lineWrapItem = new JCheckBoxMenuItem ("Line wrap");
@ -85,13 +85,12 @@ public class MenuHandler
fileMenu.addSeparator (); fileMenu.addSeparator ();
fileMenu.add (closeTabItem); fileMenu.add (closeTabItem);
fontAction = new FontAction ();
JMenuItem fontItem = new JMenuItem (fontAction); JMenuItem fontItem = new JMenuItem (fontAction);
fileMenu.add (fontItem); fileMenu.add (fontItem);
fontAction.setSampleText ("120 FOR Z = 14 TO 24:\n" + " VTAB 5:\n" + " HTAB Z:\n" fontAction.setSampleText ("120 FOR Z = 14 TO 24:\n VTAB 5:\n HTAB Z:\n"
+ " PRINT AB$:\n" + " FOR TI = 1 TO 50:\n" + " NEXT :\n" + " POKE 0,Z + 40:\n" + " PRINT AB$:\n FOR TI = 1 TO 50:\n NEXT :\n POKE 0,Z + 40:\n"
+ " POKE 1,9:\n" + " CALL MU:\n" + " VTAB 5:\n" + " HTAB Z:\n" + " POKE 1,9:\n CALL MU:\n VTAB 5:\n HTAB Z:\n"
+ " PRINT SPC(12):\n" + "NEXT :\n" + "VTAB 5:\n" + "HTAB 24:\n" + "PRINT AB$\n"); + " PRINT SPC(12):\nNEXT :\nVTAB 5:\nHTAB 24:\nPRINT AB$\n");
fileMenu.add (duplicateItem); fileMenu.add (duplicateItem);
fileMenu.add (debuggingItem); fileMenu.add (debuggingItem);
@ -149,26 +148,7 @@ public class MenuHandler
void addHelpMenuAction (Action action, String functionName) void addHelpMenuAction (Action action, String functionName)
{ {
// if (Platform.MAC)
// {
// try
// {
// if (functionName.equals ("about"))
// OSXAdapter.setAboutHandler (action,
// action.getClass ().getDeclaredMethod (functionName, (Class[]) null));
// else if (functionName.equals ("prefs"))
// OSXAdapter.setPreferencesHandler (action,
// action.getClass ().getDeclaredMethod (functionName, (Class[]) null));
// }
// catch (Exception e)
// {
// e.printStackTrace ();
// }
// }
// else
// {
helpMenu.add (new JMenuItem (action)); helpMenu.add (new JMenuItem (action));
// }
} }
private void addLauncherMenu () private void addLauncherMenu ()

View File

@ -10,7 +10,8 @@ import javax.swing.KeyStroke;
import com.bytezone.common.DefaultAction; import com.bytezone.common.DefaultAction;
// not currently used // ********** not currently used ***********
public class PreferencesAction extends DefaultAction public class PreferencesAction extends DefaultAction
{ {
JFrame owner; JFrame owner;

View File

@ -43,6 +43,7 @@ class PreferencesDialog extends JDialog
super (owner, "Set Preferences", false); super (owner, "Set Preferences", false);
this.prefs = prefs; this.prefs = prefs;
System.out.println ("********* not used ***********");
catalogFontName = prefs.get (prefsCatalogFont, defaultFontName); catalogFontName = prefs.get (prefsCatalogFont, defaultFontName);
dataFontName = prefs.get (prefsDataFont, defaultFontName); dataFontName = prefs.get (prefsDataFont, defaultFontName);