初始化所有分块的数据
///
<summary>
///
初始化所有分块的数据
///
</summary>
public
void
InitializeBlocks()
{
int
top
=
0
;
int
left
=
0
;
_blocks
=
new
List
<
Bitmap
>
(_blocksInColumn
*
_blocksInRow);
_isSupposedChanged
=
new
List
<
bool
>
(_blocks.Capacity);
_isScanned
=
new
List
<
bool
>
(_blocks.Capacity);
_blockWidth
=
(_oldBmp.Width
+
_blocksInRow
–
1
)
/
_blocksInRow;
_blockHeight
=
(_oldBmp.Height
+
_blocksInColumn
–
1
)
/
_blocksInColumn;
for
(
int
i
=
1
; i
<=
_blocks.Capacity; i
++
)
{
top
=
((i
+
_blocksInRow
–
1
)
/
_blocksInRow)
–
1
;
left
=
i
–
_blocksInRow
*
top
–
1
;
_blocks.Add(_oldBmp.Clone(
new
Rectangle(left
*
_blockWidth, top
*
_blockHeight, _blockWidth, _blockHeight), _oldBmp.PixelFormat));
if
(i
<=
_blocksInRow
||
_blocks.Capacity
–
i
–
1
<
_blocksInRow)
{
_isSupposedChanged.Add(
true
);
}
else
{
_isSupposedChanged.Add(
false
);
}
_isScanned.Add(
false
);
}
}