當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。