VSViewer.FileFormats.Palette.GetColorCount C# (CSharp) Метод

GetColorCount() публичный Метод

public GetColorCount ( ) : int
Результат int
        public int GetColorCount()
        {
            return colors.Count;
        }

Usage Example

Пример #1
0
        private static void ConstructWeaponPalettes(EndianBinaryReader reader, List<TextureMap> outTextures, int numOfPalettes, int width, int height, byte colorsPerPalette)
        {
            // construct the handle palette the first 1/3 of the colors.
            Palette handlePalette = new Palette();
            for (int i = 0; i < colorsPerPalette / 3; i++)
            {
                handlePalette.colors.Add(VSTools.BitColorConverter(reader.ReadUInt16()));
            }

            // construct the next 7 palettes out of the data stream that follows.
            for (int p = 0; p < numOfPalettes; p++)
            {
                TextureMap tex = new TextureMap(width, height);
                Palette palette = new Palette();

                // pack first 1/3 with handle colors.
                for (int h = 0; h < handlePalette.GetColorCount(); h++)
                {
                    palette.colors.Add(handlePalette.colors[h]);
                }

                int count = (int)(colorsPerPalette / 3);
                count += count;

                // read blade from stream
                for (int c = 0; c < count; c++)
                {
                    palette.colors.Add(VSTools.BitColorConverter(reader.ReadUInt16()));
                }
                tex.ColorPalette = palette;

                tex.Index = p;
                outTextures.Add(tex);
            }
        }