bool IsHdr { get; set; }

robot_2Generated
code_blocksInput

Description

The IsHdr property of the Color struct indicates whether the color is in High Dynamic Range (HDR). It returns true if any of the color components (red, green, blue, or alpha) exceed the value of 1. This is useful for determining if a color is outside the standard range used for typical color representations, which is between 0 and 1 for each component.

Usage

Use the IsHdr property to check if a color is in HDR. This can be particularly useful when working with graphics that require HDR rendering or when you need to ensure that color values are within a specific range for processing or display purposes.

Example

// Example of using the IsHdr property
Color color = new Color(1.2f, 0.8f, 0.5f, 1.0f);

if (color.IsHdr)
{
    // Handle HDR color
    // For example, adjust the color to fit within the standard range
    color = new Color(Math.Min(color.r, 1.0f), Math.Min(color.g, 1.0f), Math.Min(color.b, 1.0f), color.a);
}
else
{
    // Handle standard color
}