示例#1
0
        private void ParseUncompressed()
        {
            if ((_stream.Length - 128) / 4 < Width * Height)
            {
                Valid = false;
                Log.Msg("Invalid DDS file (size).");
                return;
            }

            var fileOffset = 0x7C;

            _pixelData = new Color8888[Width * Height];

            for (var i = 0; i < Width * Height; i++)
            {
                var rgba = BitConverter.ToUInt32(_stream, fileOffset += 0x04);
                _pixelData[i] = new Color8888((byte)((rgba >> 0x18) & 0xFF), (byte)((rgba >> 0x10) & 0xFF), (byte)((rgba >> 0x08) & 0xFF), (byte)(rgba & 0xFF));
            }
        }
示例#2
0
        private void ParseUncompressed()
        {
            if ((_stream.Length - 128) / 4 < Width * Height)
            {
                Valid = false;
                Log.Msg($"Invalid DDS file (size), '{_file.GetPath()}'");
                return;
            }

            var fileOffset = 0x7C;

            _pixelData = new Color8888[Width * Height];

            for (var i = 0; i < Width * Height; i++)
            {
                var rgba = MemoryHelper.ReadUInt32(_stream, fileOffset += 0x04);
                _pixelData[i] = new Color8888((byte)((rgba >> 0x18) & 0xFF), (byte)((rgba >> 0x10) & 0xFF), (byte)((rgba >> 0x08) & 0xFF), (byte)(rgba & 0xFF));
            }
        }