基于zxing封装二维码代码

本文介绍了如何在Java中使用ZXing库封装二维码生成的代码,包括项目的pom依赖和具体的实现细节,欢迎指出可能存在的问题。
摘要由CSDN通过智能技术生成

代码是自己封装,可能会存在问题,有问题指正下,谢谢。

代码pom依赖

com.google.zxing core 3.1.0 ## 封装实体

import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;

public class QRCode {
   
    //二维码尺寸
    private Integer size;
    //纠错等级
    private ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.H;
    //编码格式
    private String charSet = "utf-8";
    //二维码边框
    private Integer margin = 0;
    //是否插入logo
    private Boolean isLogo = false;
    //LOGO显示宽度
    private Integer width;
    //LOGO显示高度
    private Integer height;
    //Logo地址
    private String logoPath;
    //内容
    private String content;
    //二维码颜色
    private Integer begColor = ColorConstant.WHITE;
    //
    private Integer afterColor = ColorConstant.BLACK;

    private String formatName = "png";
    public QRCode(Integer size){
   
        this.size = size;
    }
    public QRCode(){
   

    }
    public Integer getSize() {
   
        return size;
    }

    public void setSize(Integer size) {
   
        this.size = size;
    }

    public ErrorCorrectionLevel getErrorCorrectionLevel() {
   
        return errorCorrectionLevel;
    }

    public void setErrorCorrectionLevel(ErrorCorrectionLevel errorCorrectionLevel) {
   
        this.errorCorrectionLevel = errorCorrectionLevel;
    }

    public String getCharSet() {
   
        return charSet;
    }

    public void setCharSet(String charSet) {
   
        this.charSet = charSet;
    }

    public Integer getMargin() {
   
        return margin;
    }

    public void setMargin(Integer margin) {
   
        this.margin = margin;
    }

    public Boolean getLogo() {
   
        return isLogo;
    }

    public void setLogo(Boolean logo) {
   
        isLogo = logo;
    }

    public Integer getWidth() {
   
        return width;
    }

    public void setWidth(Integer width) {
   
        this.width = width;
    }

    public Integer getHeight() {
   
        return height;
    }

    public void setHeight(Integer height) {
   
        this.height = height;
    }

    public String getContent() {
   
        return content;
    }

    public void setContent(String content) {
   
        this.content = content;
    }

    public Integer getBegColor() {
   
        return begColor;
    }

    public void setBegColor(Integer begColor) {
   
        this.begColor = begColor;
    }

    public Integer getAfterColor() {
   
        return afterColor;
    }

    public void setAfterColor(Integer afterColor
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值