Exemple #1
0
        /// <summary>
        /// Applies black and white toning to the image.
        /// </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="rectangle">
        /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
        /// </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> BlackWhite <T, TP>(this Image <T, TP> source, Rectangle rectangle, ProgressEventHandler progressHandler = null)
            where T : IPackedVector <TP>
            where TP : struct
        {
            BlackWhiteProcessor <T, TP> processor = new BlackWhiteProcessor <T, TP>();

            processor.OnProgress += progressHandler;

            try
            {
                return(source.Process(rectangle, processor));
            }
            finally
            {
                processor.OnProgress -= progressHandler;
            }
        }
Exemple #2
0
 public void BlackWhite_rect_CorrectProcessor()
 {
     this.operations.BlackWhite(this.rect);
     BlackWhiteProcessor <Rgba32> p = this.Verify <BlackWhiteProcessor <Rgba32> >(this.rect);
 }
 public void BlackWhite_CorrectProcessor()
 {
     this.operations.BlackWhite();
     BlackWhiteProcessor p = this.Verify <BlackWhiteProcessor>();
 }