GainMapChannel Class

The parameters of one channel of a gain map (ISO 21496-1, the hdrgm XMP namespace of Adobe and Ultra HDR): how the samples of the gain map image become the gain that turns the base image into the alternate image.

public sealed class GainMapChannel : IEquatable<GainMapChannel>

Remarks

For a sample g of the gain map in [0, 1], the gain in stops is lerp(GainMapMin, GainMapMax, pow(g, 1 / Gamma)), and an alternate color is (base + BaseOffset) * exp2(gain * weight) - AlternateOffset in linear light, where the weight depends on the headroom of the display (GainMapMetadata.GetWeight).

Implements

Constructors

NameDescription
GainMapChannel(double, double, double, double, double)Initializes a new instance of the GainMapChannel class.

GainMapChannel(double, double, double, double, double)

GainMapChannel.cs

Initializes a new instance of the GainMapChannel class.

public GainMapChannel(double gainMapMin, double gainMapMax, double gamma, double baseOffset, double alternateOffset)

Parameters

gainMapMin double
The gain of a sample of 0, in stops (log2 of the ratio of the alternate color to the base color).
gainMapMax double
The gain of a sample of 1, in stops; at least gainMapMin.
gamma double
The exponent the samples were encoded with; greater than 0.
baseOffset double
The offset added to the linear base color before the gain applies.
alternateOffset double
The offset subtracted from the color once the gain applied.

Exceptions

ArgumentOutOfRangeException
A value is not finite, gamma is not greater than 0, or gainMapMax is less than gainMapMin.

Properties

NameDescription
AlternateOffsetGets the offset subtracted from the color once the gain applied.
BaseOffsetGets the offset added to the linear base color before the gain applies.
GainMapMaxGets the gain of a sample of 1, in stops.
GainMapMinGets the gain of a sample of 0, in stops (log2 of the ratio of the alternate color to the base color).
GammaGets the exponent the samples were encoded with.

AlternateOffset

GainMapChannel.cs

Gets the offset subtracted from the color once the gain applied.

public double AlternateOffset { get; }

Property value

double

Gets the offset added to the linear base color before the gain applies.

public double BaseOffset { get; }

Property value

double

Gets the gain of a sample of 1, in stops.

public double GainMapMax { get; }

Property value

double

Gets the gain of a sample of 0, in stops (log2 of the ratio of the alternate color to the base color).

public double GainMapMin { get; }

Property value

double

Gets the exponent the samples were encoded with.

public double Gamma { get; }

Property value

double

Methods

NameDescription
Equals(GainMapChannel?)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Determines whether the specified object is equal to the current object.
GetHashCode()Serves as the default hash function.
ToString()Returns a string that represents the current object.

Equals overloads

Equals(GainMapChannel?)

GainMapChannel.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(GainMapChannel? other)
Parameters
other GainMapChannel?
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

GainMapChannel.cs

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current object.
Returns

bool true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

GainMapChannel.cs

Serves as the default hash function.

public override int GetHashCode()

Returns

int A hash code for the current object.

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.