ColorSpaceHelper Class

A helper class containing low-level conversion methods for byte, ushort and float types to convert color components using the sRGB and linear color spaces.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.0-rc.1
C#
public static class ColorSpaceHelper
Inheritance
Object    ColorSpaceHelper

Methods

LinearToSrgb Converts a floating-point value representing a color component in the linear color space to a value representing an sRGB color component.
LinearToSrgb16Bit Converts a floating-point value representing a color component in the linear color space to a UInt16 value representing an sRGB color component.
LinearToSrgb8Bit Converts a floating-point value representing a color component in the linear color space to a byte value representing an sRGB color component.
LinearToSrgbVectorRgba Converts a vector of four floating-point values representing RGBA color components in the linear color space to a vector representing sRGB color components.
SrgbToLinear(Byte) Converts a byte value representing an sRGB color component to a floating-point value between 0 and 1 representing an RGB color component in the linear color space.
SrgbToLinear(Single) Converts a floating-point value representing an sRGB color component to a value representing an RGB color component in the linear color space.
SrgbToLinear(UInt16) Converts a UInt16 value representing an sRGB color component to a floating-point value between 0 and 1 representing an RGB color component in the linear color space.
SrgbToLinearVectorRgba Converts a vector of four floating-point values representing RGBA color components in the sRGB color space to a vector representing linear color components.
ToByte(Single) Converts a floating-point value ranging from 0 to 1 to a byte without changing the color space. Out-of-range values are allowed in which case the result will be clipped to Byte.MinValue or Byte.MaxValue.
ToByte(UInt16) Converts a 16-bit color channel value to an 8-bit value representing the same intensity without changing the color space.
ToFloat(Byte) Converts a byte to a floating-point value between 0 and 1 without changing the color space.
ToFloat(UInt16) Converts a UInt16 value to a floating-point value between 0 and 1 without changing the color space.
ToUInt16(Byte) Converts an 8-bit color channel value to a 16-bit value representing the same intensity without changing the color space.
ToUInt16(Single) Converts a floating-point value ranging from 0 to 1 to a UInt16 without changing the color space. Out-of-range values are allowed in which case the result will be clipped to UInt16.MinValue or UInt16.MaxValue.

See Also