Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(pptx-to-svg): saturate alpha modulation in order

hugohe35a0bf2ef0297
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 711acd24..7a51d138 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -780,6 +780,10 @@ Each supported source effect must contain exactly one resolvable DrawingML
color choice. Malformed choices and valid color semantics outside the
registered color/modifier subset also receive effect-status metadata; the
importer never substitutes black or drops an unhandled modifier.
+DrawingML color alpha transforms are evaluated in document order. Each
+`alpha`, `alphaMod`, or `alphaOff` result saturates into `0..100%` before the
+next transform, and the importer writes that effective value to the SVG
+`flood-opacity` channel.
Picture and group targets do not expose the public filter mapping: any source
effect DAG or non-empty effect list on `p:pic/p:spPr` or `p:grpSp/p:grpSpPr`
keeps the base object but receives effect-status metadata instead of attaching
diff --git a/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py b/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py
index dc375035..70b60122 100644
--- a/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py
+++ b/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py
@@ -279,7 +279,7 @@ def _apply_modifiers(hex_color: str, color_elem: ET.Element) -> tuple[str, float
elif tag == "alpha":
alpha = max(0.0, min(1.0, val_ratio))
elif tag == "alphaMod":
- alpha *= val_ratio
+ alpha = max(0.0, min(1.0, alpha * val_ratio))
elif tag == "alphaOff":
alpha = max(0.0, min(1.0, alpha + val_ratio))
elif tag == "gray":
diff --git a/skills/ppt-master/scripts/pptx_to_svg/emu_units.py b/skills/ppt-master/scripts/pptx_to_svg/emu_units.py
index f45036c9..d5c5c681 100644
--- a/skills/ppt-master/scripts/pptx_to_svg/emu_units.py
+++ b/skills/ppt-master/scripts/pptx_to_svg/emu_units.py
@@ -85,7 +85,7 @@ def angle_to_deg(val: float | int | str | None, default: float = 0.0) -> float:
def percent_to_ratio(val: float | int | str | None, default: float = 0.0) -> float:
- """DrawingML positive percent (100000 = 100%) -> ratio in [0, 1]."""
+ """Convert DrawingML percentage units (100000 = 100%) to a ratio."""
if val is None:
return default
try:
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index 011f882e..e772734a 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2723,6 +2723,21 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
round_trip_supported(alpha_glow),
)
+ saturated_alpha = effect_result(
+ f'<a:effectLst xmlns:a="{dml}"><a:glow rad="9525">'
+ '<a:srgbClr val="000000"><a:alphaMod val="200000"/>'
+ '<a:alphaOff val="-50000"/></a:srgbClr>'
+ '</a:glow></a:effectLst>'
+ )
+ self.assertIn(
+ 'flood-opacity="0.5"',
+ ''.join(saturated_alpha.defs),
+ )
+ self.assertIn(
+ '<a:alpha val="50000"/>',
+ round_trip_supported(saturated_alpha),
+ )
+
marked_svg = '''<svg xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 1280 720">
<rect x="80" y="80" width="300" height="180" fill="#FFFFFF"