예제 #1
0
        private void ExportDDS(IExportContainer container, Stream destination, Stream source, long length)
        {
            DDSConvertParameters @params = new DDSConvertParameters()
            {
                DataLength          = length,
                MipMapCount         = MipCount,
                Width               = Width,
                Height              = Height,
                IsPitchOrLinearSize = DDSIsPitchOrLinearSize,
                PixelFormatFlags    = DDSPixelFormatFlags,
                FourCC              = (DDSFourCCType)DDSFourCC,
                RGBBitCount         = DDSRGBBitCount,
                RBitMask            = DDSRBitMask,
                GBitMask            = DDSGBitMask,
                BBitMask            = DDSBBitMask,
                ABitMask            = DDSABitMask,
                Caps = DDSCaps(container.Version),
            };

            if (IsSwapBytes(container.Platform))
            {
                using (ReverseStream reverse = new ReverseStream(source, source.Position, length, true))
                {
                    DDSConverter.ExportDDS(destination, reverse, @params);
                }
            }
            else
            {
                DDSConverter.ExportDDS(destination, source, @params);
            }
        }
예제 #2
0
        private void ExportDDS(IExportContainer container, Stream destination, Stream source, long length)
        {
            DDSConvertParameters @params = new DDSConvertParameters()
            {
                DataLength          = length,
                MipMapCount         = MipCount,
                Width               = Width,
                Height              = Height,
                IsPitchOrLinearSize = DDSIsPitchOrLinearSize,
                PixelFormatFlags    = DDSPixelFormatFlags,
                FourCC              = (DDSFourCCType)DDSFourCC,
                RGBBitCount         = DDSRGBBitCount,
                RBitMask            = DDSRBitMask,
                GBitMask            = DDSGBitMask,
                BBitMask            = DDSBBitMask,
                ABitMask            = DDSABitMask,
                Caps = DDSCaps(container.Version),
            };

            EndianType endianess = IsSwapBytes(container.Platform) ? EndianType.BigEndian : EndianType.LittleEndian;

            using (EndianReader sourceReader = new EndianReader(source, endianess))
            {
                DDSConverter.ExportDDS(sourceReader, destination, @params);
            }
        }