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.
27 lines
925 B
27 lines
925 B
// Copyright (c) Six Labors.
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
namespace SixLabors.ImageSharp.Formats.Tga;
|
|
|
|
/// <summary>
|
|
/// Image encoder for writing an image to a stream as a Targa true-vision image.
|
|
/// </summary>
|
|
public sealed class TgaEncoder : ImageEncoder
|
|
{
|
|
/// <summary>
|
|
/// Gets the number of bits per pixel.
|
|
/// </summary>
|
|
public TgaBitsPerPixel? BitsPerPixel { get; init; }
|
|
|
|
/// <summary>
|
|
/// Gets a value indicating whether no compression or run length compression should be used.
|
|
/// </summary>
|
|
public TgaCompression Compression { get; init; } = TgaCompression.RunLength;
|
|
|
|
/// <inheritdoc/>
|
|
protected override void Encode<TPixel>(Image<TPixel> image, Stream stream, CancellationToken cancellationToken)
|
|
{
|
|
TgaEncoderCore encoder = new(this, image.Configuration.MemoryAllocator);
|
|
encoder.Encode(image, stream, cancellationToken);
|
|
}
|
|
}
|
|
|