This commit is contained in:
Denis Molony 2016-02-21 17:05:37 +11:00
parent d0ab7b9a45
commit c426cbfb25

View File

@ -145,38 +145,37 @@ public class HiResImage extends AbstractFile
} }
// convert ALL consecutive ON pixels to white // convert ALL consecutive ON pixels to white
for (int x = 0; x < line.length - 1; x++) if (true)
if (line[x] != BLACK && line[x + 1] != BLACK) for (int x = 0; x < line.length - 1; x++)
line[x] = line[x + 1] = WHITE; if (line[x] != BLACK && line[x + 1] != BLACK)
// if (isColoured (line[x]) && isColoured (line[x + 1]))
line[x] = line[x + 1] = WHITE;
// convert WOZ quirks // convert WOZ quirks
if (colourQuirks) if (colourQuirks)
{ {
for (int x = 0; x < line.length - 4; x++) for (int x = 0; x < line.length - 3; x++)
{ {
if (line[x + 1] == BLACK) int px0 = line[x];
{ int px1 = line[x + 1];
// V-B-V-B -> V-V-V-B int px2 = line[x + 2];
if (line[x + 3] == BLACK && line[x] == line[x + 2] && line[x] != BLACK int px3 = line[x + 3];
&& line[x] != WHITE)
line[x + 1] = line[x];
// V-B-W-W -> V-V-W-W if (px1 == BLACK)
if (line[x] != BLACK && line[x] != WHITE && line[x + 3] == WHITE {
&& line[x + 2] == WHITE) if (px3 == BLACK && px0 == px2 && isColoured (px0)) // V-B-V-B
line[x + 1] = line[x]; line[x + 1] = px0; // --> V-V-V-B
else if (px3 == WHITE && px2 == WHITE && isColoured (px0)) // V-B-W-W
line[x + 1] = px0; // --> V-V-W-W
} }
if (line[x + 2] == BLACK) else if (px2 == BLACK)
{ {
// B-G-B-G -> B-G-G-G if (px0 == BLACK && px1 == px3 && isColoured (px3)) // B-G-B-G
if (line[x] == BLACK && line[x + 1] == line[x + 3] && line[x + 1] != WHITE line[x + 2] = px3; // --> B-G-G-G
&& line[x + 1] != BLACK)
line[x + 2] = line[x + 1];
// W-W-B-G -> W-W-G-G else if (px0 == WHITE && px1 == WHITE && isColoured (px3)) // W-W-B-G
if (line[x] == WHITE && line[x + 1] == WHITE && line[x + 3] != BLACK line[x + 2] = px3; // --> W-W-G-G
&& line[x + 3] != WHITE)
line[x + 2] = line[x + 3];
} }
} }
} }
@ -187,6 +186,11 @@ public class HiResImage extends AbstractFile
return element; return element;
} }
private boolean isColoured (int pixel)
{
return pixel != BLACK && pixel != WHITE;
}
private void makeScreen2 (byte[] buffer) private void makeScreen2 (byte[] buffer)
{ {
// System.out.println (HexFormatter.format (buffer, 32000, 640)); // System.out.println (HexFormatter.format (buffer, 32000, 640));