mirror of
https://github.com/elladunbar/to-braille.git
synced 2025-11-07 04:09:54 -06:00
Initial commit
This commit is contained in:
commit
75475eaad0
4 changed files with 433 additions and 0 deletions
37
src/main.rs
Normal file
37
src/main.rs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
use crossterm::terminal::size;
|
||||
const BRAILLE: [[&str; 16]; 4] = [
|
||||
[
|
||||
// U+280x
|
||||
"⠀", "⠁", "⠂", "⠃", "⠄", "⠅", "⠆", "⠇", "⠈", "⠉", "⠊", "⠋", "⠌", "⠍", "⠎", "⠏",
|
||||
],
|
||||
[
|
||||
// U+281x
|
||||
"⠐", "⠑", "⠒", "⠓", "⠔", "⠕", "⠖", "⠗", "⠘", "⠙", "⠚", "⠛", "⠜", "⠝", "⠞", "⠟",
|
||||
],
|
||||
[
|
||||
// U+282x
|
||||
"⠠", "⠡", "⠢", "⠣", "⠤", "⠥", "⠦", "⠧", "⠨", "⠩", "⠪", "⠫", "⠬", "⠭", "⠮", "⠯",
|
||||
],
|
||||
[
|
||||
// U+283x
|
||||
"⠰", "⠱", "⠲", "⠳", "⠴", "⠵", "⠶", "⠷", "⠸", "⠹", "⠺", "⠻", "⠼", "⠽", "⠾", "⠿",
|
||||
],
|
||||
];
|
||||
|
||||
// picture needs to end up as multiple of 2 x multiple of 3
|
||||
// also should fit in current terminal size
|
||||
fn calculate_size() {
|
||||
let pic_size = (1920, 1280);
|
||||
let term_size = size().unwrap();
|
||||
|
||||
let pic_landscape = pic_size.0 >= pic_size.1;
|
||||
if pic_landscape {
|
||||
let scale_factor = pic_size.0 / term_size.0;
|
||||
} else {
|
||||
let scale_factor = pic_size.1 / term_size.1;
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{:?}", size());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue