Coder Social home page Coder Social logo

qrc's Introduction

qrc — QR code encoder for OCaml

%%VERSION%%

Qrc encodes your data into QR codes. It has built-in QR matrix renderers for SVG, ANSI terminal and text.

Qrc is distributed under the ISC license. It has no dependencies.

Homepage: https://erratique.ch/software/qrc

Installation

qrc can be installed with opam:

opam install qrc

If you don't use opam consult the opam file for build instructions.

Documentation

The documentation can be consulted online or via odig doc qrc.

Questions are welcome but better asked on the OCaml forum than on the issue tracker.

Sample programs

The qrtrip tool generates QR codes from the command line. It renders QR matrices to SVG, ANSI terminals and US-ASCII or UTF-8 text.

qrc's People

Contributors

dbuenzli avatar alainfrisch avatar

Stargazers

Jan Fooken avatar Franz Maikäfer avatar Dylan Dronnier avatar Gál Tamás avatar Yilin Wei avatar  avatar Vladislav Prekel avatar Erik Martin-Dorel avatar Ronaldo Gligan avatar  avatar  avatar muuk avatar  avatar Thomas Gazagnaire avatar Dimitris Mostrous avatar Haochen M. Kotoi-Xie avatar Masanori Ogino avatar Sakamoto Noriaki avatar Darren Li avatar Aaron Zeng avatar Jochen Bartl avatar savi2w avatar Andrejs Agejevs avatar Calascibetta Romain avatar Hannes Mehnert avatar Xavier Van de Woestyne avatar joseferben avatar Seb Mondet avatar Sora Morimoto avatar Anurag Soni avatar Marcello Seri avatar  avatar

Watchers

Hannes Mehnert avatar  avatar James Cloos avatar  avatar  avatar

qrc's Issues

Moving to_svg out of Qrc.Matrix?

(This is more for discussion rather than an actual issue. Let me know if it is not the proper place to discuss.)

It doesn't feel natural to me to have the to_svg function in Qrc.Matrix, which conceptually is just an implementation of a data structure. Other "backends" are in their own module Qrc_fmt. Why no move to_svg there as well, or to a different unit, or just a different sub-module in Qrc? And perhaps make it use a similar interface than other backends (i.e. taking a formatter as argument); or are you concerned by performance of to_svg itself (when running in the browser, I guess)?

SVG backend: l:href not working

I'm trying to directly embed a SVG QR code in an HTML document (more precisely, I inject the code by setting the innerHTML property), and I get a white square. It seems that the <use l:href='#o' ...> reference is not properly understood. Simply dropping the l: prefix solves the issue.

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href claims that xlink:href is deprecated in SVG 2, but Qrc forces the use of version 1 (is it respected by the browser?).

Also, it works fine if I change the l: to xlink: without even defining this prefix! Is there something fishy with the parsing/interpretation of namespaces when parsing (non-X)HTML?

I'm using Chrome 87.0.4280.88.

Anyway, I was also wondering: Is there a strong (performance?/size?) benefit in using a reference instead of inlining the <rect> element for each "on" pixel? I'm concerned by possible clash with other elements with id='o' in the same document.

Have a look at the warnings

@alainfrisch reported to me a few warning he gets when compiling with non-default compiler warnings.

File "private/thirdparty/qrc/qrc.ml", line 290, characters 7-11: 
290 | (**) 
^^^^ 
Error (warning 50): unattached documentation comment (ignored) 

File "private/thirdparty/qrc/qrc.ml", line 301, characters 7-11: 
301 | (**) 
^^^^ 
Error (warning 50): unattached documentation comment (ignored) 

File "private/thirdparty/qrc/qrc.ml", line 312, characters 7-11: 
312 | (**) 
^^^^ 
Error (warning 50): unattached documentation comment (ignored) 

File "private/thirdparty/qrc/qrc.ml", line 31, characters 21-33: 
31 | let create len v = Bytes.create (div_round_up len 8) (if v then 
255 else 0) 
^^^^^^^^^^^^ 
Error (warning 6): label len was omitted in the application of this 
function. 

File "private/thirdparty/qrc/qrc.ml", line 90, characters 2-22: 
90 | type gen = int array (* Generator polynomial coefficients (hi to 
lo). *) 
^^^^^^^^^^^^^^^^^^^^ 
Error (warning 34): unused type gen. 

File "private/thirdparty/qrc/qrc.ml", line 264, characters 22-29: 
264 | let total_bytes (`V version as v) = 
^^^^^^^ 
Error (warning 27): unused variable version. 

File "private/thirdparty/qrc/qrc.ml", line 360, characters 15-18: 
360 | and set_17 i max = 
^^^ 
Error (warning 27): unused variable max. 

File "private/thirdparty/qrc/qrc.ml", line 543, characters 12-13: 
543 | | 1 -> fun ~x ~y -> y mod 2 = 0 
^ 
Error (warning 27): unused variable x. 

File "private/thirdparty/qrc/qrc.ml", line 544, characters 15-16: 
544 | | 2 -> fun ~x ~y -> x mod 3 = 0 
^ 
Error (warning 27): unused variable y. 

File "private/thirdparty/qrc/qrc.ml", line 552, characters 36-44: 
552 | let set_data mask (`V version as v) ec_level data m = (* see 7.7.3 *) 
^^^^^^^^ 
Error (warning 27): unused variable ec_level. 

File "private/thirdparty/qrc/qrc.ml", line 732, characters 20-21: 
732 | let find_mode ?mode s = match mode with Some m -> m | None -> `Byte 
^ 
Error (warning 27): unused variable s. 

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.