Comments (2)
项目挺久没打理了,凭记忆简单说一下。
- 首先是二维码的编码,因为涉及复杂的算法所以直接用的现成的库,最后能得到n*n的二进制点阵。
- 根据二维码的wiki的介绍,如果已知二维码的大小,就能够知道每一个位置的所代表的信息(比如角上的一堆是一类用于定位的点,中间的包含代表数据的信息点,辅助定位的点,纠错用的点),这一步的分类可见qrcodeEncoder.js,用的方法也比较直观。
- 最后就是利用这些信息在不同的位置绘制相应的图形,具体可参考
src/components/renderer
下的这些样式生成代码。
简单来说就是:二维遍历图形坐标点,然后添加svg元素,svg元素的坐标、颜色、线条样式等都是很容易控制的。
图形的设计和识别率是最难的地方,好在常用的vx二维码扫描比较强大,只要0点和1点的对比度强一些基本都有实现的可能性。
from qrbtf.
第三点还不太清晰,我先看看 renderer 的代码吧。我能猜测是,寻找二维码矩阵中的 “模式” (方形4块,一字长形3/4/5/6块)然后用对应的 svg 图形去替换嘛?
from qrbtf.
Related Issues (20)
- 好项目!赞助怎么连个微信付款都没有 HOT 1
- 这个可以在Vue项目里面使用吗? HOT 2
- 大佬,能支持一下渐变吗?
- 您好,react模块是否已集成所有样式了,可否出个教程或api使用 HOT 1
- 生成的二维码图片jsqr库无法解析 HOT 1
- 能否添加批量生成功能
- Unable to encode high-byte order Unicode characters HOT 3
- Backend
- qrbtf.com 404 了 HOT 1
- 错误:不支持加密算法 HOT 1
- My name={ayo}
- Active span HOT 1
- Discord 邀请点不进去怎么办 HOT 1
- docker部署
- Error ERR_OSSL_EVP_UNSUPPORTED when running npm start with Node 20 HOT 4
- Plans to Open Source the AI Version? HOT 1
- issue: 不支持微信的赞赏码
- 请问项目方的下载二维码是入如何做的 是调用接口 后端统一返回图片吗 HOT 2
- C2二维码用户自定义颜色
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qrbtf.