Archive Browser
Download RiffPaletteWriter.zip version 1.0.0.0, last updated 04/03/2017 (14.94 KB)
Download- md5: 2864394d3c1cc948887ced13c5d5bedf
- sha1: dc44b4f4d8d6318030d6460a5f88f43aa345ce2f
- sha256: 8781446c207bc5faf4021226bdbd3789c6acdd21efbaeaa101dbcca0a2749abf
// Loading Microsoft RIFF Palette (pal) files with C#
// http://cyotek.com/blog/loading-microsoft-riff-palette-pal-files-with-csharp
// Writing Microsoft RIFF Palette (pal) files with C#
// http://cyotek.com/blog/writing-microsoft-riff-palette-pal-files-with-csharp
using System;
namespace Cyotek.Demonstrations.RiffPaletteWriter
{
internal static class WordHelpers
{
#region Static Methods
public static int GetInt32(this byte[] buffer, int offset)
{
return buffer[offset + 3] << 24 | buffer[offset + 2] << 16 | buffer[offset + 1] << 8 | buffer[offset];
}
public static ushort GetInt16(this byte[] buffer, int offset)
{
return (ushort)(buffer[offset + 1] << 8 | buffer[offset]);
}
public static void PutInt32(int value, byte[] buffer, int offset)
{
buffer[offset + 3] = (byte)((value & 0xFF000000) >> 24);
buffer[offset + 2] = (byte)((value & 0x00FF0000) >> 16);
buffer[offset + 1] = (byte)((value & 0x0000FF00) >> 8);
buffer[offset] = (byte)((value & 0x000000FF) >> 0);
}
public static void PutInt16(ushort value, byte[] buffer, int offset)
{
buffer[offset + 1] = (byte)((value & 0x0000FF00) >> 8);
buffer[offset] = (byte)((value & 0x000000FF) >> 0);
}
#endregion
}
}
Donate
This software may be used free of charge, but as with all free software there are costs involved to develop and maintain.
If this site or its services have saved you time, please consider a donation to help with running costs and timely updates.
Donate