package a2geek.apple2.image.encoder.encode; import a2geek.apple2.image.encoder.A2Image; /** * Perform bit pack #1. *
* Image encoding:
* 0000 0000 $00 End of picture
* 0000 0001 $01 Color the line current color
* 0000 0010 $02 Next line (duplicate of $4n?)
* 0001 nnnn $1n Set color to n
* 01nn nnnn >$40 Goto line n
* 10nn nnnn >$80 Plot x1 coordinate
* 11nn nnnn >$C0 HLIN from x1 coordinate to x2 coordinate
*
* @author a2geek@users.noreply.github.com (sort of)
*/
public class BitPack1 extends A2Encoder {
public String getTitle() {
return "Bit Pack #1";
}
public void encode(A2Image a2image, int maxSize) {
if (a2image.getWidth() > 64 || a2image.getHeight() > 64) {
throw new NumberFormatException("Maximum X or Y coordinate supported is 64!");
}
int currentColor = 0;
int rowMoves = 0;
reset(maxSize);
for (int y=0; y