private void Draw(byte[] data, int dataSize, DmParams dm) {
int i, j, p, x, y, xs, ys, z;
int xByte = (dm.width + ws * 2 + 7) / 8;
for (int k = 0; k < image.Length; ++k)
image[k] = 0;
//alignment patterns
//dotted horizontal line
for (i = ws; i < dm.height + ws; i += dm.heightSection) {
for (j = ws; j < dm.width + ws; j += 2) {
SetBit(j, i, xByte);
}
}
//solid horizontal line
for (i = dm.heightSection - 1 + ws; i < dm.height + ws; i += dm.heightSection) {
for (j = ws; j < dm.width + ws; ++j) {
SetBit(j, i, xByte);
}
}
//solid vertical line
for (i = ws; i < dm.width + ws; i += dm.widthSection) {
for (j = ws; j < dm.height + ws; ++j) {
SetBit(i, j, xByte);
}
}
//dotted vertical line
for (i = dm.widthSection - 1 + ws; i < dm.width + ws; i += dm.widthSection) {
for (j = 1 + ws; j < dm.height + ws; j += 2) {
SetBit(i, j, xByte);
}
}
p = 0;
for (ys = 0; ys < dm.height; ys += dm.heightSection) {
for (y = 1; y < dm.heightSection - 1; ++y) {
for (xs = 0; xs < dm.width; xs += dm.widthSection) {
for (x = 1; x < dm.widthSection - 1; ++x) {
z = place[p++];
if (z == 1 || (z > 1 && ((data[z/8-1] & 0xff) & (128 >> (z%8))) != 0))
SetBit(x + xs + ws, y + ys + ws, xByte);
}
}
}
}
}