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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ public class MenuHandler
final JMenuItem printItem = new JMenuItem ("Print output panel...");
final JMenuItem closeTabItem = new JMenuItem ();
final JMenuItem duplicateItem = new JMenuItem ();
final FontAction fontAction;
final FontAction fontAction = new FontAction ();
// Format menu items
final JMenuItem lineWrapItem = new JCheckBoxMenuItem ("Line wrap");
@ -85,13 +85,12 @@ public class MenuHandler
fileMenu.addSeparator ();
fileMenu.add (closeTabItem);
fontAction = new FontAction ();
JMenuItem fontItem = new JMenuItem (fontAction);
fileMenu.add (fontItem);
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"
+ " 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");
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"
+ " POKE 1,9:\n CALL MU:\n VTAB 5:\n HTAB Z:\n"
+ " PRINT SPC(12):\nNEXT :\nVTAB 5:\nHTAB 24:\nPRINT AB$\n");
fileMenu.add (duplicateItem);
fileMenu.add (debuggingItem);
@ -149,26 +148,7 @@ public class MenuHandler
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));
// }
}
private void addLauncherMenu ()

View File

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

View File

@ -43,6 +43,7 @@ class PreferencesDialog extends JDialog
super (owner, "Set Preferences", false);
this.prefs = prefs;
System.out.println ("********* not used ***********");
catalogFontName = prefs.get (prefsCatalogFont, defaultFontName);
dataFontName = prefs.get (prefsDataFont, defaultFontName);
@ -82,8 +83,8 @@ class PreferencesDialog extends JDialog
layoutPanel.add (dataFontSizes);
SpringUtilities.makeCompactGrid (layoutPanel, 2, 3, //rows, cols
10, 5, //initX, initY
10, 5); //xPad, yPad
10, 5, //initX, initY
10, 5); //xPad, yPad
JPanel panel = new JPanel (new BorderLayout ());
panel.add (layoutPanel, BorderLayout.CENTER);