raytracer/src/ppm_format.rs

26 lines
516 B
Rust

use core::fmt;
use std::fmt::Display;
/// What does this do?
#[derive(Debug)]
pub enum PpmFormat {
P3,
}
pub struct Header {
pub ppm_format: PpmFormat,
pub width: u32,
pub height: u32,
pub max_color_value: u32,
}
impl Display for Header {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), std::fmt::Error> {
let ret = write!(
f,
"{:?}\n{} {}\n{}\n",
self.ppm_format, self.width, self.height, self.max_color_value
);
ret
}
}