Ejemplo n.º 1
0
        public static CCAColorScale CreateCoverageScale(short ccaRequiredMinimumPasses)
        {
            var ccaColorScale = new CCAColorScale(new List <CCAColorScaleSegment>());

            // From the CTCT Tonka source code...
            //
            // This might seem a little odd, but what we do here is use
            // CreateInitialCoverageScale() to create a colour scale emulating the way
            // the old code used to do it. The old colour scale was quite complex and
            // although it looked like separate blocks of colour it was actually using
            // a few solid colour blocks with interpolated colours. It was very tricky
            // to get things to match when doing lookups and such though. So what we do
            // is recreate the old scale and then query it to build a new scale of
            // individual blocks of colour.
            CreateInitialCoverageScale(ccaRequiredMinimumPasses, ref ccaColorScale);

            var colorSegments = new List <CCAColorScaleSegment>();

            var isHatched = false;

            for (var i = ccaRequiredMinimumPasses; i >= 1; i--)
            {
                var tempColor       = ccaColorScale.Lookup(i, ref isHatched);
                var newColorSegment = new CCAColorScaleSegment(i, i, tempColor, isHatched);
                colorSegments.Insert(colorSegments.Count, newColorSegment);
            }

            ccaColorScale.IsSolidColors = true;
            ccaColorScale.HasTarget     = true;
            ccaColorScale.ColorSegments = colorSegments;

            return(ccaColorScale);
        }