Srgb module

srgb_to_linear_pow2

procedure · 2 overloadsSource

Approximates srgb_to_linear by squaring each channel, a gamma of 2.0 instead of the sRGB curve. Cheap, and within a few percent of the real curve in the middle of the range (0.5 gives 0.25 instead of 0.214), but noticeably off near black.

ExampleOpen in playground ↗
#import "Math";
assert(srgb_to_linear_pow2(xyz(0.5, 1, 0)) == xyz(0.25, 1, 0));
srgb_to_linear_pow2 :: (c: Vector3) -> Vector3

Approximates srgb_to_linear by squaring each channel, a gamma of 2.0 instead of the sRGB curve. Cheap, and within a few percent of the real curve in the middle of the range (0.5 gives 0.25 instead of 0.214), but noticeably off near black.

Parameters

Returns

ExampleOpen in playground ↗
#import "Math";
assert(srgb_to_linear_pow2(xyz(0.5, 1, 0)) == xyz(0.25, 1, 0));
srgb_to_linear_pow2 :: (c: Vector4) -> Vector4

The Vector4 form squares the red, green and blue channels and leaves alpha (w) untouched.

Parameters

Returns

See also