added canvas sizes
This commit is contained in:
@@ -18,6 +18,27 @@ impl Color {
|
||||
blue,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn red(&self) -> f32 {
|
||||
self.red
|
||||
}
|
||||
|
||||
pub fn green(&self) -> f32 {
|
||||
self.green
|
||||
}
|
||||
|
||||
pub fn blue(&self) -> f32 {
|
||||
self.blue
|
||||
}
|
||||
|
||||
pub fn ppm_str(&self) -> String {
|
||||
// need to scale 0 - 1 -> 0 - 255
|
||||
let r = (self.red * 255.0) as u8;
|
||||
let g = (self.green * 255.0) as u8;
|
||||
let b = (self.blue * 255.0) as u8;
|
||||
|
||||
format!("{} {} {}", r, g, b)
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for Color {
|
||||
|
||||
Reference in New Issue
Block a user