2016-08-14 08:41:19 +00:00
|
|
|
package com.bytezone.diskbrowser.wizardry;
|
|
|
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
import java.awt.image.DataBuffer;
|
|
|
|
|
|
|
|
public class Wiz4Image extends AbstractImage
|
|
|
|
{
|
2016-09-19 05:18:10 +00:00
|
|
|
public Wiz4Image (String name, byte[] buffer, int rows, int cols) // 5, 6
|
2016-08-14 08:41:19 +00:00
|
|
|
{
|
|
|
|
super (name, buffer);
|
|
|
|
|
2016-08-22 03:41:43 +00:00
|
|
|
image = new BufferedImage (cols * 7, rows * 8, BufferedImage.TYPE_BYTE_GRAY);
|
2016-08-14 08:41:19 +00:00
|
|
|
DataBuffer db = image.getRaster ().getDataBuffer ();
|
|
|
|
int element = 0;
|
|
|
|
|
2016-08-22 03:41:43 +00:00
|
|
|
int rowSize = cols * 8;
|
|
|
|
for (int row = 0; row < rows; row++)
|
2016-08-14 08:41:19 +00:00
|
|
|
for (int line = 0; line < 8; line++)
|
2016-08-22 03:41:43 +00:00
|
|
|
for (int col = 0; col < cols; col++)
|
2016-08-14 08:41:19 +00:00
|
|
|
{
|
2016-09-19 05:18:10 +00:00
|
|
|
byte b = buffer[row * rowSize + col * 8 + line];
|
2016-08-22 03:41:43 +00:00
|
|
|
for (int bit = 0; bit < 7; bit++)
|
2016-08-14 08:41:19 +00:00
|
|
|
{
|
2016-08-22 03:41:43 +00:00
|
|
|
if ((b & 0x01) == 0x01)
|
|
|
|
db.setElem (element, 255);
|
|
|
|
b >>>= 1;
|
|
|
|
element++;
|
2016-08-14 08:41:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|