GithubHelp home page GithubHelp logo

Comments (2)

CPunisher avatar CPunisher commented on June 16, 2024

项目挺久没打理了,凭记忆简单说一下。

  1. 首先是二维码的编码,因为涉及复杂的算法所以直接用的现成的库,最后能得到n*n的二进制点阵。
  2. 根据二维码的wiki的介绍,如果已知二维码的大小,就能够知道每一个位置的所代表的信息(比如角上的一堆是一类用于定位的点,中间的包含代表数据的信息点,辅助定位的点,纠错用的点),这一步的分类可见qrcodeEncoder.js,用的方法也比较直观。
  3. 最后就是利用这些信息在不同的位置绘制相应的图形,具体可参考src/components/renderer下的这些样式生成代码。
    简单来说就是:二维遍历图形坐标点,然后添加svg元素,svg元素的坐标、颜色、线条样式等都是很容易控制的。

图形的设计和识别率是最难的地方,好在常用的vx二维码扫描比较强大,只要0点和1点的对比度强一些基本都有实现的可能性。

from qrbtf.

yeqown avatar yeqown commented on June 16, 2024

第三点还不太清晰,我先看看 renderer 的代码吧。我能猜测是,寻找二维码矩阵中的 “模式” (方形4块,一字长形3/4/5/6块)然后用对应的 svg 图形去替换嘛?

from qrbtf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.