Download RiffPaletteLoader.zip version 1.0.0.0, last updated 18/02/2017 (15.41 KB)

Download
  • md5: 3b1ed86c3076e401c7f8c1d79c610800
  • sha1: b71a2ed2f72637eb844530aa845fa9642c16b74f
  • sha256: 65ed960371418198622905bab618209fe66b36fb490c66c0f40a2f0548a42b3e
// Loading Microsoft RIFF Palette (pal) files with C#
// http://cyotek.com/blog/loading-microsoft-riff-palette-pal-files-with-csharp

namespace Cyotek.Demonstrations.RiffPaletteLoader
{
  internal static class StreamExtensions
  {
    #region Static Methods

    public static int ToInt(this byte[] buffer, int offset)
    {
      return buffer[offset + 3] << 24 | buffer[offset + 2] << 16 | buffer[offset + 1] << 8 | buffer[offset];
    }

    public static ushort ToInt16(this byte[] buffer, int offset)
    {
      return (ushort)(buffer[offset + 1] << 8 | buffer[offset]);
    }

    #endregion
  }
}

Donate

Donate