예제 #1
0
            public override byte[] Decode(byte[] source, int sourceIndex, int width, int height)
            {
                // Destination data
                byte[] destination = new byte[width * height * 4];

                // Get the size of each block to process.
                int size = Math.Min(width, height);

                // Twiddle map
                int[] twiddleMap = MakeTwiddleMap(size);

                // Decode texture data
                for (int y = 0; y < height; y += size)
                {
                    for (int x = 0; x < width; x += size)
                    {
                        for (int y2 = 0; y2 < size; y2++)
                        {
                            for (int x2 = 0; x2 < size; x2++)
                            {
                                PixelCodec.DecodePixel(source, sourceIndex + (((twiddleMap[x2] << 1) | twiddleMap[y2]) << (PixelCodec.Bpp >> 4)), destination, ((((y + y2) * width) + (x + x2)) * 4));
                            }
                        }

                        sourceIndex += (size * size) * (PixelCodec.Bpp >> 3);
                    }
                }

                return(destination);
            }
예제 #2
0
            public override byte[] Decode(byte[] source, int sourceIndex, int width, int height)
            {
                // Destination data & index
                byte[] destination      = new byte[width * height * 4];
                int    destinationIndex = 0;

                // Decode texture data
                for (int y = 0; y < height; y++)
                {
                    for (int x = 0; x < width; x++)
                    {
                        PixelCodec.DecodePixel(source, sourceIndex + GetSwizzledOffset(x, y, width, height, PixelCodec.Bpp), destination, destinationIndex);
                        destinationIndex += 4;
                    }
                }

                return(destination);
            }
예제 #3
0
            public override byte[] Decode(byte[] source, int sourceIndex, int width, int height)
            {
                // Destination data & index
                byte[] destination      = new byte[width * height * 4];
                int    destinationIndex = 0;

                // Twiddle map
                int[] twiddleMap = MakeTwiddleMap(width);

                // Decode texture data
                for (int y = 0; y < height; y++)
                {
                    for (int x = 0; x < width; x++)
                    {
                        PixelCodec.DecodePixel(source, sourceIndex + (((twiddleMap[x] << 1) | twiddleMap[y]) << (PixelCodec.Bpp >> 4)), destination, destinationIndex);
                        destinationIndex += 4;
                    }
                }

                return(destination);
            }