tgalib-core 0.3.0

dotnet add package tgalib-core --version 0.3.0                
NuGet\Install-Package tgalib-core -Version 0.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="tgalib-core" Version="0.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add tgalib-core --version 0.3.0                
#r "nuget: tgalib-core, 0.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install tgalib-core as a Cake Addin
#addin nuget:?package=tgalib-core&version=0.3.0

// Install tgalib-core as a Cake Tool
#tool nuget:?package=tgalib-core&version=0.3.0                

TgaLib core

  • Forked from shns/TgaLib:master in order to upgrade project file for .Net 8
  • Removed platform specific parts so this could work on non-Windows OS.
  • Added my old (2004 / Java) implementation for saving&loading of 24bit RGB TGA images.

TgaLib


TgaLib is a library to decode TARGA image format.

Following features are support:

  • RLE and raw TARGA images with 8/15/16/24/32 bits per pixel, monochrome, truecolor and colormapped images.
  • Image origins, attribute type in extensions area.

Example


// Load the original TGA image
TgaImage actualImage = new("test_8bit.tga");

// Save the image using the specified TgaMode
using FileStream fs = File.Create("test03.tga");
TgaFileFormat.CommonSave(TgaMode.Pal8Rle, fs, actualImage);

// Reload the saved image
TgaImage actualImage2 = new("test03.tga");

// Compare dimensions
int width = actualImage.Width;
int height = actualImage.Height;

Assert.That(width, Is.EqualTo(actualImage2.Width));
Assert.That(height, Is.EqualTo(actualImage2.Height));

// Compare pixel data
for (int x = 0; x < width; x++)
{
    for (int y = 0; y < height; y++)
    {
        actualImage.GetPixelRgba(x, y, out int r1, out int g1, out int b1, out int a1);
        actualImage2.GetPixelRgba(x, y, out int r2, out int g2, out int b2, out int a2);
        Assert.That(r1, Is.EqualTo(r2), $"Red component mismatch at ({x}, {y})");
        Assert.That(g1, Is.EqualTo(g2), $"Green component mismatch at ({x}, {y})");
        Assert.That(b1, Is.EqualTo(b2), $"Blue component mismatch at ({x}, {y})");
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.0 130 10/18/2024
0.2.0-alpha 94 10/17/2024
0.1.1-alpha 89 10/17/2024