daemon: revert zbus to 1.9.1 in daemon

This commit is contained in:
Luke D Jones
2021-04-07 15:05:26 +12:00
parent 9b4ed6eb62
commit 2af33a0416
18 changed files with 125 additions and 249 deletions

View File

@@ -28,7 +28,7 @@ pub mod error;
// packet data
#[derive(Debug, Clone, Deserialize, Serialize)]
pub enum AniMeSequence {
pub enum AniMeBlock {
/// Full gif sequence. Immutable.
Animation(AniMeGif),
/// Basic image, can have properties changed
@@ -37,15 +37,15 @@ pub enum AniMeSequence {
Pause(Duration),
}
impl AniMeSequence {
pub fn gif(file: &Path, brightness: f32) -> Result<Self, AnimeError> {
impl AniMeBlock {
pub fn asus_gif(file: &Path, brightness: f32) -> Result<Self, AnimeError> {
let frames = AniMeGif::create_diagonal_gif(file, brightness)?;
Ok(Self::Animation(frames))
}
pub fn png(
file: &Path,
scale: Vec2,
scale: f32,
angle: f32,
translation: Vec2,
brightness: f32,
@@ -55,27 +55,34 @@ impl AniMeSequence {
Ok(Self::Image(Box::new(data)))
}
pub fn png_gif(
pub fn image_gif(
file: &Path,
// scale: Vec2,
// angle: f32,
// translation: Vec2,
scale: f32,
angle: f32,
translation: Vec2,
brightness: f32,
) -> Result<Self, AnimeError> {
let frames = AniMeGif::create_png_gif(file, brightness)?;
let frames = AniMeGif::create_png_gif(file, scale, angle, translation, brightness)?;
Ok(Self::Animation(frames))
}
pub fn get_animation(&self) -> Option<&AniMeGif> {
match self {
AniMeSequence::Animation(anim) => Some(anim),
AniMeBlock::Animation(anim) => Some(anim),
_ => None,
}
}
pub fn get_image(&self) -> Option<&AniMeDataBuffer> {
match self {
AniMeSequence::Image(image) => Some(image),
AniMeBlock::Image(image) => Some(image),
_ => None,
}
}
pub fn get_pause(&self) -> Option<Duration> {
match self {
AniMeBlock::Pause(pause) => Some(*pause),
_ => None,
}
}