Commit Graph

12 Commits

Author SHA1 Message Date
Laurenz 36c7301608 Tidy up some imports 2023-11-21 15:20:49 +01:00
frozolotl 8e5b7fe5c1
Clean up some color quantization code (#2730) 2023-11-21 10:24:39 +01:00
Sébastien d'Herbais de Thun 96f02960a2
Fix gradient colors (#2719) 2023-11-20 18:20:26 +01:00
Laurenz 2da619e17c Streamline imports 2023-11-19 16:34:38 +01:00
Sébastien d'Herbais de Thun f5b3af3c1b
Parallel image encoding (#2693) 2023-11-17 19:42:49 +01:00
frozolotl b0e81d4b3f
Remove restrictions to chroma and improve clamping (#2690)
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.
2023-11-17 10:41:45 +01:00
frozolotl f56813a778
Remove `a` suffix from Rgba and LinearRgba (#2691) 2023-11-15 14:48:48 +01:00
frozolotl d93ed1b3d8
Implement Oklch support (#2611) 2023-11-10 10:31:06 +01:00
Laurenz 7f0fcda376 Move some things out of `util` 2023-11-08 23:42:45 +01:00
Sébastien d'Herbais de Thun d7fea7077e
Gradient Part 5c: Fix gradient rotation on text & math (#2606) 2023-11-08 15:51:25 +01:00
Laurenz ccbe901cb7 Make `PdfContext` private again 2023-11-08 15:35:05 +01:00
Laurenz 46846a337e Extract `typst-pdf` crate 2023-11-08 15:09:55 +01:00