2 Usage
Link to this section with
@secref["Usage" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
Link to this section with
@secref["Usage" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
2.1 Function
Link to this section with
@secref["Function" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
Link to this section with
@secref["Function" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
(qr-write | | data | | | | | | | output_file_path | | | | | | [ | #:mode mode | | | | | | | #:error_level error_level | | | | | | | #:module_width module_width | | | | | | | #:color color | | | | | | | #:express? express? | | | | | | | #:express_path express_path] | | | | | | | #:output_type output_type) | | → | | void? |
|
data : (string?) |
output_file_path : (path-string?) |
mode : string? = "B" |
error_level : string? = "H" |
module_width : natural? = 5 |
color : (cons/c string? string?) = '("black" . "white") |
express? : boolean? = #f |
express_path : path-string? = "imgfile + '.write.express'" |
output_type : (or/c 'png 'svg) |
output qr code image to file.
color’s form is ’(front_color . background_color).
use color "transparent" to set transparent(background).
if output_type is png, can use color-database<%>
,
but hex color is all available in all formats, recommended.
(qr-read | | image_file_path | | | | | | [ | #:express? express? | | | | | | | #:express_path express_path]) | | → | | string? |
|
image_file_path : (path-string?) |
express? : boolean? = #f |
express_path : path-string? = "imgfile + '.read.express'" |
read qr code image’s content, if failed, return "".
2.2 Example
Link to this section with
@secref["Example" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
Link to this section with
@secref["Example" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
#lang racket |
|
(require simple-qr) |
|
;; block's default width is 5 |
|
(qr-write "https://github.com/simmone" "normal.png") |
|
(qr-write "https://github.com/simmone" "normal_color.png" #:color '("#ffbb33" . "#0d47a1")) |
|
(qr-write "https://github.com/simmone" "normal_trans.png" #:color '("#9933CC" . "transparent")) |
|
(qr-write "https://github.com/simmone" "small.png" #:module_width 2) |
|
(qr-write "https://github.com/simmone" "large.png" #:module_width 10) |
|
(printf "~a\n~a\n~a\n" |
(qr-read "normal.png") |
(qr-read "small.png") |
(qr-read "large.png")) |
|
(printf "~a\n" (qr-read "damaged.png")) |
|
(qr-write "https://github.com/simmone" "normal.svg" #:output_type 'svg) |
|
(qr-write "https://github.com/simmone" "normal_color.svg" #:color '("#ffbb33" . "#0d47a1") #:output_type 'svg) |
|
(qr-write "https://github.com/simmone" "normal_trans.svg" #:color '("#9933CC" . "transparent") #:output_type 'svg) |
2.3 Png
Link to this section with
@secref["Png" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
Link to this section with
@secref["Png" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
(qr-write "https://github.com/simmone" "normal.png") |
(qr-write "https://github.com/simmone" "normal_color.png" #:color '("#ffbb33" . "#0d47a1")) |
(qr-write "https://github.com/simmone" "normal_trans.png" #:color '("#9933CC" . "transparent")) |
(qr-write "https://github.com/simmone" "small.png" #:module_width 2) |
(qr-write "https://github.com/simmone" "large.png" #:module_width 10) |
2.4 SVG
Link to this section with
@secref["SVG" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
Link to this section with
@secref["SVG" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
(qr-write "https://github.com/simmone" "normal.svg" #:output_type 'svg) |
(qr-write "https://github.com/simmone" "normal_color.svg" #:color '("#ffbb33" . "#0d47a1") #:output_type 'svg) |
(qr-write "https://github.com/simmone" "normal_trans.svg" #:color '("#9933CC" . "transparent") #:output_type 'svg) |
2.5 Read and Correct
Link to this section with
@secref["Read_and_Correct" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
Link to this section with
@secref["Read_and_Correct" #:doc '(lib "simple-qr/scribble/simple-qr.scrbl")]
(printf "~a\n" (qr-read "damaged.png")) |
https://github.com/simmone