Table of Contents

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

factory IImagingFactory
profileBytes IReadOnlyList<byte>

Returns

IColorContext

CreateColorContext(IImagingFactory, IReadOnlyList<byte>, int, int)

public static IColorContext CreateColorContext(this IImagingFactory factory, IReadOnlyList<byte> profileBytes, int startIndex, int length)

Parameters

factory IImagingFactory
profileBytes IReadOnlyList<byte>
startIndex int
length int

Returns

IColorContext

CreateColorContext(IImagingFactory, KnownColorSpace)

public static IColorContext CreateColorContext(this IImagingFactory factory, KnownColorSpace colorSpace)

Parameters

factory IImagingFactory
colorSpace KnownColorSpace

Returns

IColorContext

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

factory IImagingFactory
deviceColorContext IDeviceColorContext

Returns

IColorContext

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

factory IImagingFactory
simpleColorProfile SimpleColorProfile

Returns

IColorContext

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

factory IImagingFactory
cicpColorSpace CicpColorSpace

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

factory IImagingFactory
colorSpace DeviceColorSpace

Returns

IColorContext