mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-16 23:42:27 +00:00
Merge branch 'codex/xfl-shape-hints' of https://github.com/storytold/craft-libs into codex/xfl-frame-sound
This commit is contained in:
commit
325354218a
1 file changed
+1
-13
@@ -3,7 +3,7 @@
|
||||
//! This module parses the wire-level filter names, fields, and gradient-ramp entries. Consumers
|
||||
//! remain responsible for mapping those values into their own rendering/filter models.
|
||||
|
||||
use crate::shape::{self, Color, XflElement};
|
||||
use crate::shape::{self, Color, XflElement, boolean, integer, number};
|
||||
|
||||
/// Native filter variants understood by XFL.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
@@ -173,18 +173,6 @@ impl<'a, E: XflElement> RampEntry<'a, E> {
|
||||
}
|
||||
}
|
||||
|
||||
fn number(element: &impl XflElement, name: &str) -> Option<f32> {
|
||||
element.attr(name)?.trim().parse::<f32>().ok().filter(|value| value.is_finite())
|
||||
}
|
||||
|
||||
fn integer(element: &impl XflElement, name: &str) -> Option<u32> {
|
||||
element.attr(name)?.trim().parse::<u32>().ok()
|
||||
}
|
||||
|
||||
fn boolean(element: &impl XflElement, name: &str) -> Option<bool> {
|
||||
element.attr(name).map(|value| value.trim() == "true")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in new issue
Block a user