Skip to content

Repository files navigation

StbDxtSharp

NuGetBuild statusChat

C# port of stb_dxt.h

Adding Reference

There are two ways of referencing StbDxtSharp in the project:

  1. Through nuget: https://www.nuget.org/packages/StbDxtSharp/

  2. As source code. There are two options:

    a. Add src/StbDxtSharp.csproj to the solution

    b. Include *.cs from folder "src" directly in the project. In this case, it might make sense to add STBSHARP_INTERNAL build compilation symbol to the project, so StbDxtSharp classes would become internal.

FNA/MonoGame Sample Code

using(varstream=TitleContainer.OpenStream("image.png")){// Load the image using StbImageSharp(https://github.com/StbSharp/StbImageSharp)varir=ImageResult.FromStream(stream,ColorComponents.RedGreenBlueAlpha);// Compress it using StbDxtSharpvarcompressedData=StbDxt.CompressDxt5(ir.Width,ir.Height,ir.Data);// Create texture from the compressed data_texture=newTexture2D(GraphicsDevice,ir.Width,ir.Height,false,SurfaceFormat.Dxt5);_texture.SetData(compressedData);}

License

Public Domain

About

C# port of stb_dxt.h

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages