mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-09 11:50:20 -06:00
Ported from #3001 by hand onto current main. Design > Watermark > Custom Watermark gains No watermark / Picture watermark (Select Picture, Scale Auto or a percentage, Washout) / Text watermark. The picture is drawn centred behind the text on screen and in PDF; DOCX saves Word's VML picture watermark in every header and reads Word's back when every page shows the same one. Changed vs the PR: - Mirror margins: the picture is centred in the page's own text area (`page.body`, as the text watermark), the same rect on screen and in PDF. - Auto size is one answer: the room of the first section naming the page's header (`Document::watermark_fit`), used by screen, PDF and DOCX. - Washout goes through the picture-corrections path (`WatermarkPicture::fx()` = PicFx::from_vml gain/blacklevel, `media::pixmap_for` / `Exporter::image`); the PR's washout()/4096 px resize copies are gone, so memory is that of any picture. The reader detects Washout from gain/blacklevel with PicFx. - ODT writes the picture (a frame, `draw:color-mode="watermark"`) and reads it back, instead of writing the watermark's text. - A watermark in a tracked deletion is not the document's (text and picture). - `design.watermark` checks base64 length before decoding, caps pictures at 64 MB, reads files through read_file_capped (wasm stub added), validates before touching the document. - The dialog lives in dialogs/dialogs_watermark.rs; strings stay English. Co-Authored-By: C00kieMonsta <22135261+C00kieMonsta@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FypgCVCCEo7u5wetHaJRU4