add readme
This commit is contained in:
parent
a5cf8679c3
commit
e54cf8a1bd
@ -4,8 +4,8 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
egui = { version = "0.29.1", default-features = false }
|
egui = { version = "0.29.0", default-features = false }
|
||||||
qrcode = { version = "0.14.1", default-features = false }
|
qrcode = { version = "0.14.1", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
eframe = "0.29.1"
|
eframe = "0.29.0"
|
10
README.md
Normal file
10
README.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# egui_qr
|
||||||
|
|
||||||
|
Simple egui painter that renders QR Codes
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```rust
|
||||||
|
QrCodeWidget::from_data(b"https://google.com")?
|
||||||
|
.ui(ui);
|
||||||
|
```
|
@ -6,7 +6,7 @@ fn main() {
|
|||||||
let _ = eframe::run_native(
|
let _ = eframe::run_native(
|
||||||
"egui_qr",
|
"egui_qr",
|
||||||
NativeOptions::default(),
|
NativeOptions::default(),
|
||||||
Box::new(|_| Box::new(App::new())),
|
Box::new(|_| Ok(Box::new(App::new()))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,12 +40,7 @@ impl Widget for QrCodeWidget<'_> {
|
|||||||
let (response, painter) =
|
let (response, painter) =
|
||||||
ui.allocate_painter(vec2(w as f32 * scale, w as f32 * scale), Sense::click());
|
ui.allocate_painter(vec2(w as f32 * scale, w as f32 * scale), Sense::click());
|
||||||
|
|
||||||
painter.rect(
|
painter.rect(response.rect, Rounding::ZERO, Color32::WHITE, Stroke::NONE);
|
||||||
response.rect,
|
|
||||||
Rounding::ZERO,
|
|
||||||
Color32::WHITE,
|
|
||||||
Stroke::NONE,
|
|
||||||
);
|
|
||||||
let mut ctr = 0;
|
let mut ctr = 0;
|
||||||
for c in code_ref.to_colors() {
|
for c in code_ref.to_colors() {
|
||||||
let row = ctr / w;
|
let row = ctr / w;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user