Class ColorProfileConverterExtensionsRgbCieLab
- Namespace
- SixLabors.ImageSharp.ColorProfiles
- Assembly
- SixLabors.ImageSharp.dll
Allows conversion between two color profiles based on the RGB and CIE Lab color spaces.
public static class ColorProfileConverterExtensionsRgbCieLab
- Inheritance
-
ColorProfileConverterExtensionsRgbCieLab
- Inherited Members
Methods
Convert<TFrom, TTo>(ColorProfileConverter, ReadOnlySpan<TFrom>, Span<TTo>)
Converts a span of color values from one color profile to another using the specified color profile converter.
public static void Convert<TFrom, TTo>(this ColorProfileConverter converter, ReadOnlySpan<TFrom> source, Span<TTo> destination) where TFrom : struct, IColorProfile<TFrom, Rgb> where TTo : struct, IColorProfile<TTo, CieLab>
Parameters
converterColorProfileConverterThe color profile converter to use for the conversion operation.
sourceReadOnlySpan<TFrom>A read-only span containing the source color values to convert.
destinationSpan<TTo>A span that receives the converted color values. Must be at least as long as the source span.
Type Parameters
TFromThe type representing the source color profile. Must implement IColorProfile<TSelf, TProfileSpace>.
TToThe type representing the destination color profile. Must implement IColorProfile<TSelf, TProfileSpace>.
Remarks
This method performs color conversion between two color profiles, handling necessary transformations such as profile connection space conversion and chromatic adaptation. If ICC profiles are available and applicable, the conversion uses them for improved accuracy. The method does not allocate memory for the destination; the caller is responsible for providing a suitably sized span.
Convert<TFrom, TTo>(ColorProfileConverter, in TFrom)
Converts a color value from one color profile to another using the specified color profile converter.
public static TTo Convert<TFrom, TTo>(this ColorProfileConverter converter, in TFrom source) where TFrom : struct, IColorProfile<TFrom, Rgb> where TTo : struct, IColorProfile<TTo, CieLab>
Parameters
converterColorProfileConverterThe color profile converter to use for the conversion.
sourceTFromThe source color value to convert.
Returns
- TTo
A value of type
TTorepresenting the converted color in the target color profile.
Type Parameters
TFromThe source color profile type. Must implement IColorProfile<TSelf, TProfileSpace>.
TToThe target color profile type. Must implement IColorProfile<TSelf, TProfileSpace>.
Remarks
The conversion process may use ICC profiles if available; otherwise, it performs a manual conversion through the profile connection space (PCS) with chromatic adaptation as needed. The method requires both source and target types to be value types implementing the appropriate color profile interface.