|
|
@ -1,8 +1,8 @@ |
|
|
// Copyright (c) Six Labors.
|
|
|
// Copyright (c) Six Labors.
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
using System.Buffers; |
|
|
using System.Buffers; |
|
|
using System.Numerics; |
|
|
|
|
|
using SixLabors.ImageSharp.Formats.Tiff.Utils; |
|
|
using SixLabors.ImageSharp.Formats.Tiff.Utils; |
|
|
using SixLabors.ImageSharp.Memory; |
|
|
using SixLabors.ImageSharp.Memory; |
|
|
using SixLabors.ImageSharp.PixelFormats; |
|
|
using SixLabors.ImageSharp.PixelFormats; |
|
|
@ -32,17 +32,17 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation |
|
|
var color = default(TPixel); |
|
|
var color = default(TPixel); |
|
|
color.FromVector4(TiffUtils.Vector4Default); |
|
|
color.FromVector4(TiffUtils.Vector4Default); |
|
|
|
|
|
|
|
|
System.Span<byte> redData = data[0].GetSpan(); |
|
|
Span<byte> redData = data[0].GetSpan(); |
|
|
System.Span<byte> greenData = data[1].GetSpan(); |
|
|
Span<byte> greenData = data[1].GetSpan(); |
|
|
System.Span<byte> blueData = data[2].GetSpan(); |
|
|
Span<byte> blueData = data[2].GetSpan(); |
|
|
|
|
|
|
|
|
int offset = 0; |
|
|
int offset = 0; |
|
|
for (int y = top; y < top + height; y++) |
|
|
for (int y = top; y < top + height; y++) |
|
|
{ |
|
|
{ |
|
|
System.Span<TPixel> pixelRow = pixels.GetRowSpan(y); |
|
|
Span<TPixel> pixelRow = pixels.GetRowSpan(y).Slice(left, width); |
|
|
if (this.isBigEndian) |
|
|
if (this.isBigEndian) |
|
|
{ |
|
|
{ |
|
|
for (int x = left; x < left + width; x++) |
|
|
for (int x = 0; x < pixelRow.Length; x++) |
|
|
{ |
|
|
{ |
|
|
ulong r = TiffUtils.ConvertToShortBigEndian(redData.Slice(offset, 2)); |
|
|
ulong r = TiffUtils.ConvertToShortBigEndian(redData.Slice(offset, 2)); |
|
|
ulong g = TiffUtils.ConvertToShortBigEndian(greenData.Slice(offset, 2)); |
|
|
ulong g = TiffUtils.ConvertToShortBigEndian(greenData.Slice(offset, 2)); |
|
|
@ -55,7 +55,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
for (int x = left; x < left + width; x++) |
|
|
for (int x = 0; x < pixelRow.Length; x++) |
|
|
{ |
|
|
{ |
|
|
ulong r = TiffUtils.ConvertToShortLittleEndian(redData.Slice(offset, 2)); |
|
|
ulong r = TiffUtils.ConvertToShortLittleEndian(redData.Slice(offset, 2)); |
|
|
ulong g = TiffUtils.ConvertToShortLittleEndian(greenData.Slice(offset, 2)); |
|
|
ulong g = TiffUtils.ConvertToShortLittleEndian(greenData.Slice(offset, 2)); |
|
|
|