Files
cadcraft/contributors
f0d6f248f7 DXF/DWG: keep hatch gradients through save and reopen (fixes #80) (#162)
* DXF/DWG: keep hatch gradients through save and reopen (fixes #80)

The HATCH writer never emitted a gradient and the reader always set
`gradient: None`, so a GRADIENT fill reopened as a plain SOLID hatch after
any DXF or DWG save.

- Writer: native HATCH groups per the DXF Reference (450 gradient flag,
  451, 452 two-colour, 453 colour count, 460 angle in radians, 461 shift
  (0 = centered), 462 tint, 463 per-colour records with 63 ACI and 421 true
  colour, 470 name), plus a `CADCRAFT` `GRADIENT` xdata copy (name cut to
  255 bytes, angle, centered, colour names).
- Reader: native groups win when present (another program may have edited
  them); otherwise the xdata copy is used. The xdata is what survives DWG
  saves: the file is R2000 (AC1015), whose DWG HATCH has no gradient fields,
  so the DWG bridge drops the native groups.
- Hostile values (NaN angles, out-of-range colours, extra colour records,
  missing groups) fall back to the GRADIENT command's defaults.

Tests: gradient_hatch_roundtrips_through_dxf,
gradient_hatch_roundtrips_through_dwg,
gradient_falls_back_to_xdata_and_native_groups_win,
long_gradient_name_is_cut_only_in_xdata, hostile_gradient_groups_never_panic.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* contributors: add vangel76

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Gradient test: expect \U+ escapes now that non-ASCII text is escaped (#169)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Brandon Thomas <[email protected]>
2026-10-10 13:14:52 -04:00
..