mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-14 22:42:46 +00:00
Model IDML ink manager entries
This commit is contained in:
2 files changed
+27
-2
No files matched your search
@@ -19,8 +19,8 @@ mod story;
|
||||
|
||||
pub use geometry::{MAX_PATH_POINTS, PathGeometry, PathGeometryError, PathPoint, SubPath};
|
||||
pub use resources::{
|
||||
ColorGroup, ColorSpace, GradientStop, GradientStopValue, StrokeStyle, StrokeStyleKind, Style, StyleGroup, StyleKind, StyleNode, Swatch,
|
||||
SwatchKind, color_groups, named, preference, stroke_styles, style_groups, swatches,
|
||||
ColorGroup, ColorSpace, GradientStop, GradientStopValue, Ink, StrokeStyle, StrokeStyleKind, Style, StyleGroup, StyleKind, StyleNode, Swatch,
|
||||
SwatchKind, color_groups, inks, named, preference, stroke_styles, style_groups, swatches,
|
||||
};
|
||||
pub use spread::{Graphic, GraphicChild, GraphicKind, Guide, ItemChild, ItemKind, Link, Page, PageChild, PageItem, Spread, SpreadChild, spreads};
|
||||
pub use story::{Ace, CONTAINERS, Cell, Container, ContentPart, Range, Story, Table, TableChild, TextNode, stories};
|
||||
|
||||
@@ -388,6 +388,31 @@ pub struct ColorGroup {
|
||||
pub rest: Vec<El>,
|
||||
}
|
||||
|
||||
/// An Ink Manager entry, preserving its source values.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Ink {
|
||||
pub values: Values,
|
||||
}
|
||||
|
||||
impl Ink {
|
||||
pub fn name(&self) -> Option<&str> {
|
||||
self.values.name()
|
||||
}
|
||||
|
||||
pub fn convert_to_process(&self) -> bool {
|
||||
self.values.get("ConvertToProcess") == Some("true")
|
||||
}
|
||||
|
||||
pub fn alias(&self) -> Option<&str> {
|
||||
self.values.get("AliasInkName")
|
||||
}
|
||||
}
|
||||
|
||||
/// Ink Manager entries among the document's top-level elements.
|
||||
pub fn inks(top: &[El]) -> Vec<Ink> {
|
||||
top.iter().filter(|el| el.local() == "Ink").map(|el| Ink { values: Values::of(el) }).collect()
|
||||
}
|
||||
|
||||
impl ColorGroup {
|
||||
pub fn to_el(&self) -> El {
|
||||
let mut el = self.values.element("ColorGroup");
|
||||
|
||||
Reference in new issue
Block a user