/// <summary> /// Saves the encoded texture to the specified stream. /// </summary> /// <param name="destination">The stream to save the texture to.</param> public void Save(Stream destination) { if (!initalized) { throw new TextureNotInitalizedException("Cannot encode this texture as it is not initalized."); } MemoryStream textureStream = EncodeTexture(); textureStream.Position = 0; PTStream.CopyTo(textureStream, destination); }
/// <summary> /// Saves the encoded texture to the specified path. /// </summary> /// <param name="path">Name of the file to save the data to.</param> public void Save(string path) { if (!initalized) { throw new TextureNotInitalizedException("Cannot encode this texture as it is not initalized."); } using (FileStream destination = File.Create(path)) { MemoryStream textureStream = EncodeTexture(); textureStream.Position = 0; PTStream.CopyTo(textureStream, destination); } }