/// <summary>
 /// Applies a user defined processing delegate to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
 /// <param name="rectangle">
 /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
 /// </param>
 /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation <Point> rowOperation, Rectangle rectangle, PixelConversionModifiers modifiers)
 => source.ApplyProcessor(new PositionAwarePixelRowDelegateProcessor(rowOperation, modifiers), rectangle);
Esempio n. 2
0
 /// <summary>
 /// Flips an image by the given instructions.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image to rotate, flip, or both.</param>
 /// <param name="flipMode">The <see cref="FlipMode"/> to perform the flip.</param>
 /// <returns>The <see cref="Image{TPixel}"/></returns>
 public static IImageProcessingContext <TPixel> Flip <TPixel>(this IImageProcessingContext <TPixel> source, FlipMode flipMode)
     where TPixel : struct, IPixel <TPixel>
 => source.ApplyProcessor(new FlipProcessor <TPixel>(flipMode));
Esempio n. 3
0
 /// <summary>
 /// Crops an image to the area of greatest entropy.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image to crop.</param>
 /// <param name="threshold">The threshold for entropic density.</param>
 /// <returns>The <see cref="Image{TPixel}"/></returns>
 public static IImageProcessingContext <TPixel> EntropyCrop <TPixel>(this IImageProcessingContext <TPixel> source, float threshold = .5f)
     where TPixel : struct, IPixel <TPixel>
 => source.ApplyProcessor(new EntropyCropProcessor <TPixel>(threshold));
 /// <summary>
 /// Detects any edges within the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="filter">The filter for detecting edges.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 private static IImageProcessingContext DetectEdges(this IImageProcessingContext source, IImageProcessor filter)
 {
     return(source.ApplyProcessor(filter));
 }
 /// <summary>
 /// Applies a Gaussian sharpening filter to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="sigma">The 'sigma' value representing the weight of the blur.</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 GaussianSharpen(
     this IImageProcessingContext source,
     float sigma,
     Rectangle rectangle) =>
 source.ApplyProcessor(new GaussianSharpenProcessor(sigma), rectangle);
Esempio n. 6
0
 /// <summary>
 /// Applies the given colorblindness simulator to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="colorBlindness">The type of color blindness simulator to apply.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext ColorBlindness(this IImageProcessingContext source, ColorBlindnessMode colorBlindness)
 => source.ApplyProcessor(GetProcessor(colorBlindness));
Esempio n. 7
0
 /// <summary>
 /// Applies a radial glow 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 glow.</param>
 /// <param name="radius">The the radius.</param>
 /// <param name="options">The options effecting things like blending.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 private static IImageProcessingContext <TPixel> Glow <TPixel>(this IImageProcessingContext <TPixel> source, TPixel color, ValueSize radius, GraphicsOptions options)
     where TPixel : struct, IPixel <TPixel>
 => source.ApplyProcessor(new GlowProcessor <TPixel>(color, radius, options));
 /// <summary>
 /// Flood fills the image with the specified brush.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The graphics options.</param>
 /// <param name="brush">The details how to fill the region of interest.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Fill(
     this IImageProcessingContext source,
     GraphicsOptions options,
     IBrush brush) =>
 source.ApplyProcessor(new FillProcessor(brush, options));
 /// <summary>
 /// TODO: Consider adding this private processor to the library
 /// </summary>
 /// <param name="ctx"></param>
 public static void MakeOpaque(this IImageProcessingContext ctx) =>
 ctx.ApplyProcessor(new MakeOpaqueProcessor());
Esempio n. 10
0
 /// <summary>
 /// Applies black and white toning to the image.
 /// </summary>
 /// <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>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext BlackWhite(this IImageProcessingContext source, Rectangle rectangle)
 => source.ApplyProcessor(new BlackWhiteProcessor(), rectangle);
Esempio n. 11
0
 /// <summary>
 /// Equalizes the histogram of an image to increases the contrast.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The histogram equalization options to use.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext HistogramEqualization(
     this IImageProcessingContext source,
     HistogramEqualizationOptions options) =>
 source.ApplyProcessor(HistogramEqualizationProcessor.FromOptions(options));
Esempio n. 12
0
 /// <summary>
 /// Applies black and white toning to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext BlackWhite(this IImageProcessingContext source)
 => source.ApplyProcessor(new BlackWhiteProcessor());
Esempio n. 13
0
 /// <summary>
 /// Applies a Gaussian blur to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma)
 => source.ApplyProcessor(new GaussianBlurProcessor(sigma));
Esempio n. 14
0
 /// <summary>
 /// Applies a Gaussian blur to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source)
 => source.ApplyProcessor(new GaussianBlurProcessor());
Esempio n. 15
0
 /// <summary>
 /// Applies sepia toning to the image.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</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> Sepia <TPixel>(this IImageProcessingContext <TPixel> source, float amount, Rectangle rectangle)
     where TPixel : struct, IPixel <TPixel>
 => source.ApplyProcessor(new SepiaProcessor <TPixel>(amount), rectangle);
