aboutsummaryrefslogtreecommitdiff
path: root/src/render.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2019-12-14 03:23:46 +0100
committerDaniel Schadt <kingdread@gmx.de>2019-12-14 03:23:46 +0100
commit97f2678563e6ca997ea33d7befe38ab2acfa01a9 (patch)
treed0ee757fcc01555362ec4578dafbf946034c0e64 /src/render.rs
parent2aef95f62788163b789fae92b5a6546b2413d9e4 (diff)
downloadkondou-97f2678563e6ca997ea33d7befe38ab2acfa01a9.tar.gz
kondou-97f2678563e6ca997ea33d7befe38ab2acfa01a9.tar.bz2
kondou-97f2678563e6ca997ea33d7befe38ab2acfa01a9.zip
add preliminary support for user configurations
Diffstat (limited to 'src/render.rs')
-rw-r--r--src/render.rs37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/render.rs b/src/render.rs
index cbfd54f..6513cd5 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -7,6 +7,7 @@ use image::{
use imageproc::{drawing, rect::Rect};
use num_traits::{Num, NumCast};
use rusttype::{Font, Scale, SharedBytes};
+use serde::{Deserialize, Serialize};
use std::{error::Error, fmt};
#[derive(Debug)]
@@ -43,7 +44,7 @@ impl Error for RenderError {
}
}
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Alignment {
Left,
Center,
@@ -52,23 +53,23 @@ pub enum Alignment {
#[derive(Debug, Clone)]
pub struct RenderOptions {
- skill_size: u32,
- traitline_height: u32,
- traitline_width: u32,
- traitline_brightness: i32,
- traitline_use_gradient: bool,
- traitline_gradient_size: u32,
- traitline_x_offset: u32,
- trait_size: u32,
- line_color: Rgba<u8>,
- line_height: u32,
- font: Font<'static>,
- text_color: Rgba<u8>,
- text_size: u32,
- background_color: Rgba<u8>,
- render_specialization_names: bool,
- skill_offset: u32,
- skill_alignment: Alignment,
+ pub skill_size: u32,
+ pub traitline_height: u32,
+ pub traitline_width: u32,
+ pub traitline_brightness: i32,
+ pub traitline_use_gradient: bool,
+ pub traitline_gradient_size: u32,
+ pub traitline_x_offset: u32,
+ pub trait_size: u32,
+ pub line_color: Rgba<u8>,
+ pub line_height: u32,
+ pub font: Font<'static>,
+ pub text_color: Rgba<u8>,
+ pub text_size: u32,
+ pub background_color: Rgba<u8>,
+ pub render_specialization_names: bool,
+ pub skill_offset: u32,
+ pub skill_alignment: Alignment,
}
impl Default for RenderOptions {