Skip to content

Commit

Permalink
Fix color spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
wrandelshofer committed Feb 9, 2025
1 parent 79b7804 commit b6c9e97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* References:
* <dl>
* <dt>CSS Color Module Level 4. Chapter 4. Representing Colors: the &lt;color&gt; type.</dt>
* <dd><a href="https://www.w3.org/TR/2022/CRD-css-color-4-20221101/#color-type">w3.org</a></dd>
* <dd><a href="https://www.w3.org/TR/2024/CRD-css-color-4-20240213/#typedef-colorspace-params">w3.org</a></dd>
* </dl>
*/
public class CssColorSpaces {
Expand All @@ -28,17 +28,17 @@ private CssColorSpaces() {
public final static Map<String, NamedColorSpace> COLOR_SPACES;

static {
D50XyzColorSpace cieXyzColorSpace = new D50XyzColorSpace();
D65XyzColorSpace d65XyzColorSpace = new D65XyzColorSpace();
COLOR_SPACES = Map.of(
"srgb", new SrgbColorSpace(),
"srgb-linear", new LinearSrgbColorSpace(),
"display-p3", new DisplayP3ColorSpace(),
"a98-rgb", new A98RgbColorSpace(),
"prophoto-rgb", new ProPhotoRgbColorSpace(),
"rec2020", new Rec2020ColorSpace(),
"xyz", cieXyzColorSpace,
"xyz-d50", new D65XyzColorSpace(),
"xyz-d65", cieXyzColorSpace
"xyz", d65XyzColorSpace,
"xyz-d65", d65XyzColorSpace,
"xyz-d50", new D50XyzColorSpace()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private static double compute_max_saturation(double a, double b) {
// Approximate max saturation using a polynomial:
double S = k0 + k1 * a + k2 * b + k3 * a * a + k4 * a * b;

// Do one step Halley's method to get closer
// Do one-step Halley's method to get closer
// this gives an error less than 10e6, except for some blue hues where the dS/dh is close to infinite
// this should be sufficient for most applications, otherwise do two/three steps

Expand Down Expand Up @@ -327,7 +327,7 @@ private static double find_gamut_intersection(double a, double b, double L1, dou
// First intersect with triangle
t = cusp.C * (L0 - 1.0) / (C1 * (cusp.L - 1.0) + cusp.C * (L0 - L1));

// Then one step Halley's method
// Then one-step Halley's method
{
double dL = L1 - L0;
double dC = C1;
Expand Down

0 comments on commit b6c9e97

Please sign in to comment.