示例#1
0
        public static bool SaveToStream(BinaryWriter outputWriter, Texture texture)
        {
            TextureStorage storage = new TextureStorage(string.Empty, texture);

            if (!storage.Write(outputWriter))
            {
                Debug.Assert(false, "Cannot write a texture file!");
                return(false);
            }

            return(true);
        }
示例#2
0
        public static bool SaveToFile(string filePath, Texture texture)
        {
            TextureStorage storage = new TextureStorage(filePath, texture);

            using (FileStream outputStream = new FileStream(filePath, FileMode.Create, FileAccess.Write))
            {
                using (BinaryWriter outputWriter = new BinaryWriter(outputStream, storage.Encoding))
                {
                    if (!storage.Write(outputWriter))
                    {
                        Debug.Assert(false, "Cannot write a texture file!");
                        return(false);
                    }
                }
            }

            return(true);
        }