public SetPalette ( VrSharp.GvrTexture.GvpPalette palette ) : void | ||
palette | VrSharp.GvrTexture.GvpPalette | |
return | void |
/// <summary> /// Decodes a texture from a stream. /// </summary> /// <param name="source">The stream to read from.</param> /// <param name="destination">The stream to write to.</param> /// <param name="length">Number of bytes to read.</param> public override void Read(Stream source, Stream destination) { // Reading GVR textures is done through VrSharp, so just pass it to that VrSharp.GvrTexture.GvrTexture texture = new VrSharp.GvrTexture.GvrTexture(source); // Check to see if this texture requires an external palette and throw an exception // if we do not have one defined if (texture.NeedsExternalPalette) { if (PaletteStream != null) { if (PaletteLength == -1) { texture.SetPalette(new GvpPalette(PaletteStream)); } else { texture.SetPalette(new GvpPalette(PaletteStream, PaletteLength)); } PaletteStream = null; PaletteLength = -1; } else { throw new TextureNeedsPaletteException(); } } texture.Save(destination); }
/// <summary> /// Decodes a texture from a stream. /// </summary> /// <param name="source">The stream to read from.</param> /// <param name="destination">The stream to write to.</param> /// <param name="length">Number of bytes to read.</param> public override void Read(Stream source, Stream destination) { // Reading GVR textures is done through VrSharp, so just pass it to that VrSharp.GvrTexture.GvrTexture texture = new VrSharp.GvrTexture.GvrTexture(source); // Check to see if this texture requires an external palette and throw an exception // if we do not have one defined if (texture.NeedsExternalPalette) { if (PaletteStream != null) { if (PaletteLength == -1) { texture.SetPalette(new GvpPalette(PaletteStream)); } else { texture.SetPalette(new GvpPalette(PaletteStream, PaletteLength)); } PaletteStream = null; PaletteLength = -1; } else { throw new TextureNeedsPaletteException(); } } texture.Save(destination); }