Skip to content
wowdevPublic

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

61 Commits

Folders and files

Repository files navigation

BLPSharp (formerly known as SereniaBLPLib)

.NET library for decoding BLP textures. Uses TinyBCSharp for fast texture decompression.

Initially created under the name of SereniaBLPLib by Xalcon & later maintained by hazzik & tomrus88.

Available on NuGet.

Notes

Due to not relying on any specific image library anymore, support for BLPs containing JPEG-encoded data was removed and will throw a NYI exception. If someone wants to add this back without relying on a specific image library, feel free to open a PR.

Sample usage

    using (var fs = File.OpenRead("test.blp"))
    {
        var blp = new BLPFile(fs);
        var pixels = blp.GetPixels(mipmapLevel, out int w, out int h);
        // Pixel handling code, see below!
    }

System.Drawing.Bitmap

    Bitmap bmp = new Bitmap(w, h);
    BitmapData bmpdata = bmp.LockBits(new System.Drawing.Rectangle(0, 0, w, h), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
    Marshal.Copy(pixels, 0, bmpdata.Scan0, pixels.Length);
    bmp.UnlockBits(bmpdata);

ImageSharp

    var image = SixLabors.ImageSharp.Image.LoadPixelData<Bgra32>(pixels, w, h);

SkiaSharp

    var bitmap = new SKBitmap(w, h, SKColorType.Bgra8888, SKAlphaType.Unpremul);
    using var pixmap = bitmap.PeekPixels();
    var data = pixmap.GetPixelSpan<byte>();
    pixels.CopyTo(data);

NetVips

    using var raw = Image.NewFromMemory(pixels, w, h, 4, Enums.BandFormat.Uchar);
    using var image = raw[2].Bandjoin([raw[1], raw[0], raw[3]]).Copy(interpretation: Enums.Interpretation.Srgb);

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages