Method CreateColorContext
- Namespace
- PaintDotNet.Imaging
- Assembly
- PaintDotNet.Windows.Core.dll
CreateColorContext(IImagingFactory, IReadOnlyList<byte>)
public static IColorContext CreateColorContext(this IImagingFactory factory, IReadOnlyList<byte> profileBytes)
Parameters
factoryIImagingFactoryprofileBytesIReadOnlyList<byte>
Returns
CreateColorContext(IImagingFactory, IReadOnlyList<byte>, int, int)
public static IColorContext CreateColorContext(this IImagingFactory factory, IReadOnlyList<byte> profileBytes, int startIndex, int length)
Parameters
factoryIImagingFactoryprofileBytesIReadOnlyList<byte>startIndexintlengthint
Returns
CreateColorContext(IImagingFactory, KnownColorSpace)
public static IColorContext CreateColorContext(this IImagingFactory factory, KnownColorSpace colorSpace)
Parameters
factoryIImagingFactorycolorSpaceKnownColorSpace
Returns
CreateColorContext(IImagingFactory, IDeviceColorContext)
Creates a color context with the same color space as the given Direct2D color context.
public static IColorContext CreateColorContext(this IImagingFactory factory, IDeviceColorContext deviceColorContext)
Parameters
factoryIImagingFactorydeviceColorContextIDeviceColorContext
Returns
Exceptions
- ArgumentException
The color context has no profile bytes (e.g. a Dxgi color context for a color space without a profile), or it is a Simple color context whose SimpleColorProfile contains invalid values.
CreateColorContext(IImagingFactory, in SimpleColorProfile)
Creates a color context from a simple (primaries-and-gamma) color profile by synthesizing the equivalent ICC profile.
public static IColorContext CreateColorContext(this IImagingFactory factory, in SimpleColorProfile simpleColorProfile)
Parameters
factoryIImagingFactorysimpleColorProfileSimpleColorProfile
Returns
Exceptions
- ArgumentException
The gamma is G2084 (SMPTE ST.2084 PQ), which cannot be expressed as an ICC parametric curve; or a primary or white point value is not finite, a primary's y chromaticity is not positive, or the white point's X + 1 + Z sum is not positive.
CreateColorContext(IImagingFactory, CicpColorSpace)
Creates an IColorContext describing the given CICP color information by synthesizing the corresponding PaintDotNet.Imaging.IColorProfile and returning its color context.
public static IColorContext CreateColorContext(this IImagingFactory factory, CicpColorSpace cicpColorSpace)
Parameters
factoryIImagingFactorycicpColorSpaceCicpColorSpace
Returns
- IColorContext
The color context (owned by the caller).
Remarks
Full range is required: a color context, like the profile it is created from, cannot describe the narrow-to-full range expansion. To color-transform a narrow-range source (where the range is expanded as part of the transform), use CreateColorTransformedBitmap(IImagingFactory, IBitmapSource, CicpColorSpace, IColorContext, in PixelFormat).
Exceptions
- ArgumentException
Thrown if a color context cannot be created from
cicpColorSpace— because a profile cannot be synthesized, or because the samples are not full range. The message describes why.
CreateColorContext(IImagingFactory, DeviceColorSpace)
Creates an sRGB or scRGB color context.
public static IColorContext CreateColorContext(this IImagingFactory factory, DeviceColorSpace colorSpace)
Parameters
factoryIImagingFactorycolorSpaceDeviceColorSpace