private IRenderer <ColorAlpha8> CreateMaskRenderer()
        {
            IRenderer <ColorAlpha8> renderer;
            byte       x         = (byte)Math.Round((double)(this.changes.Tolerance * 255.0), MidpointRounding.AwayFromZero);
            byte       tolerance = ByteUtil.FastScale(x, x);
            PointInt32 pt        = this.changes.OriginPointInt32;

            if (!this.sampleSource.Bounds <ColorBgra>().Contains(pt))
            {
                return(new FillRendererAlpha8(this.sampleSource.Width, this.sampleSource.Height, ColorAlpha8.Transparent));
            }
            ColorBgra pointSlow = this.sampleSource.GetPointSlow(pt);

            base.ThrowIfCancellationRequested();
            if (this.changes.FloodMode == FloodMode.Global)
            {
                renderer = new FillStencilByColorRenderer(this.sampleSource, pointSlow, tolerance, this);
            }
            else
            {
                RectInt32         num5;
                BitVector2D       source        = new BitVector2D(this.sampleSource.Width, this.sampleSource.Height);
                BitVector2DStruct stencilBuffer = new BitVector2DStruct(source);
                source.Clear(true);
                base.ThrowIfCancellationRequested();
                foreach (RectInt32 num6 in this.changes.ClippingMask.EnumerateInteriorScans())
                {
                    source.Set(num6, false);
                    base.ThrowIfCancellationRequested();
                }
                BitVector2D other = source.Clone();
                base.ThrowIfCancellationRequested();
                FloodFillAlgorithm.FillStencilFromPoint <BitVector2DStruct>(this.sampleSource, stencilBuffer, pt, tolerance, this, out num5);
                base.ThrowIfCancellationRequested();
                source.Xor(other);
                base.ThrowIfCancellationRequested();
                renderer = new BitVector2DToAlpha8Renderer <BitVector2DStruct>(stencilBuffer);
            }
            if (this.changes.Antialiasing)
            {
                return(new FeatheredMaskRenderer(this.sampleSource, pointSlow, renderer, tolerance, this));
            }
            return(renderer);
        }