Skip to content

Add markup layers and tools to screenshot editor#777

Merged
multiplex55 merged 9 commits intomasterfrom
codex/refactor-screenshot-editor-for-markup-layers
Feb 1, 2026
Merged

Add markup layers and tools to screenshot editor#777
multiplex55 merged 9 commits intomasterfrom
codex/refactor-screenshot-editor-for-markup-layers

Conversation

@multiplex55
Copy link
Copy Markdown
Owner

Motivation

  • Provide a proper markup model (strokes, rectangles, arrows, highlights) separated from the base image so annotations can be composed, edited, and rendered reliably.
  • Enable freehand pen drawing with an undo/redo workflow and expose common toolbar controls for selecting tools, colors, and thickness.
  • Allow launching the editor already in a markup mode from screenshot commands (e.g. region markup) and ensure markup is applied before cropping when saving/copying.

Description

  • Introduced a MarkupLayer model and supporting types (MarkupStroke, MarkupRect, MarkupArrow, MarkupHistory) and rendering helpers in src/gui/screenshot_editor.rs, including render_markup_layers and simple raster primitives (draw_line, draw_circle, blending).
  • Reworked ScreenshotEditor to store history: MarkupHistory and transient state for active strokes/shape creation, added tool, color_index, and thickness fields, and updated apply_edits() to render markup layers first then apply cropping (src/gui/screenshot_editor.rs).
  • Added an in-editor toolbar for tool selection (pen/arrow/rect/highlight), a 5-color palette, thickness controls (buttons and [/] key handlers) and undo/redo buttons and shortcuts in the editor UI (src/gui/screenshot_editor.rs).
  • Added new screenshot action/command screenshot:region_markup / shot region markup that auto-opens the editor in pen mode and threaded the MarkupTool through launch_editor and open_screenshot_editor (src/plugins/screenshot.rs, src/gui/mod.rs).
  • Exported new types/functions from GUI module (render_markup_layers, Markup* types) and added unit tests exercising rendering and undo/redo behavior (tests/screenshot_plugin.rs).

Testing

  • Ran formatting with cargo fmt which completed successfully.
  • Ran cargo test --test screenshot_plugin to build and run the unit tests added in tests/screenshot_plugin.rs (which include markup_layers_render_on_image and markup_history_undo_redo), but the test run failed during build due to a missing system library when compiling a dependency: alsa-sys reported a missing alsa.pc (pkg-config / ALSA system library), causing the test invocation to abort; tests themselves were added and exercise pixel-level changes and history undo/redo semantics.

Codex Task

multiplex55 and others added 8 commits January 31, 2026 17:17
Replaces the previous text input UI with an in-canvas text editing experience. Introduces an ActiveText struct to manage ephemeral text state, allowing users to click to place text and type directly onto the screenshot. Commits or cancels text on Enter or Escape, and ensures each text instance captures its color and size at creation.
@multiplex55 multiplex55 merged commit e4bb02d into master Feb 1, 2026
1 check failed
@multiplex55 multiplex55 deleted the codex/refactor-screenshot-editor-for-markup-layers branch February 1, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant