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(svg-to-pptx): reject unmapped alpha intercepts

hugohe3997db876ff04
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 103d21d3..f38c7db8 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -760,6 +760,7 @@ Filters are native-effect metadata, not a general pixel-filter surface.
| Required primitive | `feDropShadow` or `feGaussianBlur` |
| Required parameters | Explicit `stdDeviation` on either effect primitive; explicit `dx`, `dy`, and `flood-opacity` on `feDropShadow`; explicit `flood-opacity` on `feFlood`; explicit `slope` on linear `feFuncA` |
| Accepted helpers | `feOffset`, `feFlood`, `feComposite`, `feMerge`, `feMergeNode`, `feComponentTransfer`, linear `feFuncA` |
+| Alpha transfer | Linear `feFuncA` maps multiplicative `slope` only; `intercept` is unsupported |
| Numeric values | Finite unitless values; non-negative `stdDeviation`; finite `dx` / `dy`; `feFuncA slope` within `0..1`; mapped glow `rad = stdDeviation × 9525`, shadow `blurRad = stdDeviation × 2 × 9525`, and shadow `dist = hypot(dx,dy) × 9525` must round into DrawingML `0..27273042316900` |
| Classification | Meaningful non-zero offset → one outer shadow; zero/no offset → one glow |
| Fidelity | `Approximate`; one filter becomes one DrawingML effect |
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
index 13ba070a..53b7f918 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
@@ -2005,6 +2005,11 @@ def parse_project_filter_params(
color = parsed_color
color_alpha = parsed_alpha
elif tag == 'feFuncA' and child.get('type') == 'linear':
+ if child.get('intercept') is not None:
+ raise ValueError(
+ '<feFuncA> intercept is unsupported; project alpha '
+ 'transfer maps slope multiplication only'
+ )
slope = required_number(child, 'slope')
transfer_opacity = (
slope
@@ -2165,6 +2170,15 @@ def project_filter_errors(root: ET.Element) -> list[str]:
f'{label} <{primitive_tag}> requires explicit '
'flood-opacity'
)
+ if (
+ primitive_tag == 'feFuncA'
+ and primitive.get('intercept') is not None
+ ):
+ parameters_are_valid = False
+ errors.add(
+ f'{label} <feFuncA> intercept is unsupported; project '
+ 'alpha transfer maps slope multiplication only'
+ )
numeric_attrs: tuple[tuple[str, bool, bool], ...] = ()
if primitive_tag in {'feDropShadow', 'feGaussianBlur'}:
numeric_attrs = (('stdDeviation', True, True),)
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index 6f1be5c4..9f199aac 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2563,6 +2563,25 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
'invalid project filter',
)
+ def test_filter_alpha_transfer_rejects_unmapped_intercept(self):
+ self._assert_checker_and_exporter_reject(
+ '''<svg xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 1280 720">
+ <defs>
+ <filter id="effect">
+ <feGaussianBlur stdDeviation="6"/>
+ <feComponentTransfer>
+ <feFuncA type="linear" slope="0.4" intercept="0.5"/>
+ </feComponentTransfer>
+ </filter>
+ </defs>
+ <rect x="80" y="80" width="300" height="180"
+ fill="#FFFFFF" filter="url(#effect)"/>
+</svg>''',
+ '<feFuncA> intercept is unsupported',
+ 'invalid project filter',
+ )
+
def test_filter_flood_opacity_must_be_explicit(self):
cases = (
(