Ejemplo n.º 1
0
        public byte[] Save(IEnumerable <Color> colors)
        {
            var etc1encoder = new Support.ETC1.Encoder(_3ds_order);

            var ms = new MemoryStream();

            using (var bw = new BinaryWriterX(ms, byteOrder))
            {
                foreach (var color in colors)
                {
                    etc1encoder.Set(color, data =>
                    {
                        if (alpha)
                        {
                            bw.Write(data.Alpha);
                        }
                        ulong colorBlock = 0;
                        colorBlock      |= data.Block.LSB;
                        colorBlock      |= ((ulong)data.Block.MSB << 16);
                        colorBlock      |= ((ulong)data.Block.flags << 32);
                        colorBlock      |= ((ulong)data.Block.B << 40);
                        colorBlock      |= ((ulong)data.Block.G << 48);
                        colorBlock      |= ((ulong)data.Block.R << 56);
                        bw.Write(colorBlock);
                    });
                }
            }

            return(ms.ToArray());
        }
Ejemplo n.º 2
0
        public byte[] Save(IEnumerable <Color> colors)
        {
            var etc1encoder = new Support.ETC1.Encoder();

            var ms = new MemoryStream();

            using (var bw = new BinaryWriterX(ms))
            {
                foreach (var color in colors)
                {
                    etc1encoder.Set(color, data =>
                    {
                        if (alpha)
                        {
                            bw.Write(data.Alpha);
                        }
                        bw.WriteStruct(data.Block);
                    });
                }
            }

            return(ms.ToArray());
        }