working on a used text_svg in the presenter
This commit is contained in:
parent
010f9a41d8
commit
342485f9d2
2
justfile
2
justfile
|
@ -6,7 +6,7 @@ default:
|
||||||
build:
|
build:
|
||||||
RUST_LOG=debug cargo build
|
RUST_LOG=debug cargo build
|
||||||
run:
|
run:
|
||||||
RUST_LOG=debug cargo run -- {{ui}} {{file}}
|
RUST_LOG=debug cargo run --release -- {{ui}} {{file}}
|
||||||
clean:
|
clean:
|
||||||
RUST_LOG=debug cargo clean
|
RUST_LOG=debug cargo clean
|
||||||
test:
|
test:
|
||||||
|
|
|
@ -32,7 +32,9 @@ use crate::{
|
||||||
BackgroundKind,
|
BackgroundKind,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::text_svg::{self, shadow, Font as SvgFont, TextSvg};
|
use super::text_svg::{
|
||||||
|
self, shadow, stroke, Font as SvgFont, TextSvg,
|
||||||
|
};
|
||||||
|
|
||||||
const REFERENCE_WIDTH: f32 = 1920.0;
|
const REFERENCE_WIDTH: f32 = 1920.0;
|
||||||
const REFERENCE_HEIGHT: f32 = 1080.0;
|
const REFERENCE_HEIGHT: f32 = 1080.0;
|
||||||
|
@ -547,10 +549,11 @@ pub(crate) fn slide_view<'a>(
|
||||||
let font = SvgFont::from(font).size(font_size.floor() as u8);
|
let font = SvgFont::from(font).size(font_size.floor() as u8);
|
||||||
let slide_text = slide.text();
|
let slide_text = slide.text();
|
||||||
let text = text_svg::TextSvg::new()
|
let text = text_svg::TextSvg::new()
|
||||||
.fill("#fff")
|
|
||||||
.shadow(shadow(10, 10, 5, "#000000"))
|
|
||||||
.font(font)
|
|
||||||
.text(slide_text)
|
.text(slide_text)
|
||||||
|
.fill("#fff")
|
||||||
|
.shadow(shadow(5, 5, 5, "#000000"))
|
||||||
|
.stroke(stroke(4, "#f00"))
|
||||||
|
.font(font)
|
||||||
.view()
|
.view()
|
||||||
.map(|m| Message::None);
|
.map(|m| Message::None);
|
||||||
let text_container = Container::new(text)
|
let text_container = Container::new(text)
|
||||||
|
|
|
@ -11,6 +11,8 @@ use cosmic::{
|
||||||
};
|
};
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
|
use crate::TextAlignment;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq)]
|
#[derive(Clone, Debug, Default, PartialEq)]
|
||||||
pub struct TextSvg {
|
pub struct TextSvg {
|
||||||
text: String,
|
text: String,
|
||||||
|
@ -18,6 +20,7 @@ pub struct TextSvg {
|
||||||
shadow: Option<Shadow>,
|
shadow: Option<Shadow>,
|
||||||
stroke: Option<Stroke>,
|
stroke: Option<Stroke>,
|
||||||
fill: Color,
|
fill: Color,
|
||||||
|
alignment: TextAlignment,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||||
|
@ -175,6 +178,11 @@ impl TextSvg {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn alignment(mut self, alignment: TextAlignment) -> Self {
|
||||||
|
self.alignment = alignment;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn view<'a>(self) -> Element<'a, Message> {
|
pub fn view<'a>(self) -> Element<'a, Message> {
|
||||||
let shadow = if let Some(shadow) = &self.shadow {
|
let shadow = if let Some(shadow) = &self.shadow {
|
||||||
format!("<filter id=\"shadow\"><feDropShadow dx=\"{}\" dy=\"{}\" stdDeviation=\"{}\" flood-color=\"{}\"/></filter>",
|
format!("<filter id=\"shadow\"><feDropShadow dx=\"{}\" dy=\"{}\" stdDeviation=\"{}\" flood-color=\"{}\"/></filter>",
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
(slide :background (image :source "~/pics/frodo.jpg" :fit fill)
|
(slide :background (image :source "~/pics/frodo.jpg" :fit fill)
|
||||||
(text "This is frodo" :font-size 70))
|
(text "This is frodo" :font-size 90))
|
||||||
(slide (video :source "~/vids/test/camprules2024.mp4" :fit contain))
|
(slide (video :source "~/vids/test/camprules2024.mp4" :fit contain))
|
||||||
(slide (video :source "~/vids/The Basics of Hanging Drywall.mkv" :fit contain))
|
(slide (video :source "~/vids/The Basics of Hanging Drywall.mkv" :fit contain))
|
||||||
(slide (video :source "~/vids/Ladybird Is The Future Of Web Browsers.webm" :fit contain))
|
(slide (video :source "~/vids/Ladybird Is The Future Of Web Browsers.webm" :fit contain))
|
||||||
(song :id 7 :author "North Point Worship"
|
(song :id 7 :author "North Point Worship"
|
||||||
:font "Quicksand Bold" :font-size 60
|
:font "Quicksand Bold" :font-size 30
|
||||||
|
:shadow "" :stroke ""
|
||||||
:title "Death Was Arrested"
|
:title "Death Was Arrested"
|
||||||
:background (image :source "file:///home/chris/nc/tfc/openlp/CMG - Bright Mountains 01.jpg" :fit cover)
|
:background (image :source "file:///home/chris/nc/tfc/openlp/CMG - Bright Mountains 01.jpg" :fit cover)
|
||||||
:text-alignment center
|
:text-alignment center
|
||||||
|
|
1
todo.org
1
todo.org
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
* TODO [#A] Text could be built by using SVG instead of the text element. Maybe I could construct my own text element even
|
* TODO [#A] Text could be built by using SVG instead of the text element. Maybe I could construct my own text element even
|
||||||
|
This does almost work. There is a clear amount of lag or rather hang up since switching to the =text_svg= element. I think I may only keep it till I can figure out how to do strokes and shadows in iced's normal text element.
|
||||||
|
|
||||||
* TODO [#A] Need to fix tests now that the basic app is working
|
* TODO [#A] Need to fix tests now that the basic app is working
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue