コード例 #1
0
        public void BackgroundColor_amount_BackgroundColorProcessorDefaultsSet()
        {
            this.operations.BackgroundColor(Color.BlanchedAlmond);
            BackgroundColorProcessor processor = this.Verify <BackgroundColorProcessor>();

            Assert.Equal(this.options, processor.GraphicsOptions);
            Assert.Equal(Color.BlanchedAlmond, processor.Color);
        }
コード例 #2
0
        public void BackgroundColor_amount_rect_options_BackgroundColorProcessorDefaultsSet()
        {
            this.operations.BackgroundColor(this.options, Color.BlanchedAlmond, this.rect);
            BackgroundColorProcessor processor = this.Verify <BackgroundColorProcessor>(this.rect);

            Assert.Equal(this.options, processor.GraphicsOptions, GraphicsOptionsComparer);
            Assert.Equal(Color.BlanchedAlmond, processor.Color);
        }
コード例 #3
0
ファイル: BackgroundColor.cs プロジェクト: ITTalk/2016_Krakow
        /// <summary>
        /// Replaces the background color of image with the given one.
        /// </summary>
        /// <typeparam name="T">The pixel format.</typeparam>
        /// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
        /// <param name="source">The image this method extends.</param>
        /// <param name="color">The color to set as the background.</param>
        /// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
        /// <returns>The <see cref="Image{T,TP}"/>.</returns>
        public static Image <T, TP> BackgroundColor <T, TP>(this Image <T, TP> source, T color, ProgressEventHandler progressHandler = null)
            where T : IPackedVector <TP>
            where TP : struct
        {
            BackgroundColorProcessor <T, TP> processor = new BackgroundColorProcessor <T, TP>(color);

            processor.OnProgress += progressHandler;

            try
            {
                return(source.Process(source.Bounds, processor));
            }
            finally
            {
                processor.OnProgress -= progressHandler;
            }
        }