Example #1
0
 private static byte[] DecodeData(EndianBinaryReader stream, uint width, uint height, TextureFormats format, Palette imagePalette, PaletteFormats paletteFormat)
 {
     switch (format)
     {
         case TextureFormats.I4:
             return DecodeI4(stream, width, height);
         case TextureFormats.I8:
             return DecodeI8(stream, width, height);
         case TextureFormats.IA4:
             return DecodeIA4(stream, width, height);
         case TextureFormats.IA8:
             return DecodeIA8(stream, width, height);
         case TextureFormats.RGB565:
             return DecodeRgb565(stream, width, height);
         case TextureFormats.RGB5A3:
             return DecodeRgb5A3(stream, width, height);
         case TextureFormats.RGBA32:
             return DecodeRgba32(stream, width, height);
         case TextureFormats.C4:
             return DecodeC4(stream, width, height, imagePalette, paletteFormat);
         case TextureFormats.C8:
             return DecodeC8(stream, width, height, imagePalette, paletteFormat);
         case TextureFormats.CMPR:
             return DecodeCmpr(stream, width, height);
         case TextureFormats.C14X2:
         default:
             WLog.Warning(LogCategory.Textures, null, "Unsupported Binary Texture Image format {0}, unable to decode!", format);
             return new byte[0];
     }
 }
 public static byte[] EncodeData(Bitmap bmp, uint width, uint height, TextureFormats format)
 {
     switch (format)
     {
         case TextureFormats.I4:
             return EncodeI4(bmp, width, height);
         default:
             return new byte[0];
     }
 }