mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
* Rework Gradient into a newtype of List<Color> with optional position and midpoint attributes * Fix Vello stopless-gradient fallback coverage, empty legacy gradient tables, the node docs gradient swatch, NaN position elision, and wired setter input overwrites
31 lines
776 B
Rust
31 lines
776 B
Rust
pub mod brush;
|
|
mod brush_cache;
|
|
pub mod brush_stroke;
|
|
|
|
pub mod migrations {
|
|
use crate::brush_stroke::BrushStroke;
|
|
|
|
// TODO: Eventually remove this document upgrade code
|
|
pub fn migrate_to_brush_strokes<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<Vec<BrushStroke>, D::Error> {
|
|
use serde::Deserialize;
|
|
|
|
#[derive(serde::Deserialize)]
|
|
struct LegacyTable {
|
|
#[serde(alias = "instances", alias = "instance")]
|
|
element: Vec<BrushStroke>,
|
|
}
|
|
|
|
#[derive(serde::Deserialize)]
|
|
#[serde(untagged)]
|
|
enum BrushStrokesFormat {
|
|
Strokes(Vec<BrushStroke>),
|
|
List(LegacyTable),
|
|
}
|
|
|
|
Ok(match BrushStrokesFormat::deserialize(deserializer)? {
|
|
BrushStrokesFormat::Strokes(strokes) => strokes,
|
|
BrushStrokesFormat::List(list) => list.element,
|
|
})
|
|
}
|
|
}
|