This PR does a few small things:
- Oklab's a*/b* and Oklch's chroma components can be as large as desired.
- In PDF, when encoding Oklab, the range is widened from [-0.4,0.4] to [-0.5,0.5].
- In PDF, clamping is now performed on Oklch's chroma instead of a* and b*.
This causes hue not to be distorted when clamping.
SVG and PNG export remain unchanged:
- SVG itself never had any restrictions on chroma.
We directly use the `oklab` and `oklch` CSS colors, which should work fine for the most part.
In the future, embedded ICC profiles might be nice. Further research is likely necessary.
- While PNG does not support color spaces like Oklab or Oklch, certain useful features exist.
One can define gamma (gAMA) and chromacities&whitepoint (cHRM) chunks and even embed ICC profiles.
While `image` crate does not support these features for encoding, its backend crate `png` does support gAMA and cHRM.
It does not allow embedding ICC profiles yet, though.
As it stands, to fully support wide gamuts and more accurate colors, more work is necessary.
This PR should help a bit though.
Things like `luma(1, key: "val")` didn't produce an error before because `args.finish()?` wasn't called. This changes `args: Args` to `args: &mut Args` to make it impossible for that to happen.
The previous commit was a bit overambitious. The left-hand side of assignments should actually be fully captured: Argument lists in `at` calls can contain captured variables. And if the assigned variable itself is captured, then the function is faulty anyway. (And we ensure the correct error message by capturing it.)
Fixes#2169
- Moves `Bytes` from `util` to `eval` module
- Accepts bytes in `str` function for bytes -> str conversion
- Adds `bytes` function for str | array -> bytes conversion
- Adds `array` function for bytes -> array conversion
- Adds `len`, `at`, and `slice` methods for bytes
- Adds `encoding` parameter to `read` function