在Windows Phone生成QR码使用ZXing 2.0 C#7.1端口 [英] Generating QR code on Windows Phone 7.1 using ZXing 2.0 C# Port

查看:267
本文介绍了在Windows Phone生成QR码使用ZXing 2.0 C#7.1端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法生成芒果7.1 QR码与ZXing 2.0。
应该是相当直接的,但它不工作

I'm having trouble generating a QR code on mango 7.1 with ZXing 2.0. It should be pretty straight forward, but it's not working.

中的代码:

QRCodeWriter writer = new QRCodeWriter();
var bMatrix = writer.encode("Hey dude, QR FTW!", BarcodeFormat.QR_CODE, 25, 25);
var asBitmap = bMatrix.ToBitmap();            
image1.Source = asBitmap;



此搜索来自XAML。

image1 comes from the xaml.

bMatrix似乎包含了我所需要的数据,但此搜索从未显示出的事情。

bMatrix seems to contain the data that I need, but image1 never shows a thing.

推荐答案

所以我设法做一个解决方法。我不知道如果我的原代码,没有工作,由于斑马线C#端口的错误还是我做错了什么。总之,这里是我做过什么,以显示QR码。

So I managed to do a workaround. I'm not sure if my original code didnt work due to a bug in the ZXing C# port or if I did something wrong. Anyhow, here is what I did to show the QR code.

此搜索来自XAML。

QRCodeWriter writer = new QRCodeWriter();
var bMatrix = writer.encode("Hey dude! QR FTW!", BarcodeFormat.QR_CODE, width, height);

WriteableBitmap wbmi = new System.Windows.Media.Imaging.WriteableBitmap(width, height);

for (int y = 0; y < height; y++)
{
    for (int x = 0; x < width; x++)
    {
        int grayValue = bMatrix.Array[y][x] & 0xff;
        if (grayValue == 0)                        
            wbmi.SetPixel(x, y, Color.FromArgb(255, 0, 0,0));                                                    
         else
             wbmi.SetPixel(x, y, Color.FromArgb(255, 255, 255, 255));
     }
 }
 image1.Source = wbmi;

这篇关于在Windows Phone生成QR码使用ZXing 2.0 C#7.1端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