# `Color.JzAzBz`

JzAzBz perceptually-uniform color space for HDR and wide-gamut
content, from Safdar, Cui, Kim & Luo (2017), "Perceptually uniform
color space for image signals including high dynamic range and wide
gamut".

JzAzBz is designed on top of CIE XYZ under D65 expressed in
**absolute luminance (cd/m²)**. Our `Color.XYZ` is on the `Y = 1.0`
scale, so we multiply by a reference peak luminance before the
JzAzBz transform and divide on the way back.

The default reference luminance is 100 cd/m², which matches the
traditional SDR reference white and produces Jz values consistent
with the JzAzBz paper's examples. For HDR workflows, pass
`:reference_luminance` (in cd/m², up to 10,000) as an option.

# `t`

```elixir
@type t() :: %Color.JzAzBz{
  alpha: Color.Types.alpha(),
  az: float() | nil,
  bz: float() | nil,
  jz: float() | nil
}
```

A JzAzBz colour (Safdar et al. 2017), an HDR/wide-gamut perceptual
space. `jz` is lightness, `az` and `bz` are chromatic axes.

# `from_xyz`

Converts CIE `XYZ` (D65, `Y ∈ [0, 1]`) to JzAzBz.

### Arguments

* `xyz` is a `Color.XYZ` struct.

### Returns

* A `Color.JzAzBz` struct.

### Examples

    iex> {:ok, jz} = Color.JzAzBz.from_xyz(%Color.XYZ{x: 0.95047, y: 1.0, z: 1.08883, illuminant: :D65, observer_angle: 2})
    iex> {Float.round(jz.jz, 4), abs(jz.az) < 1.0e-3, abs(jz.bz) < 1.0e-3}
    {0.1672, true, true}

# `to_xyz`

Converts JzAzBz to CIE `XYZ` (D65, `Y ∈ [0, 1]`).

### Arguments

* `jzazbz` is a `Color.JzAzBz` struct.

### Returns

* A `Color.XYZ` struct tagged D65/2°.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
