MCDE dtphoto: the toolbox wired -- lasso, wand, move, crop, type, retouch
The selection was a rectangle, so the lasso, the magic wand and every
command that should honour a selected shape had nothing to work on. It
is a bit mask now: the lasso collects a path, the wand floods by colour
distance, Select > Inverse and Edit > Clear read the same mask, and a
command paints only inside it.
Move and Crop had no press or motion branch at all -- two of the 22
buttons did nothing. Move snapshots picture and mask at the press and
rebuilds from that snapshot on every motion event: rebuilding from the
last frame walks the pixels twice as far, and the release must not
recompute the offset, because a drag that ends on the frame gives a
position outside the canvas and moved the picture back. Without a
selection it moves the whole picture, as the original does. Crop drags
a rectangle and crops to it on release. Type opens a prompt and draws
one line over an undo snapshot (the drawing moved out of the dialog
callback so it is reachable without a dialog). The magnifier doubles on
the left button and halves on the right, the hand pans the view.
The six retouching tools (blur, sharpen, smudge, dodge, burn, sponge)
are new here -- dtpaint has none to copy -- and read a patch around the
dab in one GetImageRGB round trip, not one per pixel.
Two latent bugs found while testing: Unique() sorts the colour keys in
place but the bsearch afterwards ran over the reduced count, so lookups
past the holes failed (ReadPatch and GetImageRGB both had it), and
RGBToPixel returned 0 -- black -- when XAllocColor failed on a full
256-cell map, losing the pixel instead of taking the nearest cell.
Test evidence, headless, depth 24 and depth 8, all green:
-movetest 10x10 block moved (10,5), mask travelled, background hole
-croptest 40x30 -> 20x30, only blue kept
-typetest 75 dark pixels, corner still white
-selecttest wand 800 of 2400 exact, inverse 1600, lasso in/out, clear
only inside the mask
-retouchtest all six tools move the values the expected way
-selftest 1024x768 round trip PASS
Mouse-verified on Xvfb with xdotool: zoom 200% -> 400% -> 200%,
crop 1024x768 -> 200x150, move dragged twice (40,30 then 80,60) with
78,011 pixels changed.
This commit is contained in:
1 parent
226b2116f1
commit
d4790b53d3
2 files changed
+1541
-15
No files matched your search
@@ -82,6 +82,30 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
|
||||
does; depth 8 (PseudoColor) is exact for 4 and 65536-colour documents
|
||||
alike. A document with more colours than the 256-cell colormap holds
|
||||
loses the excess, as any 8-bit picture must.
|
||||
The toolbox is wired end to end since 2026-11-22: selection is a bit
|
||||
mask, not a rectangle, so the lasso, the magic wand (colour flood,
|
||||
tolerance in colour distance), Select > Inverse and Edit > Clear all
|
||||
work on the same thing, and a command paints only inside the mask.
|
||||
Move drags the masked pixels; it snapshots the picture and the mask at
|
||||
the press and rebuilds from that snapshot on every motion event, because
|
||||
a rebuild from the last frame walks the pixels twice as far, and the
|
||||
release must not recompute the offset (a drag that ends on the frame
|
||||
gives a position outside the canvas, which moved the picture back).
|
||||
Crop drags a rectangle and crops to it on release. Type opens a prompt
|
||||
and draws one line with the GC font over an undo snapshot.
|
||||
`dtphoto -movetest|-croptest|-typetest|-selecttest|-retouchtest` are the
|
||||
headless proofs (no display needed beyond Xvfb): exact pixel sets for
|
||||
wand/inverse/lasso/clear, a 10x10 block moved (10,5) with its mask and a
|
||||
background hole left behind, a crop to 20x30 that keeps only blue, a
|
||||
text line with dark pixels and an untouched corner, and all six
|
||||
retouching tools (blur, sharpen, smudge, dodge, burn, sponge) moving the
|
||||
pixel values in the expected direction. All six run green on depth 24
|
||||
and depth 8. Retouching reads a patch around the dab through one
|
||||
GetImageRGB round trip, not one per pixel; measured 80 ms for a full
|
||||
1024x768 open/save round trip on a busy host.
|
||||
The zoom magnifier doubles on the left button and halves on the right
|
||||
(12%-800%), the hand pans the view, and both say what they did on
|
||||
stderr so a mouse-driven test can read the result.
|
||||
dtpaint builds its menus in code and its labels are catalogued
|
||||
(`dtpaint.msg`, 51 messages from 1-53, 52 unused: menus, the
|
||||
tool/file/error/discard/attributes/colour/print dialogs, Help and About);
|
||||
|
||||
+1517
-15
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user