Esempio n. 16
0
 /// <summary>
 /// Skews an image by the given angles in degrees using the specified sampling algorithm.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image to skew.</param>
 /// <param name="degreesX">The angle in degrees to perform the skew along the x-axis.</param>
 /// <param name="degreesY">The angle in degrees to perform the skew along the y-axis.</param>
 /// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
 /// <returns>The <see cref="Image{TPixel}"/></returns>
 public static IImageProcessingContext <TPixel> Skew <TPixel>(this IImageProcessingContext <TPixel> source, float degreesX, float degreesY, IResampler sampler)
     where TPixel : struct, IPixel <TPixel>
 => source.ApplyProcessor(new SkewProcessor <TPixel>(degreesX, degreesY, sampler, source.GetCurrentSize()));
Esempio n. 17
0
 /// <summary>
 /// Dithers the image reducing it to the given palette using error diffusion.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="diffuser">The diffusion algorithm to apply.</param>
 /// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
 /// <param name="palette">The palette to select substitute colors from.</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> Diffuse <TPixel>(this IImageProcessingContext <TPixel> source, IErrorDiffuser diffuser, float threshold, TPixel[] palette, Rectangle rectangle)
     where TPixel : struct, IPixel <TPixel>
 => source.ApplyProcessor(new ErrorDiffusionPaletteProcessor <TPixel>(diffuser, threshold, palette), rectangle);
 /// <summary>
 /// Applies a user defined pixel shader to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="pixelShader">The user defined pixel shader to use to modify images.</param>
 /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PixelShader pixelShader, PixelConversionModifiers modifiers)
 => source.ApplyProcessor(new PixelShaderProcessor(pixelShader, modifiers));
Esempio n. 19
0
 /// <summary>
 /// Applies the given colorblindness simulator to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="colorBlindnessMode">The type of color blindness simulator to apply.</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 ColorBlindness(this IImageProcessingContext source, ColorBlindnessMode colorBlindnessMode, Rectangle rectangle)
 => source.ApplyProcessor(GetProcessor(colorBlindnessMode), rectangle);
 /// <summary>
 /// Applies a user defined pixel shader to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="pixelShader">The user defined pixel shader to use to modify images.</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 ApplyPixelShaderProcessor(this IImageProcessingContext source, PixelShader pixelShader, Rectangle rectangle)
 => source.ApplyProcessor(new PixelShaderProcessor(pixelShader), rectangle);
Esempio n. 21
0
 /// <summary>
 /// Multiplies the alpha component of the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</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 Opacity(this IImageProcessingContext source, float amount, Rectangle rectangle)
 => source.ApplyProcessor(new OpacityProcessor(amount), rectangle);
 /// <summary>
 /// Applies a user defined pixel shader to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="pixelShader">The user defined pixel shader to use to modify images.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PositionAwarePixelShader pixelShader)
 => source.ApplyProcessor(new PositionAwarePixelShaderProcessor(pixelShader));
 /// <summary>
 /// Applies a Gaussian sharpening filter to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source) =>
 source.ApplyProcessor(new GaussianSharpenProcessor());
 /// <summary>
 /// Applies a user defined pixel shader to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="pixelShader">The user defined pixel shader to use to modify images.</param>
 /// <param name="rectangle">
 /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
 /// </param>
 /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PositionAwarePixelShader pixelShader, Rectangle rectangle, PixelConversionModifiers modifiers)
 => source.ApplyProcessor(new PositionAwarePixelShaderProcessor(pixelShader, modifiers), rectangle);
Esempio n. 25
0
 private static IImageProcessingContext <TPixel> VignetteInternal <TPixel>(this IImageProcessingContext <TPixel> source, GraphicsOptions options, TPixel color, ValueSize radiusX, ValueSize radiusY)
     where TPixel : struct, IPixel <TPixel>
 => source.ApplyProcessor(new VignetteProcessor <TPixel>(color, radiusX, radiusY, options));
 /// <summary>
 /// Applies a user defined processing delegate to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
 /// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, PixelConversionModifiers modifiers)
 => source.ApplyProcessor(new PixelRowDelegateProcessor(rowOperation, modifiers));
Esempio n. 27
0
 /// <summary>
 /// Alters the colors of the image recreating an old Kodachrome camera effect.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext <TPixel> Kodachrome <TPixel>(this IImageProcessingContext <TPixel> source)
     where TPixel : struct, IPixel <TPixel>
 {
     source.ApplyProcessor(new KodachromeProcessor <TPixel>());
     return(source);
 }
Esempio n. 28
0
 /// <summary>
 /// Clones the image then proceeds to apply processors to it before takign the output of that process and filling the vector with the result.
 /// </summary>
 /// <param name="path">The target path to fill</param>
 /// <param name="innerProcessingOperations">the set of procssing operations to apply inside the path</param>
 /// <returns></returns>
 public static IImageProcessingContext ProcessInsideShape(this IImageProcessingContext context, IPath path, Action <IImageProcessingContext> innerProcessingOperations)
 {
     return(context.ApplyProcessor(new RecursiveImageProcessor(context.GetShapeGraphicsOptions(), path, innerProcessingOperations)));
 }