aboutsummaryrefslogtreecommitdiff
path: root/evc/src/bin/encode.rs
blob: 109083193ac86b4b4c5317410e760bfac7a5e404 (plain)
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
use clap::Parser;
use evc::{pixel::Pixel, ser::Source};
use std::io::{self, BufReader};

#[derive(Parser)]
#[clap(about, version)]
pub struct EncodeArgs {
    #[arg(short = 'W', long)]
    width: usize,
    #[arg(short = 'H', long)]
    height: usize,
}

fn main() -> io::Result<()> {
    let args = EncodeArgs::parse();

    let mut input = BufReader::new(std::io::stdin());

    loop {
        for x in 0..args.width {
            for y in 0..args.height {
                let pixel = input.get::<Pixel>()?;
                println!("P({x}|{y}) = {pixel:?}")
            }
        }
    }

    Ok(())
}