mirror of https://github.com/SixLabors/ImageSharp
13 changed files with 99 additions and 10 deletions
@ -0,0 +1,40 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
using SixLabors.ImageSharp.ColorSpaces; |
|||
using SixLabors.ImageSharp.ColorSpaces.Conversion; |
|||
|
|||
namespace SixLabors.ImageSharp.Formats.Jpeg.Components; |
|||
|
|||
internal abstract partial class JpegColorConverterBase |
|||
{ |
|||
/// <summary>
|
|||
/// Color converter for tiff images, which use the jpeg compression and CMYK colorspace.
|
|||
/// </summary>
|
|||
internal sealed class TiffCmykScalar : JpegColorConverterScalar |
|||
{ |
|||
public TiffCmykScalar(int precision) |
|||
: base(JpegColorSpace.TiffCmyk, precision) |
|||
{ |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public override void ConvertToRgbInplace(in ComponentValues values) |
|||
=> ConvertToRgbInplace(values, this.MaximumValue); |
|||
|
|||
public override void ConvertFromRgb(in ComponentValues values, Span<float> rLane, Span<float> gLane, Span<float> bLane) => throw new NotImplementedException(); |
|||
|
|||
internal static void ConvertToRgbInplace(ComponentValues values, float maxValue) |
|||
{ |
|||
float invMax = 1 / maxValue; |
|||
for (int i = 0; i < values.Component0.Length; i++) |
|||
{ |
|||
Cmyk cmyk = new(values.Component0[i] * invMax, values.Component1[i] * invMax, values.Component2[i] * invMax, values.Component3[i] * invMax); |
|||
Rgb rgb = ColorSpaceConverter.ToRgb(in cmyk); |
|||
values.Component0[i] = rgb.R; |
|||
values.Component1[i] = rgb.G; |
|||
values.Component2[i] = rgb.B; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
version https://git-lfs.github.com/spec/v1 |
|||
oid sha256:7f68db78d765a7f36570cd7b57a1f06cfca24c3b4916d0692a4aa051209ec327 |
|||
size 616 |
|||
@ -0,0 +1,3 @@ |
|||
version https://git-lfs.github.com/spec/v1 |
|||
oid sha256:abb923e457acc31a7f18c46a7d58fc5a42f5c3d197236403921e3ee623fa4fac |
|||
size 2046 |
|||
@ -0,0 +1,3 @@ |
|||
version https://git-lfs.github.com/spec/v1 |
|||
oid sha256:abb923e457acc31a7f18c46a7d58fc5a42f5c3d197236403921e3ee623fa4fac |
|||
size 2046 |
|||
Loading…
Reference in new issue