public void Clear() { for (int y = 0; y < height; y++) { ArraysEmulation.Arraycopy(emptyRow, 0, iArray[y], 0, width); } ArraysEmulation.Arraycopy(emptyCol, 0, pixels, 0, height); ArraysEmulation.Arraycopy(emptyCol, 0, rowIslands, 0, height); }
public byte[] PackLayerImage() { int ptr = 0; for (int y = 0; y < height; y++) { if (pixels[y] == 0) { ptr = Add(ptr, OFF, width); } else { byte current = OFF; int length = 0; for (int x = 0; x < width; x++) { byte next = iArray[y][x]; if (next != current) { if (length > 0) { ptr = Add(ptr, current, length); } current = next; length = 1; } else { length++; } } if (length > 0) { ptr = Add(ptr, current, length); } } } byte[] img = new byte[ptr]; ArraysEmulation.Arraycopy(scratchPad, 0, img, 0, ptr); return(img); }