0% found this document useful (0 votes)
13 views2 pages

QR Code Scanner

Uploaded by

umar fayyaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

QR Code Scanner

Uploaded by

umar fayyaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

private void Camera_NewFrame(object sender, NewFrameEventArgs eventArgs)

{
try
{
using (Bitmap bitmap = (Bitmap)[Link]())
{
// Skip null or zero-sized frames
if (bitmap == null || [Link] == 0 || [Link] == 0)
return;

using (Bitmap bitmapForDecode = new Bitmap([Link], [Link],


PixelFormat.Format24bppRgb))
{
using (Graphics g = [Link](bitmapForDecode))
{
[Link](bitmap, new Rectangle(0, 0, [Link],
[Link]));
}

var reader = new [Link]


{
AutoRotate = true,
TryInverted = true,
Options = new [Link]
{
TryHarder = true,
PossibleFormats = new List<[Link]>
{
[Link].QR_CODE
}
}
};

Result result = null;


try
{
result = [Link](bitmapForDecode);
}
catch (NullReferenceException nre)
{
[Link]("ZXing NullReferenceException: " +
[Link]);
}
catch (Exception decodeEx)
{
[Link]("Decode failed: " + [Link]);
}

if (result != null)
{
[Link]();

Invoke(new MethodInvoker(() =>


{
webView.EnsureCoreWebView2Async();
[Link] = new Uri([Link]);
[Link] = true;
}));
}
}

[Link]?.Dispose();
[Link] = (Bitmap)[Link]();
}
}
catch (Exception ex)
{
[Link]("Camera frame processing error: " + [Link]);
}
}

You might also like