DecompressColour() public static méthode

public static DecompressColour ( byte block, int blockOffset, bool isDxt1 ) : byte[]
block byte
blockOffset int
isDxt1 bool
Résultat byte[]
        public static byte[] DecompressBlock(byte[] block, int blockOffset, SquishOptions flags)
        {
            // Get the block locations
            var colOff   = blockOffset;
            var alphaOff = blockOffset;

            if ((flags & (SquishOptions.DXT3 | SquishOptions.DXT5)) != 0)
            {
                colOff += 8;
            }

            // Decompress colour.
            var rgba = ColourBlock.DecompressColour(block, colOff, flags.HasFlag(SquishOptions.DXT1));

            // Decompress alpha seperately if necessary.
            if (flags.HasFlag(SquishOptions.DXT3))
            {
                Alpha.DecompressAlphaDxt3(block, alphaOff, rgba, 0);
            }
            else if (flags.HasFlag(SquishOptions.DXT5))
            {
                Alpha.DecompressAlphaDxt5(block, alphaOff, rgba, 0);
            }

            return(rgba);
        }
Exemple #2
0
        static void Decompress(byte[] rgba, ref byte[] block, int offset, SquishFlags flags)
        {
            // fix any bad flags
            flags = FixFlags(flags);

            // get the block locations
            int colourBlock = offset;
            int alphaBlock  = offset;

            if ((flags & (SquishFlags.kDxt3 | SquishFlags.kDxt5)) != 0)
            {
                colourBlock += 8;
            }

            // decompress colour
            ColourBlock.DecompressColour(rgba, ref block, colourBlock, (flags & SquishFlags.kDxt1) != 0);

            // decompress alpha separately if necessary
            if ((flags & SquishFlags.kDxt3) != 0)
            {
                throw new NotImplementedException("Squish.DecompressAlphaDxt3");
                //DecompressAlphaDxt3(rgba, alphaBlock);
            }
            else if ((flags & SquishFlags.kDxt5) != 0)
            {
                DecompressAlphaDxt5(rgba, ref block, alphaBlock);
            }
        }