UWP 프로젝트에서 ZXing을 사용하려고하는데 많은 튜토리얼을 읽었습니다. 마지막 자습서에서는 WritableBitmap을 사용해야한다고 말했습니다. 'cos 비트 맵은 UWP에서 사용할 수 없습니다.바코드 디코딩을 위해 'WriteableBitmap'을 UWP의 'LuminanceSource'로 변환 할 수 없습니다.
그러나이
유형을 변환 할 수 없습니다
나에게 말한다 'Windows.UI.Xaml.Media.Imaging.WriteableBitmap' 에 'ZXing.LuminanceSource'
public class QrCodeHelpers
{
public static void ReadQrCodeFromBitmap(WriteableBitmap image)
{
IBarcodeReader reader = new BarcodeReader();
var generic = new BarcodeReaderGeneric<WriteableBitmap>();
// detect and decode the barcode inside the bitmap
var result = reader.Decode((ZXing.LuminanceSource)image);
// do something with the result
}
}
어떻게 할 수 이 일하게? MediaCapture의 이미지가 있으며이를 사용하여 QR 코드의 데이터를 얻을 수 있습니다. 어떤 해결책?
당신은 그런 식으로 캐스팅 할 수 없습니다. – ChrisF
네, 작동하지 않을 거란 건 알지만 그건 내 문제입니다. 이것은 받아 들인 대답입니다 : http://stackoverflow.com/questions/20650509/barcode-scanner-for-metro-apps 그것은 동일한 것을 사용합니다 ... – tixovoxi
@tixovoxi, 링크 된 질문에 codeplex 예제 링크가 있습니다. 미디어 요소. 이 예제의 어떤 것도 LuminanceSource와 아무런 관련이 없습니다. – Nkosi