trying to figure out a more performant way to do svgs
Some checks failed
/ test (push) Has been cancelled
Some checks failed
/ test (push) Has been cancelled
This commit is contained in:
parent
5f3d867ad7
commit
1446e35c58
5 changed files with 208 additions and 78 deletions
|
@ -6,6 +6,7 @@ use std::sync::Arc;
|
|||
use cosmic::iced::clipboard::mime::{AllowedMimeTypes, AsMimeTypes};
|
||||
use crisp::types::{Keyword, Symbol, Value};
|
||||
use miette::Result;
|
||||
use resvg::usvg::fontdb;
|
||||
use tracing::{debug, error};
|
||||
|
||||
use crate::Slide;
|
||||
|
@ -17,7 +18,7 @@ use super::videos::Video;
|
|||
|
||||
use super::kinds::ServiceItemKind;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct ServiceItem {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
use crisp::types::{Keyword, Symbol, Value};
|
||||
use iced_video_player::Video;
|
||||
use miette::{miette, Result};
|
||||
use resvg::usvg::fontdb;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
fmt::Display,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
use tracing::error;
|
||||
|
||||
|
@ -13,6 +15,40 @@ use crate::ui::text_svg::{self, TextSvg};
|
|||
|
||||
use super::songs::Song;
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, Default, PartialEq, Serialize, Deserialize,
|
||||
)]
|
||||
pub struct Slide {
|
||||
id: i32,
|
||||
background: Background,
|
||||
text: String,
|
||||
font: String,
|
||||
font_size: i32,
|
||||
text_alignment: TextAlignment,
|
||||
audio: Option<PathBuf>,
|
||||
video_loop: bool,
|
||||
video_start_time: f32,
|
||||
video_end_time: f32,
|
||||
#[serde(skip)]
|
||||
pub text_svg: TextSvg,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize,
|
||||
)]
|
||||
pub enum BackgroundKind {
|
||||
#[default]
|
||||
Image,
|
||||
Video,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
struct Image {
|
||||
pub source: String,
|
||||
pub fit: String,
|
||||
pub children: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
|
@ -203,15 +239,6 @@ impl Display for ParseError {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize,
|
||||
)]
|
||||
pub enum BackgroundKind {
|
||||
#[default]
|
||||
Image,
|
||||
Video,
|
||||
}
|
||||
|
||||
impl From<String> for BackgroundKind {
|
||||
fn from(value: String) -> Self {
|
||||
if value == "image" {
|
||||
|
@ -222,24 +249,6 @@ impl From<String> for BackgroundKind {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, Default, PartialEq, Serialize, Deserialize,
|
||||
)]
|
||||
pub struct Slide {
|
||||
id: i32,
|
||||
background: Background,
|
||||
text: String,
|
||||
font: String,
|
||||
font_size: i32,
|
||||
text_alignment: TextAlignment,
|
||||
audio: Option<PathBuf>,
|
||||
video_loop: bool,
|
||||
video_start_time: f32,
|
||||
video_end_time: f32,
|
||||
#[serde(skip)]
|
||||
pub text_svg: TextSvg,
|
||||
}
|
||||
|
||||
impl From<&Slide> for Value {
|
||||
fn from(value: &Slide) -> Self {
|
||||
Self::List(vec![Self::Symbol(Symbol("slide".into()))])
|
||||
|
@ -656,13 +665,6 @@ impl SlideBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
struct Image {
|
||||
pub source: String,
|
||||
pub fit: String,
|
||||
pub children: Vec<String>,
|
||||
}
|
||||
|
||||
impl Image {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue