Beispiel #1
0
 internal virtual DecodeResult decode(QRCodeImage qrCodeImage, Point adjust)
 {
     try
     {
         if (numTryDecode == 0)
         {
             canvas.println("Decoding started");
             int[][] intImage = imageToIntArray(qrCodeImage);
             imageReader  = new QRCodeImageReader();
             qrCodeSymbol = imageReader.getQRCodeSymbol(intImage);
         }
         else
         {
             canvas.println("--");
             canvas.println("Decoding restarted #" + (numTryDecode));
             qrCodeSymbol = imageReader.getQRCodeSymbolWithAdjustedGrid(adjust);
         }
     }
     catch (SymbolNotFoundException e)
     {
         throw new DecodingFailedException(e.Message);
     }
     canvas.println("Created QRCode symbol.");
     canvas.println("Reading symbol.");
     canvas.println("Version: " + qrCodeSymbol.VersionReference);
     canvas.println("Mask pattern: " + qrCodeSymbol.MaskPatternRefererAsString);
     // blocks contains all (data and RS) blocks in QR Code symbol
     int[] blocks = qrCodeSymbol.Blocks;
     canvas.println("Correcting data errors.");
     // now blocks turn to data blocks (corrected and extracted from original blocks)
     blocks = correctDataBlocks(blocks);
     try
     {
         sbyte[] decodedByteArray = getDecodedByteArray(blocks, qrCodeSymbol.Version, qrCodeSymbol.NumErrorCollectionCode);
         return(new DecodeResult(this, decodedByteArray, numLastCorrections, correctionSucceeded));
     }
     catch (InvalidDataBlockException e)
     {
         canvas.println(e.Message);
         throw new DecodingFailedException(e.Message);
     }
 }
 private void InitBlock(QRCodeImageReader enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
 public ModulePitch(QRCodeImageReader enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }