本文整理汇总了C#中com.google.zxing.common.BitArray.getNextSet方法的典型用法代码示例。如果您正苦于以下问题:C# com.google.zxing.common.BitArray.getNextSet方法的具体用法?C# com.google.zxing.common.BitArray.getNextSet怎么用?C# com.google.zxing.common.BitArray.getNextSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.common.BitArray
的用法示例。
在下文中一共展示了com.google.zxing.common.BitArray.getNextSet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: findStartPattern
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static int[] findStartPattern(com.google.zxing.common.BitArray row) throws com.google.zxing.NotFoundException
private static int[] findStartPattern(BitArray row)
{
int width = row.Size;
int rowOffset = row.getNextSet(0);
int counterPosition = 0;
int[] counters = new int[6];
int patternStart = rowOffset;
bool isWhite = false;
int patternLength = counters.Length;
for (int i = rowOffset; i < width; i++)
{
if (row.get(i) ^ isWhite)
{
counters[counterPosition]++;
}
else
{
if (counterPosition == patternLength - 1)
{
int bestVariance = MAX_AVG_VARIANCE;
int bestMatch = -1;
for (int startCode = CODE_START_A; startCode <= CODE_START_C; startCode++)
{
int variance = patternMatchVariance(counters, CODE_PATTERNS[startCode], MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance)
{
bestVariance = variance;
bestMatch = startCode;
}
}
// Look for whitespace before start pattern, >= 50% of width of start pattern
if (bestMatch >= 0 && row.isRange(Math.Max(0, patternStart - (i - patternStart) / 2), patternStart, false))
{
return new int[]{patternStart, i, bestMatch};
}
patternStart += counters[0] + counters[1];
Array.Copy(counters, 2, counters, 0, patternLength - 2);
counters[patternLength - 2] = 0;
counters[patternLength - 1] = 0;
counterPosition--;
}
else
{
counterPosition++;
}
counters[counterPosition] = 1;
isWhite = !isWhite;
}
}
throw NotFoundException.NotFoundInstance;
}
示例2: skipWhiteSpace
/// <summary>
/// Skip all whitespace until we get to the first black line.
/// </summary>
/// <param name="row"> row of black/white values to search </param>
/// <returns> index of the first black line. </returns>
/// <exception cref="NotFoundException"> Throws exception if no black lines are found in the row </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static int skipWhiteSpace(com.google.zxing.common.BitArray row) throws com.google.zxing.NotFoundException
private static int skipWhiteSpace(BitArray row)
{
int width = row.Size;
int endStart = row.getNextSet(0);
if (endStart == width)
{
throw NotFoundException.NotFoundInstance;
}
return endStart;
}