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

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

Qrcode生成的掃描不出來


package com.snxun.QRCode;

import com.swetake.util.Qrcode;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;

public class Create {

? public static void main(String[] args) throws Exception {
? ? ?Qrcode qrcode = new Qrcode();
? ? ?// 設(shè)置糾錯(cuò)級(jí)別
? ? ?qrcode.setQrcodeErrorCorrect('M');
? ? ?// 設(shè)置編碼內(nèi)容,N代表數(shù)字,A代表A-z,B代表其他字符
? ? ?qrcode.setQrcodeEncodeMode('B');
? ? ?qrcode.setQrcodeVersion(7);

? ? ?String qrdata = "DSGASDGASDG";
? ? ?// 可以正好充滿二維碼大小的固定公式
? ? ?int width = 67 + 12 * (7 - 1);
? ? ?int height = 67 + 12 * (7 - 1);
? ? ?BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
? ? ?Graphics2D gs = bufferedImage.createGraphics();
? ? ?gs.setBackground(Color.black);
? ? ?gs.setColor(Color.WHITE);
? ? ?gs.clearRect(0, 0, width, height);

? ? ?// 如果有漢字,需要將編碼轉(zhuǎn)換成GB系列的
? ? ?int pixoff = 2;// 偏移量,防止解析的時(shí)候出錯(cuò)
? ? ?byte[] d = qrdata.getBytes("gb2312");
? ? ?if (d.length > 0 && d.length < 120) {
? ? ? ? boolean[][] s = qrcode.calQrcode(d);
? ? ? ? for (int i = 0; i < s.length; i++) {
? ? ? ? ? ?for (int j = 0; j < s.length; j++) {
? ? ? ? ? ? ? if (s[i][j]) {
? ? ? ? ? ? ? ? ?gs.fillRect(j * 3 + pixoff, i * 3 + pixoff, 3, 3);
? ? ? ? ? ? ? }
? ? ? ? ? ?}
? ? ? ? }
? ? ?}

? ? ?gs.dispose();
? ? ?bufferedImage.flush();
? ? ?ImageIO.write(bufferedImage, "png", new File("src/com/snxun/QRCode/2.png"));
? ? ?ImageIO.write(bufferedImage, "png", new File("E:/code/img2.png"));
? }

}

正在回答

舉報(bào)

0/150
提交
取消

Qrcode生成的掃描不出來

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)