本文整理汇总了C#中ByteMatrix.get方法的典型用法代码示例。如果您正苦于以下问题:C# ByteMatrix.get方法的具体用法?C# ByteMatrix.get怎么用?C# ByteMatrix.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ByteMatrix
的用法示例。
在下文中一共展示了ByteMatrix.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: maybeEmbedPositionAdjustmentPatterns
// Embed position adjustment patterns if need be.
private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix)
{
if (version.VersionNumber < 2) // The patterns appear if version >= 2
{
return;
}
int index = version.VersionNumber - 1;
int[] coordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
int numCoordinates = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index].Length;
for (int i = 0; i < numCoordinates; ++i)
{
for (int j = 0; j < numCoordinates; ++j)
{
int y = coordinates[i];
int x = coordinates[j];
if (x == -1 || y == -1)
{
continue;
}
// If the cell is unset, we embed the position adjustment pattern here.
if (isEmpty(matrix.get(x, y)))
{
// -2 is necessary since the x/y coordinates point to the center of the pattern, not the
// left top corner.
embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
}
}
}
}
示例2: embedVerticalSeparationPattern
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static void embedVerticalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws com.google.zxing.WriterException
private static void embedVerticalSeparationPattern(int xStart, int yStart, ByteMatrix matrix)
{
for (int y = 0; y < 7; ++y)
{
if (!isEmpty(matrix.get(xStart, yStart + y)))
{
throw new WriterException();
}
matrix.set(xStart, yStart + y, 0);
}
}
示例3: embedTimingPatterns
private static void embedTimingPatterns(ByteMatrix matrix)
{
// -8 is for skipping position detection patterns (size 7), and two horizontal/vertical
// separation patterns (size 1). Thus, 8 = 7 + 1.
for (int i = 8; i < matrix.Width - 8; ++i)
{
int bit = (i + 1) % 2;
// Horizontal line.
if (isEmpty(matrix.get(i, 6)))
{
matrix.set(i, 6, bit);
}
// Vertical line.
if (isEmpty(matrix.get(6, i)))
{
matrix.set(6, i, bit);
}
}
}
示例4: embedHorizontalSeparationPattern
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static void embedHorizontalSeparationPattern(int xStart, int yStart, ByteMatrix matrix) throws com.google.zxing.WriterException
private static void embedHorizontalSeparationPattern(int xStart, int yStart, ByteMatrix matrix)
{
for (int x = 0; x < 8; ++x)
{
if (!isEmpty(matrix.get(xStart + x, yStart)))
{
throw new WriterException();
}
matrix.set(xStart + x, yStart, 0);
}
}
示例5: embedDarkDotAtLeftBottomCorner
// Embed the lonely dark dot at left bottom corner. JISX0510:2004 (p.46)
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static void embedDarkDotAtLeftBottomCorner(ByteMatrix matrix) throws com.google.zxing.WriterException
private static void embedDarkDotAtLeftBottomCorner(ByteMatrix matrix)
{
if (matrix.get(8, matrix.Height - 8) == 0)
{
throw new WriterException();
}
matrix.set(8, matrix.Height - 8, 1);
}
示例6: embedDataBits
// Embed "dataBits" using "getMaskPattern". On success, modify the matrix and return true.
// For debugging purposes, it skips masking process if "getMaskPattern" is -1.
// See 8.7 of JISX0510:2004 (p.38) for how to embed data bits.
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: static void embedDataBits(com.google.zxing.common.BitArray dataBits, int maskPattern, ByteMatrix matrix) throws com.google.zxing.WriterException
internal static void embedDataBits(BitArray dataBits, int maskPattern, ByteMatrix matrix)
{
int bitIndex = 0;
int direction = -1;
// Start from the right bottom cell.
int x = matrix.Width - 1;
int y = matrix.Height - 1;
while (x > 0)
{
// Skip the vertical timing pattern.
if (x == 6)
{
x -= 1;
}
while (y >= 0 && y < matrix.Height)
{
for (int i = 0; i < 2; ++i)
{
int xx = x - i;
// Skip the cell if it's not empty.
if (!isEmpty(matrix.get(xx, y)))
{
continue;
}
bool bit;
if (bitIndex < dataBits.Size)
{
bit = dataBits.get(bitIndex);
++bitIndex;
}
else
{
// Padding bit. If there is no bit left, we'll fill the left cells with 0, as described
// in 8.4.9 of JISX0510:2004 (p. 24).
bit = false;
}
// Skip masking if mask_pattern is -1.
if (maskPattern != -1 && MaskUtil.getDataMaskBit(maskPattern, xx, y))
{
bit = !bit;
}
matrix.set(xx, y, bit);
}
y += direction;
}
direction = -direction; // Reverse the direction.
y += direction;
x -= 2; // Move to the left.
}
// All bits should be consumed.
if (bitIndex != dataBits.Size)
{
throw new WriterException("Not all bits consumed: " + bitIndex + '/' + dataBits.Size);
}
}