VrSharp.PvrTexture.PvrTexture.SetPalette C# (CSharp) Method

SetPalette() public method

Set the palette data from an external palette file.
public SetPalette ( VrSharp.PvrTexture.PvpPalette clut ) : void
clut VrSharp.PvrTexture.PvpPalette A PvpPalette object
return void
        public void SetPalette(PvpPalette clut)
        {
            SetPalette((VpPalette)clut);
        }

Usage Example

Beispiel #1
0
        /// <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 PVR textures is done through VrSharp, so just pass it to that
            VrSharp.PvrTexture.PvrTexture texture = new VrSharp.PvrTexture.PvrTexture(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 PvpPalette(PaletteStream));
                    }
                    else
                    {
                        texture.SetPalette(new PvpPalette(PaletteStream, PaletteLength));
                    }

                    PaletteStream = null;
                    PaletteLength = -1;
                }
                else
                {
                    throw new TextureNeedsPaletteException();
                }
            }

            texture.Save(destination);
        }
All Usage Examples Of VrSharp.PvrTexture.PvrTexture::SetPalette