aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2019-12-16 12:56:40 +0100
committerDaniel Schadt <kingdread@gmx.de>2019-12-16 12:56:40 +0100
commit89c2ac305967ba03ef9b704e621ff0ff886ca308 (patch)
tree9100c10a4154bfe211c0d72b170d6857ee010fe8 /src
parent95a7210c3a6bc7a708b6fb8b107156862dcea2cb (diff)
downloadkondou-89c2ac305967ba03ef9b704e621ff0ff886ca308.tar.gz
kondou-89c2ac305967ba03ef9b704e621ff0ff886ca308.tar.bz2
kondou-89c2ac305967ba03ef9b704e621ff0ff886ca308.zip
also use a mask for major trait images
While it doesn't look as ugly if you have a major trait with a thick black border, it still looks a bit off, especially since some of them do come with the proper alpha channel, while others don't. This fix uses the same mask for all major traits now as well, which should make them look more uniform and remove the thick black border.
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;