# visual-qr-code
## 可以创建出设置了虚拟背景图片的二维码,设置的背景图片或logo并不是只是在二维码中心,背景图片和logo都是半透明的,让二维码更好看
## 一、使用示例(详细情况源码中的测试用例)
#### 示例1:
##### 测试代码
```
@Test
public void testPOSITIONRECTANGLE() {
String url = "http://blog.csdn.net/weixin_41279060/article/details/78961532";
try {
VisualQRCode.createQRCode(url,
"./img/lg-logo.jpg",
outPutPath + "QRCodePOSITIONRECTANGLE.png",
'H',
new Color(2, 85, 43),
null,
null,
null,
true,
VisualQRCode.POSITION_DETECTION_SHAPE_MODEL_RECTANGLE,
VisualQRCode.FILL_SHAPE_MODEL_RECTANGLE);
} catch (IOException e) {
e.printStackTrace();
}
}
```
##### 生成的二维码效果(方形码眼,方形小点):
![输入图片说明](https://gitee.com/uploads/images/2018/0103/152933_ac0f74da_1705914.png "POSITIONRECTANGLE.png")
#### 示例2:
##### 测试代码
```
@Test
public void testFILLCIRCLE() {
String url = "http://blog.csdn.net/weixin_41279060/article/details/78961532";
try {
VisualQRCode.createQRCode(url,
"./img/lg-logo.jpg",
outPutPath + "FILLCIRCLE.png",
'H',
new Color(2, 85, 43),
null,
null,
null,
true,
VisualQRCode.POSITION_DETECTION_SHAPE_MODEL_ROUND_RECTANGLE,
VisualQRCode.FILL_SHAPE_MODEL_CIRCLE);
} catch (IOException e) {
e.printStackTrace();
}
}
```
##### 生成的二维码效果(方圆形码眼,圆形小点):
![输入图片说明](https://gitee.com/uploads/images/2018/0103/153009_9a8e668b_1705914.png "FILLCIRCLE.png")
#### 示例3:
##### 测试代码
```
@Test
public void testLARGEIMG(){
String url = "http://blog.csdn.net/weixin_41279060/article/details/78961532";
try {
VisualQRCode.createQRCode(url,
"./img/xmyrz.jpg",
outPutPath+"LARGEIMG.png",
'H',
new Color(170, 24, 67),
800,
420,
200,
false,
VisualQRCode.POSITION_DETECTION_SHAPE_MODEL_ROUND_RECTANGLE,
VisualQRCode.FILL_SHAPE_MODEL_RECTANGLE);
} catch (IOException e) {
e.printStackTrace();
}
}
```
##### 生成的二维码效果(方圆形码眼,方形小点,设置了初始位置,没有把二维码设置成图片大小):
![输入图片说明](https://gitee.com/uploads/images/2018/0103/153027_3f09591e_1705914.png "LARGEIMG.png")
## 二、API使用介绍
#### 创建方法:
```
public static void createQRCode(String content, String bgPath, String outPath, char Level, Color DF, Integer startX, Integer startY, Integer QRCodeWidth, Boolean isDeformation, Integer fillPositionDetectionShapeModel, Integer fillShapeModel) throws IOException
```
#### 参数说明:
1、content 二维码内容、网址,必需
2、bgPath 背景图片路径,必需
3、outPath 二维码输出路径,必需
4、Level 二维码容错等级,必需
可选:"L"、"M"、"Q"、"H"
L水平 7%的字码可被修正
M水平 15%的字码可被修正
Q水平 25%的字码可被修正
H水平 30%的字码可被修正
5、DF 二维码颜色,必需
startX 二维码X轴起点,非必须,默认为图片的左上角
startY 二维码Y轴起点,非必须,默认为图片的左上角
QRCodeWidth 二维码的宽度,非必须,默认为背景图最小边
二维码的起始X/Y加上QRCodeWidth<=图片的宽/高
6、isDeformation 是否把背景图变成方形,非必须,默认为false不改变图片形状
7、fillPositionDetectionShapeModel 二维码四个大码眼的形状,目前只支持方形和圆方形
可选:
POSITION_DETECTION_SHAPE_MODEL_RECTANGLE
POSITION_DETECTION_SHAPE_MODEL_ROUND_RECTANGLE
8、fillShapeModel 二维码点的形状,目前只支持方形和圆形
可选:
FILL_SHAPE_MODEL_RECTANGLE
FILL_SHAPE_MODEL_CIRCLE
## 三、使用说明
下载发行版本的jar包,引用,然后使用VisualQRCode.createQRCode创建二维码即可。
## 声明:
该二维码应用使用了http://www.swetake.com/qrcode 网站上提供的API
有什么不足或者需要可以留言或者联系本人,本人邮箱为 huangbenhao@163.com
## TIPS
maven版本会迟一点发布
作者Boat
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Visual Basic(简称VB)是一种基于事件驱动的、第三代对象导向的编程语言,最初由微软公司开发。Visual Basic主要用于Windows平台上的开发,旨在简化和加快Windows应用程序的开发过程。 以下是有关Visual Basic的一些重要特点和历史背景: 1. **可视化编程:** Visual Basic具有强大的集成开发环境(IDE),通过拖放控件、属性窗口等方式进行可视化设计,使其适合快速开发桌面应用程序。 2. **易学易用:** Visual Basic采用自然语言风格和事件驱动的编程模式,使得初学者可以相对容易地学习和使用。它的语法相对简单直观,许......
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![msi](https://img-home.csdnimg.cn/images/20210720083646.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![exe](https://img-home.csdnimg.cn/images/20210720083343.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![xlsm](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![xlsm](https://img-home.csdnimg.cn/images/20210720083646.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 11 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/c3958527918447d2ab5ccae2922e5f1d_sixpp.jpg!1)
专家-百锦再@新空间代码工作室
- 粉丝: 1w+
- 资源: 806
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)