mirror of https://github.com/SixLabors/ImageSharp
committed by
GitHub
196 changed files with 1377 additions and 960 deletions
@ -1,23 +1,33 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
using System.Diagnostics.CodeAnalysis; |
|||
|
|||
namespace SixLabors.ImageSharp.Compression.Zlib; |
|||
|
|||
internal static class DeflateThrowHelper |
|||
{ |
|||
[DoesNotReturn] |
|||
public static void ThrowAlreadyFinished() => throw new InvalidOperationException("Finish() already called."); |
|||
|
|||
[DoesNotReturn] |
|||
public static void ThrowAlreadyClosed() => throw new InvalidOperationException("Deflator already closed."); |
|||
|
|||
[DoesNotReturn] |
|||
public static void ThrowUnknownCompression() => throw new InvalidOperationException("Unknown compression function."); |
|||
|
|||
[DoesNotReturn] |
|||
public static void ThrowNotProcessed() => throw new InvalidOperationException("Old input was not completely processed."); |
|||
|
|||
[DoesNotReturn] |
|||
public static void ThrowNull(string name) => throw new ArgumentNullException(name); |
|||
|
|||
[DoesNotReturn] |
|||
public static void ThrowOutOfRange(string name) => throw new ArgumentOutOfRangeException(name); |
|||
|
|||
[DoesNotReturn] |
|||
public static void ThrowHeapViolated() => throw new InvalidOperationException("Huffman heap invariant violated."); |
|||
|
|||
[DoesNotReturn] |
|||
public static void ThrowNoDeflate() => throw new ImageFormatException("Cannot deflate all input."); |
|||
} |
|||
|
|||
@ -1,21 +1,33 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
using System.Diagnostics.CodeAnalysis; |
|||
|
|||
namespace SixLabors.ImageSharp.Formats.Tiff; |
|||
|
|||
internal static class TiffThrowHelper |
|||
{ |
|||
[DoesNotReturn] |
|||
public static Exception ThrowImageFormatException(string errorMessage) => throw new ImageFormatException(errorMessage); |
|||
|
|||
[DoesNotReturn] |
|||
public static Exception ThrowInvalidImageContentException(string errorMessage) => throw new InvalidImageContentException(errorMessage); |
|||
|
|||
[DoesNotReturn] |
|||
public static Exception NotSupportedDecompressor(string compressionType) => throw new NotSupportedException($"Not supported decoder compression method: {compressionType}"); |
|||
|
|||
[DoesNotReturn] |
|||
public static Exception NotSupportedCompressor(string compressionType) => throw new NotSupportedException($"Not supported encoder compression method: {compressionType}"); |
|||
|
|||
[DoesNotReturn] |
|||
public static Exception InvalidColorType(string colorType) => throw new NotSupportedException($"Invalid color type: {colorType}"); |
|||
|
|||
[DoesNotReturn] |
|||
public static Exception ThrowInvalidHeader() => throw new ImageFormatException("Invalid TIFF file header."); |
|||
|
|||
[DoesNotReturn] |
|||
public static void ThrowNotSupported(string message) => throw new NotSupportedException(message); |
|||
|
|||
[DoesNotReturn] |
|||
public static void ThrowArgumentException(string message) => throw new ArgumentException(message); |
|||
} |
|||
|
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
using SixLabors.ImageSharp.Memory; |
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
namespace SixLabors.ImageSharp.Formats.Tiff.Writers; |
|||
|
|||
internal sealed class TiffGrayL16Writer<TPixel> : TiffCompositeColorWriter<TPixel> |
|||
where TPixel : unmanaged, IPixel<TPixel> |
|||
{ |
|||
public TiffGrayL16Writer(ImageFrame<TPixel> image, MemoryAllocator memoryAllocator, Configuration configuration, TiffEncoderEntriesCollector entriesCollector) |
|||
: base(image, memoryAllocator, configuration, entriesCollector) |
|||
{ |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
public override int BitsPerPixel => 16; |
|||
|
|||
/// <inheritdoc />
|
|||
protected override void EncodePixels(Span<TPixel> pixels, Span<byte> buffer) => PixelOperations<TPixel>.Instance.ToL16Bytes(this.Configuration, pixels, buffer, pixels.Length); |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue