public void Contrast_amount_rect_ContrastProcessorDefaultsSet() { this.operations.Contrast(1.5F, this.rect); ContrastProcessor processor = this.Verify <ContrastProcessor>(this.rect); Assert.Equal(1.5F, processor.Amount); }
public void Contrast_amount_ContrastProcessorDefaultsSet() { this.operations.Contrast(1.5F); ContrastProcessor <Rgba32> processor = this.Verify <ContrastProcessor <Rgba32> >(); Assert.Equal(1.5F, processor.Amount); }
/// <summary> /// Alters the contrast component of 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="amount">The new contrast of the image. Must be between -100 and 100.</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> Contrast <T, TP>(this Image <T, TP> source, int amount, Rectangle rectangle, ProgressEventHandler progressHandler = null) where T : IPackedVector <TP> where TP : struct { ContrastProcessor <T, TP> processor = new ContrastProcessor <T, TP>(amount); processor.OnProgress += progressHandler; try { return(source.Process(rectangle, processor)); } finally { processor.OnProgress -= progressHandler; } }