From 420f66c19e10700a61eb800acdb7e07fb7514e31 Mon Sep 17 00:00:00 2001 From: lotherk Date: Sun, 22 Nov 2026 17:23:49 +0000 Subject: [PATCH] docs: dtphoto PSD reader and writer recorded The PSD paragraphs still said TIFF and PSD were open and that saving wrote anything unknown as BMP. PSD has been read and written for a while now, so the two places that said otherwise are corrected. The RLE layout is the part worth remembering: Photoshop writes all the row lengths first, then the rows. The first version interleaved them and the program's own reader interleaved them the same way, so the round trip was green while the file was wrong. ImageMagick said InvalidLength; after both sides changed it reads the composite and the layer at the pixels the test wrote. Measured 2026-11-22: 13 headless tests x 2 depths (24 and 8) green, a 64x64 picture with one hard edge 2436 bytes packed against 12530 raw, and `-psdread` reads a 16x12 file ImageMagick wrote. Tested: menutest optest selmodtest retouchtest movetest croptest typetest cliptest viewtest drawtest layertest psdtest rletest on :91 (depth 24) and :98 (depth 8) -- 26 of 26 PASS. --- docs/MCDE-PROGRAMS.md | 20 ++++++++++++++++++-- ext/src/mcde/AGENTS.md | 22 +++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/docs/MCDE-PROGRAMS.md b/docs/MCDE-PROGRAMS.md index e169c00fb2..cc9c868592 100644 --- a/docs/MCDE-PROGRAMS.md +++ b/docs/MCDE-PROGRAMS.md @@ -503,9 +503,24 @@ Hilfslinie bei 35 faengt 37, eine vertikale Linie laesst y in Ruhe), und `-drawtest` zaehlt die Pixel, die die Dekoration auf einem echten Pixmap hinzufuegt (Gitter 12.509, eine Hilfslinie 280 = die Canvas-Hoehe, Lineal 558 und nichts davon im Canvas). -Offen: PNG/TIFF/PSD als *Ausgabe*, Distort/Noise-Render, Effekte-Ebene, +Offen: TIFF und JPEG als *Ausgabe*, Distort/Noise-Render, Effekte-Ebene, P3-P6. +Stand 2026-11-22 (Photoshop-Dateien): PSD wird gelesen *und* geschrieben, +Ebenen samt Deckkraft, Fuellmethode, Sichtbarkeit und Alpha als Deckung. +Jede Kanalflaeche geht durch PackBits (Photoshop 2.5/3 schreiben es +standardmaessig) und faellt auf roh zurueck, wenn das Packen nicht kleiner +wird; die Kanallaenge im Ebenen-Satz wird dafuer vorher mit demselben +Routine gemessen, die spaeter schreibt. Ein 64x64-Bild mit einer harten +Kante: 2.436 Bytes statt 12.530 roh. +Der fremde Pruefstein ist hier der Punkt, nicht der eigene Rundlauf: ein +Schreiber und ein Leser, die denselben Denkfehler haben, bestaetigen sich +gegenseitig. ImageMagick meldete `InvalidLength`, bis die Zeilenlaengen +*vor* den Zeilendaten standen statt dazwischen -- beide Seiten waren +gleich falsch. `-rletest` prueft Groesse und Pixel, `-psdtest` den Stapel, +`-psdread` eine fremde Datei (von ImageMagick geschrieben, 16x12, Alpha als +Deckung). + Stand 2026-11-22 (Auswahl-Morphologie und Optionsleiste): Select > Modify (Border, Smooth, Expand, Contract), Grow, Similar und Feather rechnen auf einem exakten euklidischen Abstandsfeld (zwei Durchlaeufe, dann Abstand zum @@ -637,7 +652,8 @@ ist, dass Verstecken den Hintergrund zurueckbringt, dass die Palette eine Zeile pro Ebene hat und ein Klick auf die oberste Zeile diese aktiviert, und dass Deckkraft 100/50 und Multiplizieren das Bild auf dem Schirm aendern. -Offen bleiben TIFF und PSD (eigene Decoder noetig) sowie JPEG-Schreiben. +PSD ist inzwischen gelesen und geschrieben (siehe den Absatz zu den +Photoshop-Dateien oben). Offen bleiben TIFF und JPEG-Schreiben. ### C2. dtillustrator -- Illustrator 5.5.1, exakter Nachbau diff --git a/ext/src/mcde/AGENTS.md b/ext/src/mcde/AGENTS.md index 7b672ad92b..d0f2e170bf 100644 --- a/ext/src/mcde/AGENTS.md +++ b/ext/src/mcde/AGENTS.md @@ -94,7 +94,8 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt 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|-layertest` - `|-cliptest` are the headless proofs (no display needed beyond Xvfb): exact + `|-cliptest|-viewtest|-drawtest|-selmodtest|-optest|-menutest` 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 @@ -290,8 +291,23 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt (1/4/8/24/32 bpp, alpha 0 composited on the background; PNG-compressed icons refused) go through the program's own reader; PNG, JPEG, GIF and XPM come from `McdeThumbRead` (libDtSvc), so the program carries no - second decoder. Saving writes the format the name ends in, `.png` and - `.bmp` through `McdeThumbWrite`, anything else as 24-bit BMP. Measured + second decoder. PSD is its own reader and writer (a layer stack cannot + live in a flat pixmap): every channel plane goes through PackBits unless + packing does not make it smaller, and the channel length in the layer + record is measured by the same routine that then writes it, because a + length guessed from `w*h` and two bytes put the reader at the wrong + offset. The RLE layout is the one Photoshop writes: all the row lengths + first, then the rows -- the first version interleaved them, and the + program's own reader made the same mistake, so only a foreign decoder + could catch it. ImageMagick reported `InvalidLength` until both sides + changed; after that it reads the composite and the layer at the pixels + the test wrote. Measured 2026-11-22: a 64x64 picture with one hard edge + is 2436 bytes packed against about 12530 raw, and `-rletest` checks both + the size and the pixels. `-psdread` reads a file ImageMagick wrote (16x12, + alpha as coverage) so the reader is not only tested against the writer. + Saving writes the format the name ends in, `.png` and + `.bmp` through `McdeThumbWrite`, `.psd` through the layer writer, + anything else as 24-bit BMP. Measured 2026-11-22 on Xvfb depth 24: a 40x30 PNG written back is 1200 of 1200 pixels identical, a GIF 0 of 1200 different, JPEG q100 at most 3 steps per channel; on depth 8 a 32-colour picture comes back exact and the