当前位置: 首页>>代码示例>>C#>>正文


C# ByteMatrix.get方法代码示例

本文整理汇总了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);
     }
       }
     }
 }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:30,代码来源:MatrixUtil.cs

示例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);
     }
 }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:13,代码来源:MatrixUtil.cs

示例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);
       }
     }
 }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:19,代码来源:MatrixUtil.cs

示例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);
     }
 }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:13,代码来源:MatrixUtil.cs

示例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);
 }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:11,代码来源:MatrixUtil.cs

示例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);
            }
        }
开发者ID:Th3Ya0vi,项目名称:GameHouseUniverse,代码行数:61,代码来源:MatrixUtil.cs


注:本文中的ByteMatrix.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。