Use shared IDML effect setting writers

This commit is contained in:
Dylan M. Taylor committed 2026-11-13 09:40:28 -05:00
1 parent 703ffed779
commit b409bccb0f
3 files changed
+43 -39

No files matched your search

Generated
+19 -19
View File
@@ -1242,10 +1242,10 @@ dependencies = [
[[package]]
name = "craft-idml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=9ba88911e#9ba88911e41b58df324f750a2962bd6ddd284e36"
source = "git+https://github.com/storytold/craft-libs?rev=5ca720669#5ca720669312d6c8c944efb866d3ab90e7807327"
dependencies = [
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9ba88911e)",
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9ba88911e)",
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ca720669)",
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ca720669)",
"thiserror 2.0.21",
]
@@ -1656,7 +1656,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551#8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551"
source = "git+https://github.com/storytold/craft-libs?rev=5ca720669#5ca720669312d6c8c944efb866d3ab90e7807327"
dependencies = [
"quick-xml 0.41.0",
"thiserror 2.0.21",
@@ -1665,7 +1665,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=9ba88911e#9ba88911e41b58df324f750a2962bd6ddd284e36"
source = "git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551#8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551"
dependencies = [
"quick-xml 0.41.0",
"thiserror 2.0.21",
@@ -1717,6 +1717,16 @@ dependencies = [
"thiserror 2.0.21",
]
[[package]]
name = "craft-zip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5ca720669#5ca720669312d6c8c944efb866d3ab90e7807327"
dependencies = [
"flate2",
"thiserror 2.0.21",
"zip 9.1.1",
]
[[package]]
name = "craft-zip"
version = "0.1.0"
@@ -1737,16 +1747,6 @@ dependencies = [
"zip 9.1.1",
]
[[package]]
name = "craft-zip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=9ba88911e#9ba88911e41b58df324f750a2962bd6ddd284e36"
dependencies = [
"flate2",
"thiserror 2.0.21",
"zip 9.1.1",
]
[[package]]
name = "craft-zip"
version = "0.1.0"
@@ -2021,7 +2021,7 @@ dependencies = [
"craft-prepress",
"craft-print",
"craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)",
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9ba88911e)",
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ca720669)",
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f23b0f33f0d00b157476533a43cbbcfd901aa1f1)",
"designcraft-color",
"designcraft-compose",
@@ -2103,9 +2103,9 @@ name = "designcraft-idml"
version = "0.20.1"
dependencies = [
"craft-file-formats",
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9ba88911e)",
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ca720669)",
"craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)",
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9ba88911e)",
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ca720669)",
"designcraft-color",
"designcraft-compose",
"designcraft-doc",
@@ -2222,7 +2222,7 @@ version = "0.20.1"
dependencies = [
"craft-docx",
"craft-file-formats",
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9ba88911e)",
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5ca720669)",
"craft-rtf",
"craft-wordmodel",
"craft-xlsx",
+2 -2
View File
@@ -16,10 +16,10 @@ craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4052591363
craft-designcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "93d0998383aa150fa50a2ffbf49ef37786e37eca", version = "=0.1.0" }
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" }
craft-epub = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" }
craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "9ba88911e", version = "=0.1.0" }
craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "5ca720669", version = "=0.1.0" }
craft-indd = { git = "https://github.com/storytold/craft-libs", rev = "47bf5650b0d503b97bfb5e841746c4957897d11f", version = "=0.1.0" }
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "cc23ffd4d26f3074808e2187d332564817624f8f", version = "=0.1.0", features = ["tree-render", "tree-text"] }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "9ba88911e", version = "=0.1.0" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "5ca720669", version = "=0.1.0" }
craft-xml-dtd = { package = "craft-xml", git = "https://github.com/storytold/craft-libs", rev = "f23b0f33f0d00b157476533a43cbbcfd901aa1f1", version = "=0.1.0" }
craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" }
craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" }
+22 -18
View File
@@ -206,17 +206,19 @@ impl<'a> Ex<'a> {
let ds = &e.drop_shadow;
if ds.on || all {
let a = self.d.light_angle(ds.angle, ds.global_light).to_radians();
out.push(
El::new("DropShadowSetting")
.attr("Mode", if ds.on { "Drop" } else { "None" })
.attr("XOffset", num(-ds.distance * a.cos()))
.attr("YOffset", num(ds.distance * a.sin()))
.attr("Size", num(ds.size))
.attr("Spread", num(ds.spread))
.attr("Opacity", pct(ds.opacity as f64))
.attr("BlendMode", names::blend_out(ds.mode))
.attr("EffectColor", self.sw(&ds.color)),
);
out.push(crate::xml::from_craft(
craft_idml::model::DropShadowValues {
mode: Some(if ds.on { "Drop" } else { "None" }.into()),
x_offset: Some(-ds.distance * a.cos()),
y_offset: Some(ds.distance * a.sin()),
color: Some(self.sw(&ds.color)),
opacity: Some(f64::from(ds.opacity) * 100.0),
size: Some(ds.size),
spread: Some(ds.spread),
blend_mode: Some(names::blend_out(ds.mode).into()),
}
.to_el(),
));
}
if e.feather > 0.0 || all {
let corners = match e.feather_options.corners {
@@ -224,13 +226,15 @@ impl<'a> Ex<'a> {
designcraft_doc::FeatherCorners::Rounded => "Rounded",
designcraft_doc::FeatherCorners::Diffused => "Diffusion",
};
out.push(
El::new("FeatherSetting")
.attr("Mode", if e.feather > 0.0 { "Standard" } else { "None" })
.attr("Width", num(e.feather))
.attr("ChokeAmount", num(e.feather_options.choke))
.attr("CornerType", corners),
);
out.push(crate::xml::from_craft(
craft_idml::model::FeatherValues {
mode: Some(if e.feather > 0.0 { "Standard" } else { "None" }.into()),
width: Some(e.feather),
choke_amount: Some(e.feather_options.choke),
corner_type: Some(corners.into()),
}
.to_el(),
));
}
out
}