aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/major_trait_mask.pngbin0 -> 3058 bytes
-rw-r--r--src/render.rs8
2 files changed, 7 insertions, 1 deletions
diff --git a/src/major_trait_mask.png b/src/major_trait_mask.png
new file mode 100644
index 0000000..1b9abf2
--- /dev/null
+++ b/src/major_trait_mask.png
Binary files differ
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;