原創(chuàng)|使用教程|編輯:郝浩|2013-09-06 09:18:38.000|閱讀 566 次
概述:LEADTOOLS v18(即LEADTOOLS Anywhere)將其世界領(lǐng)先的成像技術(shù)擴(kuò)展到了WinRT、iOS、Android、Windows Phone和Linux等平臺(tái)。本文主要展示LEADTOOLS Anywhere如何在每個(gè)平臺(tái)上面讀取條形碼。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
LEADTOOLS v18(即LEADTOOLS Anywhere)將其世界領(lǐng)先的成像技術(shù)擴(kuò)展到了WinRT、iOS、Android、Windows Phone和Linux等平臺(tái)。不僅如此,用戶還可以在所有流行平臺(tái)中實(shí)現(xiàn)查看、注釋和標(biāo)記、OCR、條形碼、PDF、圖像格式、壓縮和圖像處理等功能。
LEADTOOLS在每個(gè)開發(fā)平臺(tái)上面都提供了一組非常相似的開發(fā)庫,這是LEADTOOLS的一個(gè)非常明顯的優(yōu)勢,讓開發(fā)者既能夠開發(fā)原生的應(yīng)用程序,又不用花費(fèi)太多的時(shí)間進(jìn)行完全的代碼重寫。
接下來,我們就一起展示一下LEADTOOLS Anywhere如何在每個(gè)平臺(tái)上面讀取條形碼。
.NET
System.Drawing.Bitmap bitmap = ... // // Get a LEADTOOLS RasterImage from the platform image RasterImage rasterImage = RasterImageConverter.FromImage(bitmap); // Create a LEADTOOLS Barcode Engine instance private BarcodeEngine barcodeEngine = new BarcodeEngine(); // Read the first barcode found in the image BarcodeData barcodeData = barcodeEngine.Reader.ReadBarcode(rasterImage, LogicalRectangle.Empty, BarcodeSymbology.Unknown); // For this example, simply output the barcode type, location and data in the console if (barcodeData != null) { Console.WriteLine("Symbology:{0}", barcodeData.Symbology); Console.WriteLine("Location:{0},{1},{2},{3}", barcodeData.Bounds.X, barcodeData.Bounds.Y, barcodeData.Bounds.Width, barcodeData.Bounds.Height); Console.WriteLine("Value:{0}", barcodeData.Value); } else { Console.WriteLine("No barcodes found"); }
WinRT & Windows Phone
Windows.UI.Xaml.Media.ImageSource imageSource = ... // // Get a LEADTOOLS RasterImage from the platform image RasterImage rasterImage = RasterImageConverter.ConvertFromImageSource( imageSource, ConvertFromImageOptions.None); // Create a LEADTOOLS Barcode Engine instance private BarcodeEngine barcodeEngine = new BarcodeEngine(); // Read the first barcode found in the image BarcodeData barcodeData = barcodeEngine.Reader.ReadBarcode(rasterImage, LogicalRectangle.Empty, BarcodeSymbology.Unknown); // For this example, simply output the barcode type, location and data in the console if (barcodeData != null) { Console.WriteLine("Symbology:{0}", barcodeData.Symbology); Console.WriteLine("Location:{0},{1},{2},{3}", barcodeData.Bounds.X, barcodeData.Bounds.Y, barcodeData.Bounds.Width, barcodeData.Bounds.Height); Console.WriteLine("Value:{0}", barcodeData.Value); } else { Console.WriteLine("No barcodes found"); }
iOS & OS X
UIImage* uiImage = ... // // Get a LEADTOOLS RasterImage from the platform image LTRasterImage* rasterImage = [LTRasterImageConverter convertFromImage:uiImage options:LTConvertFromImageOptions_None error:nil]; // Create a LEADTOOLS Barcode Engine instance LTBarcodeEngine* barcodeEngine = [LTBarcodeEngine new]; // Read the first barcode found in the image LTBarcodeData* barcodeData = [barcodeEngine.reader readBarcode:rasterImage searchBounds:LeadRect_Empty() symbologies:nil symbologiesCount:0 error:nil]; // For this example, simply retrieve the barcode type, location and data if(barcodeData != nil) { NSLog(@"Symbology:%u", barcodeData.symbology); NSLog(@"Location:%u,%u,%u,%u", barcodeData.bounds.x, barcodeData.bounds.y, barcodeData.bounds.width, barcodeData.bounds.height); NSLog(@"Value:%@", barcodeData.value); } else { NSLog(@"No barcodes found"); }
Android
android.graphics.Bitmap bitmap = ... // // Get a LEADTOOLS RasterImage from the platform image RasterImage rasterImage = RasterImageConverter.convertFromBitmap( bitmap, ConvertFromImageOptions.NONE); // Create a LEADTOOLS Barcode Engine instance private BarcodeEngine barcodeEngine = new BarcodeEngine(); // Read the first barcode found in the image BarcodeData barcodeData = barcodeEngine.getReader().readBarcode( rasterImage, LeadRect.getEmpty(), BarcodeSymbology.UNKNOWN); // For this example, simply output the barcode type, location and data in the console if (barcodeData != null) { Log.i("LEADTOOLS.BarcodeDemo", String.format("Symbology:%s", barcodeData.getSymbology())); Log.i("LEADTOOLS.BarcodeDemo", String.format("Location:%1$s,%2$s,%3$s,%4$s", barcodeData.getBounds().getX(), barcodeData.getBounds().getY(), barcodeData.getBounds().getWidth(), barcodeData.getBounds().getHeight())); Log.i("LEADTOOLS.BarcodeDemo", String.format("Value:%s", barcodeData.getValue())); } else { Log.i("LEADTOOLS.BarcodeDemo", "No barcodes found"); }
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)