mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
// Copyright (c) Six Labors and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
using System.IO;
|
|
using SixLabors.ImageSharp.PixelFormats;
|
|
|
|
namespace SixLabors.ImageSharp.Formats.Tga
|
|
{
|
|
/// <summary>
|
|
/// Image decoder for Truevision TGA images.
|
|
/// </summary>
|
|
public sealed class TgaDecoder : IImageDecoder, ITgaDecoderOptions, IImageInfoDetector
|
|
{
|
|
/// <inheritdoc/>
|
|
public Image<TPixel> Decode<TPixel>(Configuration configuration, Stream stream)
|
|
where TPixel : struct, IPixel<TPixel>
|
|
{
|
|
Guard.NotNull(stream, nameof(stream));
|
|
|
|
return new TgaDecoderCore(configuration, this).Decode<TPixel>(stream);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public Image Decode(Configuration configuration, Stream stream) => this.Decode<Rgba32>(configuration, stream);
|
|
|
|
/// <inheritdoc/>
|
|
public IImageInfo Identify(Configuration configuration, Stream stream)
|
|
{
|
|
Guard.NotNull(stream, nameof(stream));
|
|
|
|
return new TgaDecoderCore(configuration, this).Identify(stream);
|
|
}
|
|
}
|
|
}
|
|
|