Beispiel #1
0
        private unsafe static byte[] Read2Bpp(AMemory Memory, Texture Texture)
        {
            int Width  = Texture.Width;
            int Height = Texture.Height;

            byte[] Output = new byte[Width * Height * 2];

            ISwizzle Swizzle = GetSwizzle(Texture, 2);

            fixed(byte *BuffPtr = Output)
            {
                long OutOffs = 0;

                for (int Y = 0; Y < Height; Y++)
                {
                    for (int X = 0; X < Width; X++)
                    {
                        long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);

                        short Pixel = Memory.ReadInt16Unchecked(Texture.Position + Offset);

                        *(short *)(BuffPtr + OutOffs) = Pixel;

                        OutOffs += 2;
                    }
                }
            }

            return(Output);
        }