diff --git a/cowgen/src/lib.rs b/cowgen/src/lib.rs index e439e37..53c0967 100644 --- a/cowgen/src/lib.rs +++ b/cowgen/src/lib.rs @@ -1,13 +1,12 @@ use ril::prelude::*; -use std::path::Path; -pub struct Generate, V: AsRef> { - elements: Vec>, +pub struct Generate { + elements: Vec, base: Image, } -impl, V: AsRef> Generate { - pub fn new(base: Vec, elements: Vec>) -> Result { +impl Generate { + pub fn new(base: Vec, elements: Vec) -> Result { Ok(Self { base: Image::::from_bytes_inferred(&base)?, elements, @@ -38,14 +37,14 @@ impl, V: AsRef> Generate { } } -pub struct Element, V: AsRef> { +pub struct Element { position: (i32, i32), dimensions: (u32, u32), - media: Media, + media: Media, } -impl, V: AsRef> Element { - pub fn new(media: Media, position: (i32, i32), dimensions: (u32, u32)) -> Self { +impl Element { + pub fn new(media: Media, position: (i32, i32), dimensions: (u32, u32)) -> Self { Self { position, dimensions, @@ -67,7 +66,7 @@ impl, V: AsRef> Element { ) .with( &TextSegment::new( - &Font::open(text.font, 12.0).unwrap(), + &Font::from_bytes(&text.font, 12.0).unwrap(), text.text, Dynamic::Rgba(Rgba::new( text.fill.0, @@ -82,20 +81,20 @@ impl, V: AsRef> Element { } } -pub enum Media, V: AsRef> { - Text(Text), +pub enum Media { + Text(Text), Image(Vec), } -pub struct Text, V: AsRef> { - text: T, - font: V, +pub struct Text { + text: String, + font: Box>, size: f32, fill: (u8, u8, u8, u8), } -impl, V: AsRef> Text { - pub fn new(text: T, font: V, size: f32, fill: (u8, u8, u8, u8)) -> Self { +impl Text { + pub fn new(text: String, font: Box>, size: f32, fill: (u8, u8, u8, u8)) -> Self { Self { text, font,