// Embed position detection patterns and surrounding vertical/horizontal separators.
private static void EmbedPositionDetectionPatternsAndSeparators(ByteMatrix matrix)
{
// Embed three big squares at corners.
int pdpWidth = POSITION_DETECTION_PATTERN[0].Length;
// Left top corner.
EmbedPositionDetectionPattern(0, 0, matrix);
// Right top corner.
EmbedPositionDetectionPattern(matrix.GetWidth() - pdpWidth, 0, matrix);
// Left bottom corner.
EmbedPositionDetectionPattern(0, matrix.GetWidth() - pdpWidth, matrix);
// Embed horizontal separation patterns around the squares.
int hspWidth = HORIZONTAL_SEPARATION_PATTERN[0].Length;
// Left top corner.
EmbedHorizontalSeparationPattern(0, hspWidth - 1, matrix);
// Right top corner.
EmbedHorizontalSeparationPattern(matrix.GetWidth() - hspWidth,
hspWidth - 1, matrix);
// Left bottom corner.
EmbedHorizontalSeparationPattern(0, matrix.GetWidth() - hspWidth, matrix);
// Embed vertical separation patterns around the squares.
int vspSize = VERTICAL_SEPARATION_PATTERN.Length;
// Left top corner.
EmbedVerticalSeparationPattern(vspSize, 0, matrix);
// Right top corner.
EmbedVerticalSeparationPattern(matrix.GetHeight() - vspSize - 1, 0, matrix);
// Left bottom corner.
EmbedVerticalSeparationPattern(vspSize, matrix.GetHeight() - vspSize,
matrix);
}