mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 09:26:43 +00:00
An Indexed Color document keeps its pixels expanded to RGB with the palette as side data, and the Brush rendered straight onto that surface. A red stroke on a black/white document therefore left opaque red pixels, and soft edges or partial opacity left blends, all outside the colour table, while the document still reported Indexed mode. Photoshop (and GIMP, which documents it) paint the nearest table colour instead. The stroke commit now maps the damaged rectangle to the nearest table entry with the same no-dither quantiser the Indexed Color conversion uses. That keeps the table's transparent entry binary as well. The live preview applies the same step, so the canvas shows the pixels the commit keeps. This covers paint.stroke and paint.pencil, including erasing. Masks and channels are gray targets and are left alone. Fixes #8669 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>