diff options
Diffstat (limited to 'src/render.rs')
-rw-r--r-- | src/render.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/render.rs b/src/render.rs index cbfd54f..7b796e1 100644 --- a/src/render.rs +++ b/src/render.rs @@ -119,18 +119,23 @@ pub struct Renderer<'r> { api: &'r mut Api, options: RenderOptions, minor_mask: DynamicImage, + major_mask: DynamicImage, } impl<'r> Renderer<'r> { /// Create a new renderer using the given API. pub fn new(api: &mut Api, options: RenderOptions) -> Renderer<'_> { let minor_mask = image::load_from_memory(include_bytes!("minor_trait_mask.png")) - .expect("Mask image could not be loaded") + .expect("Minor mask image could not be loaded") + .resize(options.trait_size, options.trait_size, CatmullRom); + let major_mask = image::load_from_memory(include_bytes!("major_trait_mask.png")) + .expect("Major mask image could not be loaded") .resize(options.trait_size, options.trait_size, CatmullRom); Renderer { api, options, minor_mask, + major_mask, } } @@ -190,6 +195,7 @@ impl<'r> Renderer<'r> { } else { major_img.to_rgba() }; + let major_img = with_mask(&major_img, &self.major_mask); let y_slice = buffer.height() / TRAITS_PER_TIER; let y_pos = vertical_pos as u32 * y_slice + half(y_slice - major_img.height()); let x_slice = (buffer.width() - self.options.traitline_x_offset) / TOTAL_COLUMN_COUNT; |