private void distortImage(IImageProcessingContext pc, string foreColor) { var degrees = _randomNumberProvider.NextNumber(1, 6); pc.Skew(degrees, degrees); pc.Vignette(Color.ParseHex(foreColor)); }
/// <summary> /// Applies a radial vignette effect to an image. /// </summary> /// <param name="source">The image this method extends.</param> /// <param name="color">The color to set as the vignette.</param> /// <param name="radiusX">The the x-radius.</param> /// <param name="radiusY">The the y-radius.</param> /// <param name="rectangle"> /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// </param> /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns> public static IImageProcessingContext Vignette( this IImageProcessingContext source, Color color, float radiusX, float radiusY, Rectangle rectangle) => source.Vignette(new GraphicsOptions(), color, radiusX, radiusY, rectangle);
protected override void Apply(IImageProcessingContext ctx, Rectangle rect) => ctx.Vignette(rect);
protected override void Apply(IImageProcessingContext ctx, float radiusX, float radiusY) => ctx.Vignette(radiusX, radiusY);
protected override void Apply(IImageProcessingContext ctx, Color color) => ctx.Vignette(color);
/// <summary> /// Applies a radial vignette effect to an image. /// </summary> /// <typeparam name="TPixel">The pixel format.</typeparam> /// <param name="source">The image this method extends.</param> /// <param name="color">The color to set as the vignette.</param> /// <param name="radiusX">The the x-radius.</param> /// <param name="radiusY">The the y-radius.</param> /// <param name="rectangle"> /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// </param> /// <returns>The <see cref="Image{TPixel}"/>.</returns> public static IImageProcessingContext <TPixel> Vignette <TPixel>(this IImageProcessingContext <TPixel> source, TPixel color, float radiusX, float radiusY, Rectangle rectangle) where TPixel : struct, IPixel <TPixel> => source.Vignette(color, radiusX, radiusY, rectangle, GraphicsOptions.Default);
protected override void Apply <T>(IImageProcessingContext <T> ctx, T color) => ctx.Vignette(color);