1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//! # qrism
//!
//! A Rust library for generating and reading QR codes with Reed-Solomon error correction.
//! Supports traditional monochromatic QR codes with additional experimental multicolor QR
//! support for enhanced storage capacity.
//!
//! ## Features
//!
//! - **QR Code Generation**: Create QR codes with customizable versions, error correction levels, and capacity
//! - **QR Code Reading**: Detect and decode QR codes from images with robust error correction
//! - **Reed-Solomon Error Correction**: Built-in error correction with configurable levels (L, M, Q, H)
//! - **High Capacity QR Support**: Experimental polychromatic QR codes with 3x storage capacity
//! - **Image Processing**: Advanced binarization and geometric correction for reliable detection
//!
//! ## Quick Start
//!
//! ### Simple QR Code Generation
//!
//! ```rust
//! use qrism::QRBuilder;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Simplest usage - provide only data, all other settings are automatically chosen
//! let qr = QRBuilder::new(b"Hello, World!")
//! .build()?;
//!
//! let img = qr.to_image(4); // 4x scale factor
//! img.save("simple_qr.png")?;
//! # Ok(())
//! # }
//! ```
//!
//! ### Full Configuration
//!
//! ```rust
//! use qrism::{QRBuilder, ECLevel, Version, MaskPattern};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let data = "Hello, World!";
//! let qr = QRBuilder::new(data.as_bytes())
//! .version(Version::Normal(2)) // QR version (size) - if not provided, finds smallest version to fit data
//! .ec_level(ECLevel::M) // Error correction level - if not provided, defaults to ECLevel::M
//! .high_capacity(false) // Standard capacity mode - if not provided, defaults to false
//! .mask(MaskPattern::new(3)) // Mask pattern - if not provided, finds best mask based on penalty score
//! .build()?;
//!
//! let img = qr.to_image(4); // 4x scale factor
//! img.save("configured_qr.png")?;
//! # Ok(())
//! # }
//! ```
//!
//! ### Reading a QR Code
//!
//! ```rust,no_run
//! use qrism::reader::detect_qr;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Load and prepare image
//! let img = image::open("qr_code.png")?;
//!
//! // Detect and decode QR codes
//! let mut res = detect_qr(&img);
//! if let Some(symbol) = res.symbols().first_mut() {
//! let (metadata, message) = symbol.decode()?;
//! println!("Decoded: {}", message);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ### Reading a high capacity multi color QR
//!
//! ```rust,no_run
//! use qrism::reader::detect_hc_qr;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Load and prepare image
//! let img = image::open("qr_code.png")?;
//!
//! // Detect and decode QR codes
//! let mut res = detect_hc_qr(&img);
//! if let Some(symbol) = res.symbols().first_mut() {
//! let (metadata, message) = symbol.decode()?;
//! println!("Decoded: {}", message);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ## QR Code Components
//!
//! ### Versions
//! - **Micro QR**: Versions 1-4 for small data (experimental)
//! - **Normal QR**: Versions 1-40, with sizes from 21x21 to 177x177 modules
//!
//! ### Error Correction Levels
//! - **L (Low)**: ~7% error correction
//! - **M (Medium)**: ~15% error correction
//! - **Q (Quartile)**: ~25% error correction
//! - **H (High)**: ~30% error correction
//!
//! ## High Capacity QR Codes
//!
//! High capacity QR codes are an extension of traditional QR codes that achieve **3x the storage capacity**
//! by leveraging color channels for data encoding. Unlike standard monochromatic QR codes that use only black and white modules,
//! high capacity QR codes utilize the full RGB color spectrum.
//!
//! ### How It Works
//!
//! The technology works by **multiplexing three separate QR codes** into a single visual code by
//! encoding one in each of the red, green and blue color channels.
//! Each color channel carries its own independent QR code with full Reed-Solomon error correction.
//! When decoded, the three separate data streams are combined to reconstruct the original data,
//! effectively tripling the storage capacity compared to traditional QR codes.
//!
//! ### Example Usage
//!
//! ```rust
//! use qrism::QRBuilder;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create a high capacity QR code with 3x storage
//! let large_data = "Large dataset that would not fit in a standard QR code...".repeat(10);
//! let qr = QRBuilder::new(large_data.as_bytes())
//! .high_capacity(true) // Enable high capacity mode
//! .build()?;
//!
//! let img = qr.to_image(4);
//! img.save("high_capacity_qr.png")?;
//! # Ok(())
//! # }
//! ```
pub
pub use QRBuilder;
pub use MaskPattern;
pub use ;
pub use *;
pub use *;
pub use Module;