示例#1
0
        public static byte[] WrapToPVR(Stream stream, PVRConvertParameters @params)
        {
            byte[] buffer = new byte[HeaderSize + @params.DataLength];
            using (MemoryStream memStream = new MemoryStream(buffer))
            {
                using (BinaryWriter writer = new BinaryWriter(memStream))
                {
                    writer.Write(Version);
                    writer.Write((uint)Flags);
                    writer.Write((ulong)@params.PixelFormat);
                    writer.Write((uint)ColourSpace);
                    writer.Write((uint)ChannelType);
                    writer.Write(@params.Height);
                    writer.Write(@params.Width);
                    writer.Write(Depth);
                    writer.Write(NumSurfaces);
                    writer.Write(NumFaces);
                    writer.Write(@params.MipMapCount);
                    writer.Write(MetaDataSize);

                    stream.CopyStream(writer.BaseStream, @params.DataLength);
                }
            }
            return(buffer);
        }
示例#2
0
 public static byte[] WraptToPVR(byte[] data, int offset, PVRConvertParameters @params)
 {
     using (MemoryStream stream = new MemoryStream(data))
     {
         stream.Position = offset;
         return(WrapToPVR(stream, @params));
     }
 }