예제 #1
0
        public static EncodedImage EncodeImage_A5I3(PalettedImage Image)
        {
            List <byte> Texture = new List <byte>();

            foreach (byte b in Image.Indices)
            {
                int IDX = Convert.ToInt32(b);
                int a   = Image.Palette.Entries[IDX].A;

                Texture.Add((byte)(IDX | (a > 252 ? 0xF8 : ((a + 3) & 0xF8))));
            }

            return(new EncodedImage(Texture.ToArray(), EncodePalette(Image.Palette)));
        }
예제 #2
0
        public static EncodedImage EncodeImage_I4(PalettedImage Image)
        {
            List <byte> Texture = new List <byte>();

            for (int i = 0; i < Image.Indices.Count() / 2; i += 2)
            {
                int v1 = Image.Indices[i + 0];
                int v2 = Image.Indices[i + 1];

                Texture.Add((byte)(v2 << 4 | v1));
            }
            ;

            return(new EncodedImage(Texture.ToArray(), EncodePalette(Image.Palette)));
        }
예제 #3
0
        public static EncodedImage EncodeImage(PalettedImage Image, int TexType)
        {
            switch (TexType)
            {
            case 1: return(EncodeImage_A3I5(Image));

            case 2: return(EncodeImage_I2(Image));

            case 3: return(EncodeImage_I4(Image));

            case 4: return(EncodeImage_I8(Image));

            case 6: return(EncodeImage_A5I3(Image));

            default: return(null);
            }
        }
예제 #4
0
 public static EncodedImage EncodeImage_I8(PalettedImage Image)
 {
     return(new EncodedImage(Image.Indices, EncodePalette(Image.Palette)));
 }