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


C# BinaryBitmap.rotateCounterClockwise方法代码示例

本文整理汇总了C#中BinaryBitmap.rotateCounterClockwise方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryBitmap.rotateCounterClockwise方法的具体用法?C# BinaryBitmap.rotateCounterClockwise怎么用?C# BinaryBitmap.rotateCounterClockwise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BinaryBitmap的用法示例。


在下文中一共展示了BinaryBitmap.rotateCounterClockwise方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: decode

 /// <summary>
 /// Locates and decodes a barcode in some format within an image. This method also accepts
 /// hints, each possibly associated to some data, which may help the implementation decode.
 /// Note that we don't try rotation without the try harder flag, even if rotation was supported.
 /// </summary>
 /// <param name="image">image of barcode to decode</param>
 /// <param name="hints">passed as a <see cref="IDictionary{TKey, TValue}"/> from <see cref="DecodeHintType"/>
 /// to arbitrary data. The
 /// meaning of the data depends upon the hint type. The implementation may or may not do
 /// anything with these hints.</param>
 /// <returns>
 /// String which the barcode encodes
 /// </returns>
 virtual public Result decode(BinaryBitmap image, IDictionary<DecodeHintType, object> hints)
 {
    var result = doDecode(image, hints);
    if (result == null)
    {
       bool tryHarder = hints != null && hints.ContainsKey(DecodeHintType.TRY_HARDER);
       bool tryHarderWithoutRotation = hints != null && hints.ContainsKey(DecodeHintType.TRY_HARDER_WITHOUT_ROTATION);
       if (tryHarder && !tryHarderWithoutRotation && image.RotateSupported)
       {
          BinaryBitmap rotatedImage = image.rotateCounterClockwise();
          result = doDecode(rotatedImage, hints);
          if (result == null)
             return null;
          // Record that we found it rotated 90 degrees CCW / 270 degrees CW
          IDictionary<ResultMetadataType, object> metadata = result.ResultMetadata;
          int orientation = 270;
          if (metadata != null && metadata.ContainsKey(ResultMetadataType.ORIENTATION))
          {
             // But if we found it reversed in doDecode(), add in that result here:
             orientation = (orientation +
                            (int) metadata[ResultMetadataType.ORIENTATION])%360;
          }
          result.putMetadata(ResultMetadataType.ORIENTATION, orientation);
          // Update result points
          ResultPoint[] points = result.ResultPoints;
          if (points != null)
          {
             int height = rotatedImage.Height;
             for (int i = 0; i < points.Length; i++)
             {
                points[i] = new ResultPoint(height - points[i].Y - 1, points[i].X);
             }
          }
       }
    }
    return result;
 }
开发者ID:arumata,项目名称:zxingnet,代码行数:50,代码来源:OneDReader(4).cs

示例2: decode

 // Note that we don't try rotation without the try harder flag, even if rotation was supported.
 public virtual Result decode(BinaryBitmap image, System.Collections.Generic.Dictionary <Object,Object> hints)
 {
     try
     {
         return doDecode(image, hints);
     }
     catch (ReaderException re)
     {
         bool tryHarder = hints != null && hints.ContainsKey(DecodeHintType.TRY_HARDER);
         if (tryHarder && image.RotateSupported)
         {
             BinaryBitmap rotatedImage = image.rotateCounterClockwise();
             Result result = doDecode(rotatedImage, hints);
             // Record that we found it rotated 90 degrees CCW / 270 degrees CW
             System.Collections.Generic.Dictionary <Object,Object> metadata = result.ResultMetadata;
             int orientation = 270;
             if (metadata != null && metadata.ContainsKey(ResultMetadataType.ORIENTATION))
             {
                 // But if we found it reversed in doDecode(), add in that result here:
                 orientation = (orientation + ((System.Int32) metadata[ResultMetadataType.ORIENTATION])) % 360;
             }
             result.putMetadata(ResultMetadataType.ORIENTATION, (System.Object) orientation);
             // Update result points
             ResultPoint[] points = result.ResultPoints;
             int height = rotatedImage.Height;
             for (int i = 0; i < points.Length; i++)
             {
                 points[i] = new ResultPoint(height - points[i].Y - 1, points[i].X);
             }
             return result;
         }
         else
         {
             throw re;
         }
     }
 }
开发者ID:hankhongyi,项目名称:zxing_for_wp8,代码行数:38,代码来源:OneDReader.cs


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