linearP3ToP3Into
Apply Display P3 gamma encoding (same as sRGB transfer function), writing the clamped [0, 1] channels into out (allocation-free). out may be the same object as linear.
import { linearP3ToP3Into } from '@pbroom/color-kit';p3.ts:139function linearP3ToP3Into( out: P3, , linear: P3,): P3;Parameters
Returns
P3out
Example
import { linearP3ToP3Into } from '@pbroom/color-kit';
const p3 = { r: 0, g: 0, b: 0, alpha: 1 };
linearP3ToP3Into(p3, { r: 0.2, g: 0.5, b: 0.8, alpha: 1 });
p3.g; // → ≈ 0.7354