mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-06 02:21:45 +00:00
fix(edit): a backdrop is only a fill the graphics state paints plain white
Review of #2815 (FredApps): two ways the detector took real content for a page's own white backdrop and replaced it by default. - A `gs` sets only the keys its dictionary has, but each one replaced the whole opacity decision and read every key it left out as its default, so `/Transparent gs /LineOnly gs 1 g ... re f` (ca 0.5, then only a line width) counted as opaque. Fill alpha, soft mask and blend mode are now kept one by one, through `gs` and `q`/`Q`. - A transfer function was never read: TR or TR2 mapping 1 to 0 paints `1 g` black, and the fill was still replaced. The transfer function is tracked too, TR2 over TR in the same dictionary, and only /Identity (and /Default for TR2) counts; anything else leaves the fill alone. Tests: nine graphics states that must keep the fill (each also checks Add Background leaves the content as it was) and nine that still find the backdrop (keys set back, TR2 /Default over a TR function, q/Q restoring), plus an end-to-end render of the reviewer's translucent case under a red background. All the keep cases fail on the code before this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4 files changed
+160
-16
No files matched your search
@@ -2532,7 +2532,7 @@ status = "shipped"
|
||||
commands = ["edit.background"]
|
||||
tools = ["doc_background", "doc_backdrops"]
|
||||
evidence = ["crates/ui-egui/tests/it/marks.rs::watermark_and_background_dialogs", "crates/engine/src/tests.rs::headers_footers_watermarks_and_backgrounds_show_update_and_remove", "crates/engine/src/tests.rs::backgrounds_and_watermarks_from_files", "crates/ui-egui/tests/it/marks.rs::backgrounds_and_watermarks_from_a_file", "crates/organize/src/tests.rs::a_page_becomes_a_form_xobject_upright", "crates/automation/tests/it/backdrop.rs::a_background_shows_on_a_page_that_paints_its_own_white_backdrop", "crates/ui-egui/tests/it/marks.rs::the_background_dialog_offers_to_replace_a_white_backdrop_and_warns_about_scans", "crates/ui-egui/tests/it/marks.rs::the_background_preview_follows_the_replace_checkbox", "crates/edit/src/backdrop_tests.rs::content_that_is_not_a_page_backdrop_is_left_alone", "crates/ui-egui/tests/it/marks.rs::the_preview_shows_the_page_the_range_selects_under_the_marks"]
|
||||
notes = "colour, or a picture from a file (an image or a page of a PDF) scaled relative to the page. A page that paints its own opaque white backdrop (browsers' Save as PDF, print drivers) used to hide the background entirely; the dialog now offers to replace that fill (on by default; Remove turns it back on, after edits and redactions too, unless the operators before it changed or it would no longer be painted first, and then says which pages keep it off). The replaced copy's tag holds no page content or reference, so text a redaction or Remove Hidden Information takes off such a page leaves the file. Our own choice: Acrobat's behaviour on such pages has not been observed. Still hidden: scanned pages (warned), backdrops drawn inside a form XObject, by a non-rectangular path, or in a named colour space. The dialog previews a colour as a tint of the page's own thumbnail (opaque pictures on the page are tinted there too, not in the result), a file as its frame and name; a page that will still hide the background (a scan, or a white backdrop with Replace unticked) previews without the colour"
|
||||
notes = "colour, or a picture from a file (an image or a page of a PDF) scaled relative to the page. A page that paints its own opaque white backdrop (browsers' Save as PDF, print drivers) used to hide the background entirely; the dialog now offers to replace that fill (on by default; Remove turns it back on, after edits and redactions too, unless the operators before it changed or it would no longer be painted first, and then says which pages keep it off). The replaced copy's tag holds no page content or reference, so text a redaction or Remove Hidden Information takes off such a page leaves the file. Our own choice: Acrobat's behaviour on such pages has not been observed. Still hidden: scanned pages (warned), backdrops drawn inside a form XObject, by a non-rectangular path, or in a named colour space, and white fills drawn translucent, through a soft mask, a non-Normal blend mode or a transfer function (TR/TR2) as the graphics state stands after every gs, which are real content and stay. The dialog previews a colour as a tint of the page's own thumbnail (opaque pictures on the page are tinted there too, not in the result), a file as its frame and name; a page that will still hide the background (a scan, or a white backdrop with Replace unticked) previews without the colour"
|
||||
|
||||
[[feature]]
|
||||
id = "edit.background-update-remove"
|
||||
|
||||
Reference in new issue
Block a user