* Created by yihui on 2017/7/13.
*/
-@Slf4j
public class AudioWrapper {
+ private static final Logger log = LoggerFactory.getLogger(AudioWrapper.class);
+
public static Builder
* Created by yihui on 2017/7/27.
*/
-@Getter
-@Setter
public class BitMatrixEx {
/**
* 实际生成二维码的宽
@@ -40,4 +36,52 @@ public class BitMatrixEx {
private int multiple;
private ByteMatrix byteMatrix;
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public int getLeftPadding() {
+ return leftPadding;
+ }
+
+ public void setLeftPadding(int leftPadding) {
+ this.leftPadding = leftPadding;
+ }
+
+ public int getTopPadding() {
+ return topPadding;
+ }
+
+ public void setTopPadding(int topPadding) {
+ this.topPadding = topPadding;
+ }
+
+ public int getMultiple() {
+ return multiple;
+ }
+
+ public void setMultiple(int multiple) {
+ this.multiple = multiple;
+ }
+
+ public ByteMatrix getByteMatrix() {
+ return byteMatrix;
+ }
+
+ public void setByteMatrix(ByteMatrix byteMatrix) {
+ this.byteMatrix = byteMatrix;
+ }
}
diff --git a/plugins/qrcode-plugin/src/main/java/com/github/hui/quick/plugin/qrcode/wrapper/QrCodeGenWrapper.java b/plugins/qrcode-plugin/src/main/java/com/github/hui/quick/plugin/qrcode/wrapper/QrCodeGenWrapper.java
index cb77c4bc..b30a425b 100644
--- a/plugins/qrcode-plugin/src/main/java/com/github/hui/quick/plugin/qrcode/wrapper/QrCodeGenWrapper.java
+++ b/plugins/qrcode-plugin/src/main/java/com/github/hui/quick/plugin/qrcode/wrapper/QrCodeGenWrapper.java
@@ -10,9 +10,9 @@
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageConfig;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
-import lombok.ToString;
-import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.*;
@@ -93,9 +93,8 @@ private static boolean asFile(QrCodeOptions qrCodeOptions, String absFileName) t
}
- @ToString
- @Slf4j
public static class Builder {
+ private static Logger log = LoggerFactory.getLogger(QrCodeGenWrapper.Builder.class);
private static final MatrixToImageConfig DEFAULT_CONFIG = new MatrixToImageConfig();
/**
@@ -877,5 +876,13 @@ public ByteArrayOutputStream asStream() throws WriterException, IOException {
public boolean asFile(String absFileName) throws IOException, WriterException {
return QrCodeGenWrapper.asFile(build(), absFileName);
}
+
+ @Override
+ public String toString() {
+ return "Builder{" + "msg='" + msg + '\'' + ", w=" + w + ", h=" + h + ", code='" + code + '\'' +
+ ", padding=" + padding + ", errorCorrection=" + errorCorrection + ", picType='" + picType + '\'' +
+ ", bgImgOptions=" + bgImgOptions + ", logoOptions=" + logoOptions + ", drawOptions=" + drawOptions +
+ ", detectOptions=" + detectOptions + '}';
+ }
}
}
diff --git a/plugins/qrcode-plugin/src/main/java/com/github/hui/quick/plugin/qrcode/wrapper/QrCodeOptions.java b/plugins/qrcode-plugin/src/main/java/com/github/hui/quick/plugin/qrcode/wrapper/QrCodeOptions.java
index 1cb67f72..b7629010 100644
--- a/plugins/qrcode-plugin/src/main/java/com/github/hui/quick/plugin/qrcode/wrapper/QrCodeOptions.java
+++ b/plugins/qrcode-plugin/src/main/java/com/github/hui/quick/plugin/qrcode/wrapper/QrCodeOptions.java
@@ -5,8 +5,6 @@
import com.github.hui.quick.plugin.qrcode.entity.DotSize;
import com.github.hui.quick.plugin.qrcode.helper.QrCodeRenderHelper;
import com.google.zxing.EncodeHintType;
-import lombok.Builder;
-import lombok.Data;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@@ -15,11 +13,11 @@
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
/**
* Created by yihui on 2017/7/17.
*/
-@Data
public class QrCodeOptions {
/**
* 塞入二维码的信息
@@ -82,11 +80,111 @@ public boolean gifQrCode() {
}
+ public String getMsg() {
+ return msg;
+ }
+
+ public void setMsg(String msg) {
+ this.msg = msg;
+ }
+
+ public Integer getW() {
+ return w;
+ }
+
+ public void setW(Integer w) {
+ this.w = w;
+ }
+
+ public Integer getH() {
+ return h;
+ }
+
+ public void setH(Integer h) {
+ this.h = h;
+ }
+
+ public DrawOptions getDrawOptions() {
+ return drawOptions;
+ }
+
+ public void setDrawOptions(DrawOptions drawOptions) {
+ this.drawOptions = drawOptions;
+ }
+
+ public BgImgOptions getBgImgOptions() {
+ return bgImgOptions;
+ }
+
+ public void setBgImgOptions(BgImgOptions bgImgOptions) {
+ this.bgImgOptions = bgImgOptions;
+ }
+
+ public LogoOptions getLogoOptions() {
+ return logoOptions;
+ }
+
+ public void setLogoOptions(LogoOptions logoOptions) {
+ this.logoOptions = logoOptions;
+ }
+
+ public DetectOptions getDetectOptions() {
+ return detectOptions;
+ }
+
+ public void setDetectOptions(DetectOptions detectOptions) {
+ this.detectOptions = detectOptions;
+ }
+
+ public Map
+ * 用于设置二维码的绘制在背景图上的x坐标
+ */
+ private int startX;
+
+
+ /**
+ * if {@link #bgImgStyle} == QrCodeOptions.BgImgStyle.FILL
+ *
+ * 用于设置二维码的绘制在背景图上的y坐标
+ */
+ private int startY;
+
+ public BgImgOptionsBuilder bgImg(BufferedImage bgImg) {
+ this.bgImg = bgImg;
+ return this;
+ }
+
+ public BgImgOptionsBuilder gifDecoder(GifDecoder gifDecoder) {
+ this.gifDecoder = gifDecoder;
+ return this;
+ }
+
+ public BgImgOptionsBuilder bgW(int bgW) {
+ this.bgW = bgW;
+ return this;
+ }
+
+ public BgImgOptionsBuilder bgH(int bgH) {
+ this.bgH = bgH;
+ return this;
+ }
+
+ public BgImgOptionsBuilder bgImgStyle(BgImgStyle bgImgStyle) {
+ this.bgImgStyle = bgImgStyle;
+ return this;
+ }
+
+ public BgImgOptionsBuilder opacity(float opacity) {
+ this.opacity = opacity;
+ return this;
+ }
+
+ public BgImgOptionsBuilder startX(int startX) {
+ this.startX = startX;
+ return this;
+ }
+
+ public BgImgOptionsBuilder startY(int startY) {
+ this.startY = startY;
+ return this;
+ }
+
+ public BgImgOptions build() {
+ return new BgImgOptions(bgImg, gifDecoder, bgW, bgH, bgImgStyle, opacity, startX, startY);
+ }
+ }
}
/**
* 探测图形的配置信息
*/
- @Builder
- @Data
public static class DetectOptions {
private Color outColor;
@@ -245,6 +711,72 @@ public Boolean getSpecial() {
return BooleanUtils.isTrue(special);
}
+ public DetectOptions() {
+ }
+
+ public DetectOptions(Color outColor, Color inColor, BufferedImage detectImg, BufferedImage detectImgLT,
+ BufferedImage detectImgRT, BufferedImage detectImgLD, Boolean special) {
+ this.outColor = outColor;
+ this.inColor = inColor;
+ this.detectImg = detectImg;
+ this.detectImgLT = detectImgLT;
+ this.detectImgRT = detectImgRT;
+ this.detectImgLD = detectImgLD;
+ this.special = special;
+ }
+
+ public Color getOutColor() {
+ return outColor;
+ }
+
+ public void setOutColor(Color outColor) {
+ this.outColor = outColor;
+ }
+
+ public Color getInColor() {
+ return inColor;
+ }
+
+ public void setInColor(Color inColor) {
+ this.inColor = inColor;
+ }
+
+ public BufferedImage getDetectImg() {
+ return detectImg;
+ }
+
+ public void setDetectImg(BufferedImage detectImg) {
+ this.detectImg = detectImg;
+ }
+
+ public BufferedImage getDetectImgLT() {
+ return detectImgLT;
+ }
+
+ public void setDetectImgLT(BufferedImage detectImgLT) {
+ this.detectImgLT = detectImgLT;
+ }
+
+ public BufferedImage getDetectImgRT() {
+ return detectImgRT;
+ }
+
+ public void setDetectImgRT(BufferedImage detectImgRT) {
+ this.detectImgRT = detectImgRT;
+ }
+
+ public BufferedImage getDetectImgLD() {
+ return detectImgLD;
+ }
+
+ public void setDetectImgLD(BufferedImage detectImgLD) {
+ this.detectImgLD = detectImgLD;
+ }
+
+ public void setSpecial(Boolean special) {
+ this.special = special;
+ }
+
public BufferedImage chooseDetectedImg(QrCodeRenderHelper.DetectLocation detectLocation) {
switch (detectLocation) {
case LD:
@@ -258,13 +790,98 @@ public BufferedImage chooseDetectedImg(QrCodeRenderHelper.DetectLocation detectL
}
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DetectOptions that = (DetectOptions) o;
+ return Objects.equals(outColor, that.outColor) && Objects.equals(inColor, that.inColor) &&
+ Objects.equals(detectImg, that.detectImg) && Objects.equals(detectImgLT, that.detectImgLT) &&
+ Objects.equals(detectImgRT, that.detectImgRT) && Objects.equals(detectImgLD, that.detectImgLD) &&
+ Objects.equals(special, that.special);
+ }
+
+ @Override
+ public int hashCode() {
+
+ return Objects.hash(outColor, inColor, detectImg, detectImgLT, detectImgRT, detectImgLD, special);
+ }
+
+ @Override
+ public String toString() {
+ return "DetectOptions{" + "outColor=" + outColor + ", inColor=" + inColor + ", detectImg=" + detectImg +
+ ", detectImgLT=" + detectImgLT + ", detectImgRT=" + detectImgRT + ", detectImgLD=" + detectImgLD +
+ ", special=" + special + '}';
+ }
+
+ public static DetectOptionsBuilder builder() {
+ return new DetectOptionsBuilder();
+ }
+
+ public static class DetectOptionsBuilder {
+ private Color outColor;
+
+ private Color inColor;
+
+ private BufferedImage detectImg;
+
+ private BufferedImage detectImgLT;
+
+ private BufferedImage detectImgRT;
+
+ private BufferedImage detectImgLD;
+
+ private Boolean special;
+
+ public DetectOptionsBuilder outColor(Color outColor) {
+ this.outColor = outColor;
+ return this;
+ }
+
+ public DetectOptionsBuilder inColor(Color inColor) {
+ this.inColor = inColor;
+ return this;
+ }
+
+ public DetectOptionsBuilder detectImg(BufferedImage detectImg) {
+ this.detectImg = detectImg;
+ return this;
+ }
+
+ public DetectOptionsBuilder detectImgLT(BufferedImage detectImgLT) {
+ this.detectImgLT = detectImgLT;
+ return this;
+ }
+
+ public DetectOptionsBuilder detectImgRT(BufferedImage detectImgRT) {
+ this.detectImgRT = detectImgRT;
+ return this;
+ }
+
+ public DetectOptionsBuilder detectImgLD(BufferedImage detectImgLD) {
+ this.detectImgLD = detectImgLD;
+ return this;
+ }
+
+ public DetectOptionsBuilder special(Boolean special) {
+ this.special = special;
+ return this;
+ }
+
+ public DetectOptions build() {
+ return new DetectOptions(outColor, inColor, detectImg, detectImgLT, detectImgRT, detectImgLD, special);
+ }
+ }
}
/**
* 绘制二维码的配置信息
*/
- @Data
public static class DrawOptions {
/**
* 着色颜色
@@ -344,6 +961,126 @@ public String getDrawQrTxt() {
return QuickQrUtil.qrTxt(text, txtMode != null && txtMode == TxtMode.RANDOM);
}
+ public Color getPreColor() {
+ return preColor;
+ }
+
+ public void setPreColor(Color preColor) {
+ this.preColor = preColor;
+ }
+
+ public Color getBgColor() {
+ return bgColor;
+ }
+
+ public void setBgColor(Color bgColor) {
+ this.bgColor = bgColor;
+ }
+
+ public BufferedImage getBgImg() {
+ return bgImg;
+ }
+
+ public void setBgImg(BufferedImage bgImg) {
+ this.bgImg = bgImg;
+ }
+
+ public DrawStyle getDrawStyle() {
+ return drawStyle;
+ }
+
+ public void setDrawStyle(DrawStyle drawStyle) {
+ this.drawStyle = drawStyle;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getFontName() {
+ return fontName;
+ }
+
+ public void setFontName(String fontName) {
+ this.fontName = fontName;
+ }
+
+ public TxtMode getTxtMode() {
+ return txtMode;
+ }
+
+ public void setTxtMode(TxtMode txtMode) {
+ this.txtMode = txtMode;
+ }
+
+ public int getFontStyle() {
+ return fontStyle;
+ }
+
+ public void setFontStyle(int fontStyle) {
+ this.fontStyle = fontStyle;
+ }
+
+ public boolean isEnableScale() {
+ return enableScale;
+ }
+
+ public void setEnableScale(boolean enableScale) {
+ this.enableScale = enableScale;
+ }
+
+ public boolean isDiaphaneityFill() {
+ return diaphaneityFill;
+ }
+
+ public void setDiaphaneityFill(boolean diaphaneityFill) {
+ this.diaphaneityFill = diaphaneityFill;
+ }
+
+ public Map