Save for Web: a Custom table keeps shifted and locked colors first, and 255 opaque colors beside transparent pixels

- With transparent pixels, a fixed palette's colors mapped to
  transparent share the transparent pixels' slot, so at Colors 256 all
  255 opaque colors keep their entries.
- The preview's mappedToTransparent lists a color mapped to transparent
  that did not fit in the fixed palette when its pixels became
  transparent.
- When Colors leaves a fixed palette fewer slots than it has opaque
  colors, shifted colors keep their slots first, then locked ones, then
  the others in palette order. The file keeps the palette's order.
- quantize::nearest_entries hands each pixel's entry to a callback
  instead of collecting one per pixel.
- A GIF lossy test with one fixed entry of three.

Docs: params text, docs/mcp.md.
This commit is contained in:
dotCooCoo
2026-11-20 21:51:57 -08:00
parent c86bb07a44
commit 5adeec1151
5 changed files with 150 additions and 62 deletions
+3 -2
View File
@@ -10540,8 +10540,9 @@ ignored. Deleting every opaque color is an error, and the settings, preview and
entry of transparent pixels cannot be deleted. `colorTable.customPalette: ["#rrggbb"…]` is a fixed palette (a Custom
table) used instead of the reduction's own, at most `colors` entries with the transparent one included, so a color it
lacks is not made again. Its colors in `transparent` all become the transparent entry and take one of the `colors`
slots together (when no pixel is transparent and no pixel takes one of them, that slot goes to its next color); its
other colors fill the remaining slots in order. The dialog's Delete Color sets it to the table's colors on the first deletion. Both lists hold
slots together (with transparent pixels they share those pixels' slot; when no pixel is transparent and no pixel takes
one of them, that slot goes to its next color), and the preview's `mappedToTransparent` lists each of them a pixel
took; its other colors fill the remaining slots, its shifted colors first, then its locked ones, then the rest in order. The dialog's Delete Color sets it to the table's colors on the first deletion. Both lists hold
at most 256 colors, and `#rrggbbaa` is refused. A `reduction` change without `colorTable` in the same params clears
both lists. JPEG and PNG-24 have no color table and do not read them. Presets and `webExport.settings` keep them. In
the dialog a click selects one color, Shift-click selects the colors between it and the last one clicked, and