第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

Java生成二維碼

  • jQuery-qrcode:

    ????網(wǎng)址:https://github.com/jeromeetienne/jquery-qrcode


    查看全部
  • 生成:

    package com.jz.qrcode;


    import java.awt.Color;

    import java.awt.Graphics2D;

    import java.awt.image.BufferedImage;

    import java.io.File;

    import java.io.IOException;


    import javax.imageio.ImageIO;


    import com.swetake.util.Qrcode;

    /**

    ?* 使用QRCode來生成二維碼

    ?* 生成原理:根據(jù)java GUI畫圖工具來生成

    ?*?

    ?* */

    public class CreatQRCode {


    public static void main(String[] args) {

    String qrData = "www.baidu.com";

    Qrcode x = new Qrcode();

    x.setQrcodeErrorCorrect('M');//糾錯等級

    x.setQrcodeEncodeMode('B');//N 數(shù)字? ?A a-z? B代表其他內容

    /*

    * 版本? ?1-40

    * 從21x21(版本1),到177x177(版本40),每一版本符號比前一版本每邊增加4個模塊。

    * */

    int version = 7;

    x.setQrcodeVersion(version);

    //畫的長度根據(jù)版本的不同,大小不同, 下面的長度計算公式固定

    int width = 67+12*(version-1);

    int height = 67+12*(version-1);

    //BufferedImage.TYPE_INT_RGB? ? 指定圖片的RGB 值為int型 的 8位

    BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

    /*

    * Graphics 繪圖

    *?

    * */

    Graphics2D gs = bufferedImage.createGraphics();

    gs.setBackground(Color.WHITE);

    gs.setColor(Color.BLACK);

    gs.clearRect(0, 0, width, height);

    int pixff = 2;//偏移量

    byte[] d =qrData.getBytes();

    if (d.length>0 && d.length <120){

    ? ? boolean[][] s = x.calQrcode(d);


    ? ? for (int i=0;i<s.length;i++){

    for (int j=0;j<s.length;j++){

    ? ? if (s[j][i]) {

    gs.fillRect(j*3+pixff,i*3+pixff,3,3);

    ? ? }

    }

    ? ? }

    }

    gs.dispose();

    bufferedImage.flush();

    try {

    ImageIO.write(bufferedImage, "png", new File("D:/baidu2_QRCode.png"));

    } catch (IOException e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }

    }



    識別:

    package com.jz.qrcode;


    import java.awt.image.BufferedImage;

    import java.io.File;

    import java.io.IOException;


    import javax.imageio.ImageIO;


    import jp.sourceforge.qrcode.QRCodeDecoder;

    /**

    ?* QRCode 解析二維碼信息

    ?*?

    ?* */

    public class ReaderQRCode {


    public static void main(String[] args) {

    File file = new File("D:/baidu2_QRCode.png");

    BufferedImage bufferedImage;

    try {

    bufferedImage = ImageIO.read(file);

    QRCodeDecoder codeDecoder = new QRCodeDecoder();

    String result = new String(codeDecoder.decode(new MyQRCodeImage(

    bufferedImage)),"gb2312");

    System.out.println(result);


    } catch (IOException e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }


    }



    接口:

    package com.jz.qrcode;


    import java.awt.image.BufferedImage;


    import jp.sourceforge.qrcode.data.QRCodeImage;


    public class MyQRCodeImage implements QRCodeImage {


    BufferedImage bufferedImage;

    public MyQRCodeImage(BufferedImage bufferedImage){

    this.bufferedImage = bufferedImage;

    }

    @Override

    public int getHeight() {

    return bufferedImage.getHeight();

    }


    @Override

    public int getPixel(int arg0, int arg1) {

    return bufferedImage.getRGB(arg0, arg1);

    }


    @Override

    public int getWidth() {

    return bufferedImage.getWidth();

    }


    }


    查看全部
  • 查看全部
  • package com.jz.QRCode;


    import java.awt.Image;

    import java.awt.image.BufferedImage;

    import java.io.File;

    import java.io.IOException;

    import java.util.HashMap;


    import javax.imageio.ImageIO;


    import com.google.zxing.BinaryBitmap;

    import com.google.zxing.EncodeHintType;

    import com.google.zxing.MultiFormatReader;

    import com.google.zxing.Result;

    import com.google.zxing.client.j2se.BufferedImageLuminanceSource;

    import com.google.zxing.common.BitArray;

    import com.google.zxing.common.BitMatrix;

    import com.google.zxing.common.HybridBinarizer;


    public class ReaderQRCode {


    public static void main(String[] args) {


    try {

    /*

    * MultiFormatReader 多格式讀取

    *?

    * */

    MultiFormatReader formatReader = new MultiFormatReader();

    File file = new File("D:/baidu_QRCode.png");

    //讀取圖片buffer中

    BufferedImage bufferedImage = ImageIO.read(file);

    /*

    * BinaryBitmap 二進制位圖

    * HybridBinarizer 混合二值化器

    * BufferedImageLuminanceSource? ?圖像緩存區(qū) 亮度 資源

    *?

    * */

    BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(new BufferedImageLuminanceSource(bufferedImage)));

    //定義二維碼參數(shù)

    HashMap hashMap = new HashMap();

    hashMap.put(EncodeHintType.CHARACTER_SET, "utf-8");//編碼方式

    Result result = formatReader.decode(binaryBitmap,hashMap);

    System.out.println("解析結果:"+result.toString());

    System.out.println("二維碼格式類型:"+result.getBarcodeFormat());//BarcodeFormat? ?條形碼格式

    System.out.println("二維碼文本內容:"+result.getText());

    } catch (Exception e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }

    }


    查看全部
  • /** *使用zxing生成二維碼 */?

    public class CreateQRCode {?

    ?public static void main(String[] arge) throws WriterException, IOException{

    ?int width = 300;//定義圖片寬度 int height = 300;//定義圖片高度 String format ="png";//定義圖片格式 String content ="www.8664600.com";//定義二維碼內容 //定義二維碼參數(shù) HashMap hints = ?new HashMap(); hints.put(EncodeHintType.CHARACTER_SET, "utf-8");//設置編碼 //設置容錯等級,等級越高,容量越小 hints.put(EncodeHintType.ERROR_CORRECTION,ErrorCorrectionLevel.M); hints.put(EncodeHintType.MARGIN,2);//設置邊距 //生成矩陣 BitMatrix bitMatrix = new MultiFormatWriter().encode(content,BarcodeFormat.QR_CODE, width, height); //設置路徑 Path file = new File("C:/Users/qqazl001/Desktop/Rui/ma.png").toPath(); MatrixToImageWriter.writeToPath(bitMatrix, format, file);//輸出圖像 } }

    查看全部
  • Zxing:

    ? 網(wǎng)址:https://github.com/zxing/

    ? 特點:開源 java編寫

    ? 下載后為源代碼,需要自己打成jar包(包含core中的 com和javase中的com)

    查看全部
  • https://img1.sycdn.imooc.com//5b225ee100011d6e04790247.jpg

    https://img1.sycdn.imooc.com//5b225f1200011d3b08120056.jpg

    https://img1.sycdn.imooc.com//5b225f2600017b9307370402.jpg

    糾錯能力越高,承載信息越少

    https://img1.sycdn.imooc.com//5b225f500001cbff05980319.jpg






    查看全部
    0 采集 收起 來源:QR Code

    2018-06-14

  • 二維碼的分類

    查看全部
    0 采集 收起 來源:二維碼分類

    2018-06-12

  • QR 二維碼

    查看全部
    0 采集 收起 來源:QR Code

    2018-05-22

  • 二維碼
    查看全部
  • 生成

    查看全部
    0 采集 收起 來源:QR Code

    2018-04-22

  • QR Code

    查看全部
    0 采集 收起 來源:QR Code

    2018-04-22

  • QR code

    查看全部
    0 采集 收起 來源:QR Code

    2018-04-22

  • 缺點

    查看全部
  • 優(yōu)點

    查看全部

舉報

0/150
提交
取消
課程須知
本門課程是Java的中級課程 ,學習前需要具備Java基礎知識,并對Java Web有所了解。
老師告訴你能學到什么?
1、了解二維碼的概念 2、掌握如何使用ZXing、QRCode、jquery-qrcode三種方式生成二維碼 3、如何解析二維碼

微信掃碼,參與3人拼團

微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復購買,感謝您對慕課網(wǎng)的支持!