# demo31 — effect dialect words, exact GRADIENT ramps (2026-11-28)

Build marker: `demo31-2026-11-28`.

## Baseline (all green)

| check | result |
|---|---|
| golden suite, native Linux | **89/89** |
| golden suite, Windows PE under Wine | **89/89** |
| re-bol.com corpus (20 sections) | **325 snippets, 0 errors** (Linux + Wine) |
| examples / net / ports (`--mix`) smoke | PASS native + Wine |
| GUI screenshot regression | 3/3, 0.00 % diff (widgets baseline renewed) |

## 1. The effect dialect resolves words

`EFFECT [gradient 1x0 blue gold]` uses the *values* of `blue`/`gold`; the clone
read the raw words, so `Tuple_Color` failed and the face painted nothing (the
second box of the widgets GUI test was simply missing).  Effect arguments are
now resolved through the word's binding (falling back to the global context)
in both the window renderer and `to-image`.

## 2. GRADIENT: exact R2 ramp and direction

Probed with the oracle on `to-image` and on-screen boxes:

```
to-image make face [size: 8x1 effect: [gradient 1x0 red green]]
  -> FF0000 E01F00 C03F00 A05F00 807F00 609F00 40BF00 20DF00
to-image make face [size: 4x4 effect: [gradient 0x1 red green]]
  -> rows FF0000 C03F00 807F00 40BF00
```

so R2 interpolates each component *from colour 1 toward colour 2* with
`comp = c1 + trunc((c2-c1)*i/n)` where `n` is the width (direction 1x0) or
height (0x1), `i` runs 0..n-1, negative direction components reverse the
order, and the diagonal case projects on the direction vector.  The clone was
using a `(n-1)` lerp scaled through 255, which was off by one or two steps and
ignored the direction entirely (every gradient was vertical).

Fixed in `draw.c` (`Img_Gradient`, shared by `to-image` and the draw-dialect
`gradient` command) and in `view_win.c`'s on-screen `Fill_Gradient`.  New
golden `89-gradient-effect` pins 6-axis-aligned ramps; the widgets GUI
baseline was renewed (its gradient box now renders like the reference).

Note: `gradient` also exists as a *draw* command, and the effect block used to
fall through to `Draw_Commands`, whose old vertical `gradient` then overwrote
the image with black — both paths now share the exact implementation.

## 3. Remaining GUI gaps (documented)

Buttons/fields still lack R2's stock-image look (`btn-up.png` + `extend`), and
checkbox marks differ; `extend`/`fit` placement parity is still open.
