diff options
Diffstat (limited to 'src/render.rs')
-rw-r--r-- | src/render.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/render.rs b/src/render.rs index e3f2d31..cbfd54f 100644 --- a/src/render.rs +++ b/src/render.rs @@ -135,9 +135,10 @@ impl<'r> Renderer<'r> { } pub fn render_skills(&mut self, skills: &[Option<Skill>]) -> Result<RgbaImage, RenderError> { - let mut buffer = ImageBuffer::new( + let mut buffer = ImageBuffer::from_pixel( skills.len() as u32 * self.options.skill_size, self.options.skill_size, + self.options.background_color, ); for (i, skill) in skills.iter().enumerate() { if let Some(skill) = skill { @@ -294,7 +295,11 @@ impl<'r> Renderer<'r> { specialization: &Specialization, ) -> Result<RgbaImage, RenderError> { let scale = self.options.text_size; - let mut buffer = ImageBuffer::new(self.options.traitline_width, scale); + let mut buffer = ImageBuffer::from_pixel( + self.options.traitline_width, + scale, + self.options.background_color, + ); drawing::draw_text_mut( &mut buffer, self.options.text_color, @@ -367,7 +372,7 @@ impl<'r> Renderer<'r> { Alignment::Center => half(width - image.width()), Alignment::Right => width - image.width(), }; - imageops::overlay(&mut buffer, image, pos_x, pos_y); + buffer.copy_from(image, pos_x, pos_y); pos_y += image.height(); } |