Skip to content

fix(preview): render EMF artwork and order gradient stops - #299

Merged
baseballyama merged 5 commits into
mainfrom
fix/preview-emf-artwork-gradient
Sep 12, 2026
Merged

baseballyama merged 5 commits into
mainfrom
fix/preview-emf-artwork-gradient

Conversation

@baseballyama

Copy link
Copy Markdown
Collaborator

Summary

Restore EMF vector artwork in imported slide previews and render gradient stops in position order. A closing slide with a skyline now shows its transparent white artwork over a smooth blue background instead of an image placeholder and a horizontal color seam.

Motivation

A user reported the discrepancy between PowerPoint and the preview and supplied a reproduction file directly, so there is no separate issue. The file uses an EMF image and gradient stops serialized in the order 52%, 0%, 100%. The private presentation is not included; regression fixtures are generated in the tests.

Changes

  • Render supported EMF solid-filled line and Bézier paths as transparent SVG, including window/viewport transforms and clipping. Unsupported drawing records, EMF+ content, and malformed input retain the image fallback.
  • Sort linear and radial gradient stops without mutating the source presentation.
  • Document the supported EMF subset and add a patch changeset for the preview package. No dependencies or public exports are added.

Testing

  • pnpm exec vitest run test/preview-imported-artwork.test.ts test/preview-effects-fills.test.ts test/preview-node-raster.test.ts: 33 tests passed.
  • Rendered the supplied presentation before and after the change and visually checked the final slide's skyline and background. The reproduction file and rendered images remain local.
  • New tests cover transparent SVG/Node raster output, unordered linear/radial stops, signed 16-bit paths, clipping/transforms, buffer offsets, malformed records, and unsupported content.
  • Full static checks, build, and the remaining test suite run in CI.

Breaking changes

None

Checklist

  • I have read CLAUDE.md and followed the project's conventions.
  • I have added or updated tests for the change.
  • I have added or updated documentation where user-visible behavior changed.
  • If this is a breaking change, I have added a changeset / CHANGELOG entry and flagged it above.
  • I have re-read my own diff and removed dead code, debug prints, and stale comments.
  • If I used an LLM to draft this PR, I have verified each change myself, this PR represents real work that warrants a maintainer's review, and I am willing to defend each line in review.

@baseballyama
baseballyama marked this pull request as ready for review September 12, 2026 15:15
@baseballyama
baseballyama merged commit f89ac2b into main Sep 12, 2026
8 checks passed
@baseballyama
baseballyama deleted the fix/preview-emf-artwork-gradient branch September 12, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant