Beispiel #1
0
        void ReadCMP(ABinaryReader binaryReader)
        {
            // image
            for (int y = 0; y < Height; y += 8)
            {
                for (int x = 0; x < Width; x += 8)
                {
                    // 2x2 block
                    for (int ay = 0; ay < 8; ay += 4)
                    {
                        for (int ax = 0; ax < 8; ax += 4)
                        {
                            // 4x4 tile
                            Color[] colors = Color.FromST3C1(binaryReader.Read64());

                            for (int by = 0; by < 4 && y + ay + by < Height; by++)
                            {
                                for (int bx = 0; bx < 4 && x + ax + bx < Width; bx++)
                                {
                                    data[Width * (y + ay + by) + (x + ax + bx)] = colors[by * 4 + bx];
                                }
                            }
                        }
                    }
                }
            }
        }