Method TryCreateLinearizedColorContext
- Namespace
- PaintDotNet.Imaging
- Assembly
- PaintDotNet.Windows.Framework.dll
TryCreateLinearizedColorContext(IImagingFactory, IColorContext)
Creates a linearized version of the given color context. This removes the transfer curve (TRC)
and enables the use of linear gamma with most color contexts. If the color context is already
linear, then this will simply return a new reference to it. If the color context cannot be
linearized then null
will be returned.
public static IColorContext? TryCreateLinearizedColorContext(this IImagingFactory factory, IColorContext baseColorContext)
Parameters
factory
IImagingFactorybaseColorContext
IColorContext
Returns
Remarks
This method is useful when you want to standardize on rendering using linear gamma.
Not all color contexts can be linearized. If you require the use of a linear color space, you
should use scRGB as a fallback. You can use the CreateLinearizedColorContextOrScRgb(IImagingFactory, IColorContext)
to simplify this, or CreateColorContext(IImagingFactory, DeviceColorSpace) to
create an scRGB color context directly.
scRGB is sometimes referred to by Microsoft as CCCS, or Canonical Composition Color Space. It is
possible to convert to and from scRGB without color gamut clipping. See
scRGB (Wikipedia) for more information.