Repository navigation
Image Markup 2.0.0: document session, highlighter, step numbers, redaction, export - #68
Merged
Merged
Conversation
…ction, export Saving runs on Orca's document session, so Orca owns the unsaved state and saves, and an outside write merges markup onto the new image instead of dropping it. Adds Highlighter, Step number and Redact tools (redactions are burned into the kept original), and Export through Orca's save dialog. Needs Orca 1.4.248.
…stays for older Orca)
- Markup drawn before a redaction is burned into the kept original with it, so no text or stroke under a redaction survives in the saved scene. - Redactions are a flat fill of the area's mean colour, hatched, instead of a reversible mosaic. - EXIF-rotated JPEGs keep their markup and original on reopen. - Markup merged onto a new image during an encode is still sent. - The first edit marks the tab unsaved at once, so closing during an encode asks first. - Step numbers are renumbered after a merge.
- An undo back to the handed-over scene sends that real file again, so a save never writes the stand-in. - The stand-in is the last file with the latest shapes in its markup, marked to be redrawn: if Orca saves it anyway (say, after a view switch mid-encode), it reopens with every shape and is encoded again. - With a redaction in the scene the stand-in is a note only: an orCp PNG chunk, or a JPEG APP9 segment the pixel CRC skips, so the markup stays readable.
- Redaction scenes get the redraw stand-in too, with the last file's own original and no shape drawn before the last redaction; reopening applies the redaction again at once. - Opening a saved stand-in without a redaction no longer dirties the tab; the next edit redraws. - A stand-in note that reached disk is stripped on decode, so later saves don't keep it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Image Markup 2.0.0 moves onto Orca's new editor APIs and adds the tools people mark up screenshots with most: a highlighter, numbered steps, and a real redaction tool. It can also export a copy as a new PNG.
Safe to merge before the Orca release. The catalog lists 2.0.0 (needs Orca 1.4.248) ahead of 1.0.2 and 1.0.0 (1.4.245), and Orca installs the newest release its version can run, so current users keep 1.0.2 until they update Orca.
What the user sees
Before (1.0.2)
After (2.0.0)
H): a wide, see-through stroke. Hold Shift for a straight line along text.N): each click places the next numbered disc. Deleting one renumbers the rest.X): drag over a secret to pixelate it into coarse, noisy tiles. On save the pixels are removed from the visible image and from the original kept inside the file. The redaction is not kept as an editable shape. Until you save you can still move it or undo it.Mechanism
orca.document.session({ decode, encode, merge })in the newbuild/src/document-sync.js. Encoding an image is asynchronous (a full-size render and PNG encode), and the session'sencodemust be synchronous. So the editor encodes first, then callschangewith the finished file, andencodejust hands that file over. The editor also answers Orca's flush itself, so a save right after a stroke waits for that stroke.merge(base, outside, mine)keeps the outside file's image and shapes, adds the shapes this editor drew sincebase, and drops the ones it deleted. Shapes are matched by their saved form. A merge cannot encode, so it carries the outside file plus astaleflag, and the editor encodes it and sends it as its next change. Strokes still waiting for the debounce merge the same way.execCommand('copy')carries text only. So in the desktop app the toolbar shows Export instead of Copy. Copy comes back without a plugin update if Orca allows it.engines.orcais now>=1.4.248, the first release with the document session.Why this approach
encode, but that needs a synchronous PNG encoder, which would block the frame for seconds on large screenshots.Testing
npm testinbuild/: 67 tests pass.document-sync.jsagainst Orca's real session throughmockEditorHost.orca.documentscript, copied from Orca main. It covers an agent rewrite under unsent markup, a conflict merge, a stale edit stopping the save, every new tool, and that the kept original has no unredacted pixels.orca plugin checkpasses.orca plugin testpasses the 33 Node tests; it cannot load the Playwright suite, which importsplaywright-core.orca plugin shot --editor --actdrew every new tool in both themes.scripts/release-entry.mjs,scripts/check-catalog.mjsand the tools tests pass.Known limit
When the tab already has unsaved markup and the file changes on disk, Orca shows its Reload/Overwrite banner instead of calling the editor's merge. Orca's merge path reads the disk as text only, so it does not run for byte editors. Nothing is lost silently: the banner asks.
Risk
Medium: this changes how user images are saved.