当前位置: 首页>>代码示例>>C#>>正文


C# Palette.Load方法代码示例

本文整理汇总了C#中Palette.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Palette.Load方法的具体用法?C# Palette.Load怎么用?C# Palette.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Palette的用法示例。


在下文中一共展示了Palette.Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

        // headerStart seems to be chunkStart + 0x20 and I don't know why.
        public void Load(EndianBinaryReader stream, long headerStart, int imageIndex = 0)
        {
            Format = (TextureFormats)stream.ReadByte();
            AlphaSetting = stream.ReadByte();
            Width = stream.ReadUInt16();
            Height = stream.ReadUInt16();
            WrapS = (WrapModes)stream.ReadByte();
            WrapT = (WrapModes)stream.ReadByte();
            byte unknown1 = stream.ReadByte();
            PaletteFormat = (PaletteFormats)stream.ReadByte();
            PaletteCount = stream.ReadUInt16();
            int paletteDataOffset = stream.ReadInt32();
            BorderColor = new Color32(stream.ReadByte(), stream.ReadByte(), stream.ReadByte(), stream.ReadByte());
            MinFilter = (FilterMode)stream.ReadByte();
            MagFilter = (FilterMode)stream.ReadByte();
            short unknown2 = stream.ReadInt16();
            MipMapCount = stream.ReadByte();
            byte unknown3 = stream.ReadByte();
            LodBias = stream.ReadUInt16();

            int imageDataOffset = stream.ReadInt32();

            // Load the Palette data
            stream.BaseStream.Position = headerStart + paletteDataOffset + (0x20 * imageIndex);
            m_imagePalette = new Palette();
            m_imagePalette.Load(stream, PaletteCount);

            // Now load and decode image data into an ARGB array.
            stream.BaseStream.Position = headerStart + imageDataOffset + (0x20 * imageIndex);
            m_rgbaImageData = DecodeData(stream, Width, Height, Format, m_imagePalette, PaletteFormat);
        }
开发者ID:CryZe,项目名称:WindEditor2,代码行数:32,代码来源:BinaryTextureImage.cs

示例2: Load

        /// <summary>
        /// Loads a BTI file from a byte array. BTI files have two ways of being stored,
        /// both externally in their own file (simple), and embedded within another 
        /// file (complex). If you're loading from an isolated file, simply pass the
        /// entire file to data and zero for the other two parameters.
        /// 
        /// However, embedded files are more complicated. An embedded file stores the
        /// data in the following format: [bti header][bti header][bti header][bti data]
        /// [bti data][bti data]. The embedded bti files store their offsets relative not
        /// to the start of the first bti header, but to themselves.
        /// 
        /// To handle this, pass the offset into the byte[] that the header is at for 
        /// <paramref name="mainOffset"/> and then pass (btiHeaderIndex * FileHeader.Size)
        /// for <paramref name="dataOffset"/>. This load function will resolve the offsets
        /// for loading.
        /// </summary>
        /// <param name="data">Array holding entire BTI file.</param>
        /// <param name="mainOffset">Offset from start of array to BTI file.</param>
        /// <param name="dataOffset">Additional offset required by embedded BTI files.</param>
        public void Load(byte[] data, uint mainOffset, uint dataOffset)
        {
            _header = new FileHeader();
            _header.Load(data, mainOffset);

            //Copy our public settings out of the header and into the BinaryTextureImage instance.
            Format = _header.Format;
            Width = _header.Width;
            Height = _header.Height;
            WrapS = _header.WrapS;
            WrapT = _header.WrapT;
            MinFilter = _header.FilterSettingMin;
            MagFilter = _header.FilterSettingMag;

            //Grab the palette data
            _imagePalette = new Palette();
            _imagePalette.Load(data, _header.PaletteEntryCount, dataOffset + _header.PaletteDataOffset);

            //Now lets load a copy of the image data out of the file.
            _argbImageData = DecodeData(data, Width, Height, dataOffset + _header.ImageDataOffset, Format, _imagePalette, _header.PaletteFormat);
        }
开发者ID:CryZe,项目名称:WindEditor,代码行数:40,代码来源:BinaryTextureImage.cs


注:本文中的Palette.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。