Qrcodec # Use qrcode. Net to generate a QR code (QR code) The next day in Windows Phone 7)

Source: Internet
Author: User

More and more receipts have auto-focus shooting functions, which also means these mobile phones can have bar code scanning functions, mobile phones can have bar code scanning functions, optimize the shopping process, and quickly store electronic business cards (QR code).

A QR code is a two-dimensional barcode. a QR code comes from the abbreviation of "Quick Response", meaning a quick response. It is derived from the inventor's hope that the QR code can be decoded quickly. QR codes can store more information than normal codes, and do not need to be directly aligned with the scanner when scanning like normal codes. The QR code is square and only black and white are available. Three of the four corners are printed with a small square pattern like "back. The three are patterns that help decode software positioning. users do not need to aim at them, and the data can still be correctly read no matter what angle they scan. More details.

Qrcode has many applications in daily life. For example, qrcode on train tickets can be used to store information. Currently, many mobile phone software provides qrcode scanning for downloading, the No. 1 online store opened a "wall sticker Supermarket" on the Shanghai Metro. Passers-by only need to use their mobile phones to scan the qrcode of a product and then place an order to purchase it.

The application we want to do this time is to generate a QR code and a reader. A class library on Windows Phone 7 is required. Search for available bar code identification libraries on the Internet. This is the best effect, the project in http://code.google.com/p/zxing/, also has. Net package. However, the Code is 2010, and it seems that it has not been updated for a long time.

Core code for creating qrcode

Public static writeablebitmap createbarcode ()
{
Writeablebitmap WB = NULL;
Qrcodewriter writer = new qrcodewriter ();
Bytematrix bitmatrix = NULL;
Try
{
Bitmatrix = writer. encode ("http: // www. Google. com", barcodeformat. qr_code, 300,300 );
WB = convertbytemartixtowriteablebitmap (bitmatrix );
}
Catch (writerexception E)
{
}
Catch (ioexception E)
{
}
Return WB;
}

Public static writeablebitmap convertbytemartixtowriteablebitmap (bytematrix BM)
{
Writeablebitmap WB = new writeablebitmap (BM. Width, BM. Height );
For (INT x = 0; x <= WB. pixelwidth-1; X ++)
{
For (INT y = 0; y <= WB. pixelheight-1; y ++)
{
If (BM. array [y] [x] =-1)
{
// White
WB. pixels [WB. pixelwidth * Y + x] = bitconverter. toint32 (bitconverter. getbytes (0 xffffffff), 0 );
}
Else
{
// Black
WB. pixels [WB. pixelwidth * Y + x] = bitconverter. toint32 (bitconverter. getbytes (0xff000000), 0 );
}
}
}
Return WB;
}

 

C # Use qrcode. Net to generate a QR code (QR code)

Research on Two-dimensional code block coloring (color two-dimensional code) Algorithm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.