public BitArray GetRow(int y, BitArray row) { if (row == null || row.GetSize() < width) { row = new BitArray(width); } int offset = y * rowSize; for (int x = 0; x < rowSize; x++) { row.SetBulk(x << 5, bits[offset + x]); } return row; }