個性二維碼開源專題<介紹篇>


由C#編寫的個性二維碼底層,已應用到 碼曬客/瘋狂創意二維碼等項目上,並獲得多項軟件著作專利。

 

瘋狂創意二維碼

瘋狂創意二維碼是可用於生成風格獨特的個性化二維碼生成器,用戶可以將目標信息輸入到二維碼生成器中,生成相應的個性二維碼,然后輸出為相應圖片格式並保存。輸入信息可以是:數字、網址、文字、微信、微博以及名片信息等,用戶可以將想要生成二維碼的信息批量導入,進行自動化批量生成導出處理。

 

碼曬客

碼曬客,由元創信息科技傾力打造,中國首款二維碼個性制作神器,史上最能曬的二維碼制作軟件。該軟件具備自動更新功能,一直服務做到用戶滿意。

 

要求:

C#,.net 4.0以上

引入 lib\Yc.QrCodeLib.dll

 

手腳架:

//創建個性二維碼類庫
Yc.QrcodeLib.XXX
//創建QrEncode 類
QrEncode.cs
//繼承 CustomEncode
public class QrEncode : Yc.QrCodeLib.custom.CustomEncode
//生成驗證 
public QrEncode(string key)
     : base(key)
 {

 }
 public override void SetParam()
 {
        base.SetParam();
        //TODO:設置具體參數
  }
        //個性二維碼生成最小單元
        public override Bitmap Encode(string content)
        {
            try
            {
                matrix = QrCodeEncoder.calQrcode(EnCoding.GetBytes(content));
            }
            catch { throw new Exception("內容超出范圍,請選擇更高版本或者降低容錯率"); }

            this.SetParam();

            //SolidBrush Backbrush = new SolidBrush(QrCodeEncoder.QRCodeBackgroundColor);
            SolidBrush Backbrush = new SolidBrush(Color.Transparent);//背景透明
            SolidBrush Forebrush = new SolidBrush(QrCodeEncoder.QRCodeForegroundColor);

            Bitmap image = new Bitmap(this.QrCodeW, this.QrCodeH);
            Graphics g = Graphics.FromImage(image);

            Rectangle rect = new Rectangle();

            g.FillRectangle(Backbrush, new Rectangle(0, 0, image.Width, image.Height));

            for (int i = 0; i < matrix.Length; i++)
            {
                for (int j = 0; j < matrix.Length; j++)
                {
                    rect = new Rectangle((j + this.SpacingW) * QrCodeEncoder.QRCodeScale, (i + this.SpacingH) * QrCodeEncoder.QRCodeScale, QrCodeEncoder.QRCodeScale, QrCodeEncoder.QRCodeScale);
                    if (matrix[j][i])
                    {
                        ChangeFillShape(g, Forebrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush);
                    }
                    else
                        ChangeFillShape(g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush);
                }
            }
            return image;
        }

 

Yc.QrCodeLib.SuperMario Yc.QrCodeLib.Original Yc.QrCodeLib.Needle Yc.QrCodeLib.LightBulb Yc.QrCodeLib.HeartBalloon 
Yc.QrCodeLib.Colorful Yc.QrCodeLib.Angry_Birds Yc.QrCodeLib._3ai Yc.QrCode.Lib.Radio Yc.QrCode.Lib.LovingHeart

 以下是開源地址,國外github,國內oschina.net

oschina.net:

http://git.oschina.net/cheng5x/Yc.QrCode

 

github:

https://github.com/cheng5x/YcQrCode

 

官方網站:
http://original-ad.com

碼曬客討論QQ群:
28629273


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM