diff options
Diffstat (limited to 'src/render.rs')
-rw-r--r-- | src/render.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/render.rs b/src/render.rs index fa8e1df..af5d2b2 100644 --- a/src/render.rs +++ b/src/render.rs @@ -210,7 +210,7 @@ impl<'r> Renderer<'r> { let major_img = if !chosen { with_mask(&major_img.grayscale(), &major_img) } else { - major_img.to_rgba() + major_img.to_rgba8() }; let major_img = with_mask(&major_img, &self.major_mask); let (x, y) = self.grid.pos(vertical_pos as u32, 2 * (major.tier - 1) + 1); @@ -278,7 +278,7 @@ impl<'r> Renderer<'r> { self.options.traitline_height, imageops::FilterType::CatmullRom, ) - .to_rgba(); + .to_rgba8(); if self.options.traitline_use_gradient { buffer = brighten_gradient( @@ -414,6 +414,16 @@ where }) } +fn clamp<T: PartialOrd>(value: T , lower: T, upper: T) -> T { + if value < lower { + lower + } else if value > upper { + upper + } else { + value + } +} + fn brighten_gradient<I, P, S>( image: &I, start_x: u32, @@ -425,7 +435,6 @@ where P: Pixel<Subpixel = S> + 'static, S: Primitive + 'static, { - use image::math::utils::clamp; let (width, height) = image.dimensions(); let mut out = ImageBuffer::new(width, height); |