aboutsummaryrefslogtreecommitdiff
path: root/src/render.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2019-12-08 03:28:13 +0100
committerDaniel Schadt <kingdread@gmx.de>2019-12-08 03:28:13 +0100
commit6c2e7963f2dfc2004857d7f1336fb6cf95c3b3b4 (patch)
treedebe8e8523c8d0d62d53df947c24758138094571 /src/render.rs
parent84dd675977b099b1ff79fe1589007cc8103c07ea (diff)
downloadkondou-6c2e7963f2dfc2004857d7f1336fb6cf95c3b3b4.tar.gz
kondou-6c2e7963f2dfc2004857d7f1336fb6cf95c3b3b4.tar.bz2
kondou-6c2e7963f2dfc2004857d7f1336fb6cf95c3b3b4.zip
use imageproc to draw the rectangle
Doesn't change the outcome but looks better to read
Diffstat (limited to 'src/render.rs')
-rw-r--r--src/render.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/render.rs b/src/render.rs
index 53edd2c..1b15c1c 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -4,10 +4,9 @@ use image::{
imageops, CatmullRom, DynamicImage, GenericImage, GenericImageView, ImageBuffer, Pixel,
Primitive, Rgba, RgbaImage,
};
-use imageproc::drawing;
+use imageproc::{drawing, rect::Rect};
use num_traits::NumCast;
use rusttype::{Font, Scale, SharedBytes};
-use std::cmp::min;
quick_error! {
#[derive(Debug)]
@@ -398,12 +397,8 @@ fn draw_thick_line<I>(
let mut line_buffer: RgbaImage = ImageBuffer::new(line_length, line_length);
let halfway = (line_length - thickness) / 2;
- for i in 0..thickness {
- for x in 0..line_length {
- let y = halfway + i;
- line_buffer.put_pixel(x, y, color);
- }
- }
+ let rect = Rect::at(0, halfway as i32).of_size(line_length, thickness);
+ drawing::draw_filled_rect_mut(&mut line_buffer, rect, color);
line_buffer = imageproc::geometric_transformations::rotate_about_center(
&line_buffer,