Skip to content
Snippets Groups Projects
Verified Commit df5b57cc authored by Louis's avatar Louis :fire:
Browse files

Remove redundant utils

parent e30bbbb6
No related branches found
No related tags found
No related merge requests found
......@@ -27,22 +27,6 @@ pub type TypedOutputFormat<T: GenericImage> =
image::ImageBuffer<T::Pixel, Vec<<T::Pixel as image::Pixel>::Subpixel>>;
pub type RgbaOutputFormat = TypedOutputFormat<RgbaImage>;
pub fn max_f32(a: f32, b: f32) -> f32 {
if a > b {
a
} else {
b
}
}
pub fn min_f32(a: f32, b: f32) -> f32 {
if a < b {
a
} else {
b
}
}
pub fn new_image(new_width: u32, new_height: u32) -> OutputFormat {
let mut new_image = RgbaImage::new(new_width, new_height);
let (new_image_x, new_image_y, new_image_width, new_image_height) = new_image.bounds();
......@@ -68,8 +52,8 @@ impl BasicRgba {
let green = self.g as f32 / u8::MAX as f32;
let blue = self.b as f32 / u8::MAX as f32;
let minimum = min_f32(red, min_f32(green, blue));
let maximum = max_f32(red, max_f32(green, blue));
let minimum = red.min(green).min(blue);
let maximum = red.max(green).max(blue);
let mut hue = if red >= green && red >= blue {
(green - blue) / (maximum - minimum)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment