Screenshot editor: annotate, blur, pixelate, redact and crop before saving
CI / test (push) Canceled after 12m58s
CI / test (push) Canceled after 12m58s
Every screenshot now opens in an editor after KDE Spectacle's annotation mode: Arrow, Line, Rectangle, Ellipse, Pen, Highlighter, Text, Number markers, Blur, Pixelate, Redact and Crop, 8 colours, 3 sizes, undo/redo. Enter saves and copies, Ctrl+C copies only, Esc discards. - Drawn by the compositor (shot_editor.mbt), keyboard owned by it while up. - Annotations are drawn into the picture's pixels at full size (annotate.mbt), so what is shown is what is saved. Blur = 6x6 block average + 3 box-blur passes; redact is opaque; both touch only their box (pixel tests). - The picture goes to the renderer as <=2 MB strips: one 8 MB image-pixels call exhausts wasmtime's hostcall fuel and killed the wasm host. - Frame callbacks are held while the overlay/editor freeze the screen, so apps behind stop drawing (0% CPU vs 52% with a full-screen animating app). - wasmhost: error buffer 16 KB so trap causes aren't cut off; image-pixels limit 1024 -> 16384 a side (both hosts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hh3TaFJh7nhCxAjV4Q
This commit is contained in:
14 files changed
+2127
-67
No files matched your search
@@ -249,6 +249,13 @@ pub(all) struct ChandraCompositor {
|
||||
shot_frozen : Map[UInt64, @scene.ShmBufferSnapshot]
|
||||
mut shot_dir : String
|
||||
mut last_shot : String
|
||||
/// The screenshot editor (shot_editor.mbt) while it is up, the image handles its picture is
|
||||
/// shown under, a strip each (kept for the next one), and the tool, colour and size it was left with.
|
||||
mut shot_edit : ShotEditor?
|
||||
shot_edit_images : Array[UInt]
|
||||
mut shot_edit_tool : Tool
|
||||
mut shot_edit_color : Int
|
||||
mut shot_edit_size : Int
|
||||
/// Reads the screen for screenshots when the host draws it (the wasm compositor sets it);
|
||||
/// None uses the software renderer's last frame.
|
||||
mut frame_source : (() -> @renderer.Pixmap?)?
|
||||
@@ -412,6 +419,11 @@ pub fn ChandraCompositor::new(
|
||||
shot_frozen: {},
|
||||
shot_dir: "",
|
||||
last_shot: "",
|
||||
shot_edit: None,
|
||||
shot_edit_images: [],
|
||||
shot_edit_tool: Tool::Arrow,
|
||||
shot_edit_color: 0,
|
||||
shot_edit_size: 1,
|
||||
frame_source: None,
|
||||
frame_recorder: None,
|
||||
frame_shots: None,
|
||||
@@ -663,8 +675,8 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
Some(win) => {
|
||||
match snap {
|
||||
Some(s) =>
|
||||
if self.shot is Some(_) {
|
||||
// The screen is frozen under the screenshot overlay: show it afterwards.
|
||||
if self.shot is Some(_) || self.shot_edit is Some(_) {
|
||||
// The screen is frozen under the screenshot overlay and editor: show it afterwards.
|
||||
release_snapshot(self.shot_frozen.get(wid))
|
||||
self.shot_frozen.set(wid, s)
|
||||
} else {
|
||||
@@ -2329,6 +2341,10 @@ pub fn ChandraCompositor::desired_cursor(self : ChandraCompositor) -> UInt {
|
||||
Some(o) => return self.overlay_cursor(o)
|
||||
None => ()
|
||||
}
|
||||
match self.shot_edit {
|
||||
Some(e) => return self.editor_cursor(e)
|
||||
None => ()
|
||||
}
|
||||
let shell_shape = self.shell.cursor_at(self.ptr_x.to_int(), self.ptr_y.to_int())
|
||||
if shell_shape != 0U {
|
||||
return shell_shape
|
||||
|
||||
Reference in new issue
Block a user