예제 #1
0
        internal DotIndexedColor(DotColorScheme scheme, int index)
        {
            if (scheme.IsIndexed == false)
            {
                throw new InvalidOperationException("Color scheme is not indexed");
            }

            Scheme = scheme;
            Index  = index;
        }
예제 #2
0
        public DotColorScheme this[int colorsNum]
        {
            get
            {
                if (colorsNum < MinColors || colorsNum > MaxColors)
                {
                    throw new ArgumentOutOfRangeException(nameof(colorsNum));
                }

                var            schemeName = Value + colorsNum;
                DotColorScheme scheme;

                if (SchemeCache.TryGetValue(schemeName, out scheme))
                {
                    return(scheme);
                }

                scheme = new DotColorScheme(schemeName, colorsNum);

                SchemeCache.Add(schemeName, scheme);

                return(scheme);
            }
        }