Esempio n. 1
0
 /// <summary>
 /// Applies sepia toning to the image using the given amount.
 /// </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>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Sepia(this IImageProcessingContext source, float amount)
 => source.ApplyProcessor(new SepiaProcessor(amount));
 /// <summary>
 /// Crops an image to the area of greatest entropy using a threshold for entropic density of <value>.5F</value>.
 /// </summary>
 /// <param name="source">The image to crop.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext EntropyCrop(this IImageProcessingContext source) =>
 source.ApplyProcessor(new EntropyCropProcessor());
Esempio n. 3
0
 /// <summary>
 /// Alters the colors of the image recreating an oil painting effect with levels and brushSize
 /// set to <value>10</value> and <value>15</value> respectively.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext OilPaint(this IImageProcessingContext source) => OilPaint(source, 10, 15);
 /// <summary>
 /// Applies Bradley Adaptive Threshold to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="thresholdLimit">Threshold limit (0.0-1.0) to consider for binarization.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, float thresholdLimit)
 => source.ApplyProcessor(new AdaptiveThresholdProcessor(thresholdLimit));
 /// <summary>
 /// Applies Bradley Adaptive Threshold to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="upper">Upper (white) color for thresholding.</param>
 /// <param name="lower">Lower (black) color for thresholding.</param>
 /// <param name="thresholdLimit">Threshold limit (0.0-1.0) to consider for binarization.</param>
 /// <param name="rectangle">Rectangle region to apply the processor on.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower, float thresholdLimit, Rectangle rectangle)
 => source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower, thresholdLimit), rectangle);
Esempio n. 6
0
 /// <summary>
 /// Rotates and flips an image by the given instructions.
 /// </summary>
 /// <param name="source">The image to rotate.</param>
 /// <param name="rotateMode">The <see cref="RotateMode"/> to perform the rotation.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Rotate(this IImageProcessingContext source, RotateMode rotateMode) =>
 Rotate(source, (float)rotateMode);
Esempio n. 7
0
 /// <summary>
 /// Rotates an image by the given angle in degrees using the specified sampling algorithm.
 /// </summary>
 /// <param name="source">The image to rotate.</param>
 /// <param name="degrees">The angle in degrees to perform the rotation.</param>
 /// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Rotate(
     this IImageProcessingContext source,
     float degrees,
     IResampler sampler) =>
 source.ApplyProcessor(new RotateProcessor(degrees, sampler, source.GetCurrentSize()));
Esempio n. 8
0
 /// <summary>
 /// Dithers the image reducing it to a web-safe palette using error diffusion.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Diffuse(this IImageProcessingContext source, float threshold) =>
 Diffuse(source, KnownDiffusers.FloydSteinberg, threshold);
Esempio n. 9
0
 /// <summary>
 /// Dithers the image reducing it to a web-safe palette using error diffusion.
 /// </summary>
 /// <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="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 Diffuse(
     this IImageProcessingContext source,
     IErrorDiffuser diffuser,
     float threshold,
     Rectangle rectangle) =>
 source.ApplyProcessor(new ErrorDiffusionPaletteProcessor(diffuser, threshold), rectangle);
Esempio n. 10
0
 /// <summary>
 /// Replaces the background color of image with the given one.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options effecting pixel blending.</param>
 /// <param name="color">The color to set as the background.</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> BackgroundColor <TPixel>(this IImageProcessingContext <TPixel> source, GraphicsOptions options, TPixel color, Rectangle rectangle)
     where TPixel : struct, IPixel <TPixel>
 => source.ApplyProcessor(new BackgroundColorProcessor <TPixel>(color, options), rectangle);
Esempio n. 11
0
 /// <summary>
 /// Dithers the image reducing it to a web-safe palette using error diffusion.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Diffuse(this IImageProcessingContext source) =>
 Diffuse(source, KnownDiffusers.FloydSteinberg, .5F);
Esempio n. 12
0
 /// <summary>
 /// Replaces the background color of image with the given one.
 /// </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 background.</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> BackgroundColor <TPixel>(this IImageProcessingContext <TPixel> source, TPixel color, Rectangle rectangle)
     where TPixel : struct, IPixel <TPixel>
 => BackgroundColor(source, GraphicsOptions.Default, color, rectangle);
Esempio n. 13
0
 /// <summary>
 /// Applies sepia toning to 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 Sepia(this IImageProcessingContext source, float amount, Rectangle rectangle)
 => source.ApplyProcessor(new SepiaProcessor(amount), rectangle);
Esempio n. 14
0
 /// <summary>
 /// Applies sepia 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 Sepia(this IImageProcessingContext source, Rectangle rectangle)
 => Sepia(source, 1F, rectangle);
 /// <summary>
 /// Draws the outline of the polygon with the provided brush at the provided thickness.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="path">The path.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     IBrush brush,
     float thickness,
     IPath path) =>
 source.Draw(new Pen(brush, thickness), path);
Esempio n. 16
0
 /// <summary>
 /// Dithers the image reducing it to the given palette using error diffusion.
 /// </summary>
 /// <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>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Diffuse(
     this IImageProcessingContext source,
     IErrorDiffuser diffuser,
     float threshold,
     ReadOnlyMemory <Color> palette) =>
 source.ApplyProcessor(new ErrorDiffusionPaletteProcessor(diffuser, threshold, palette));
 /// <summary>
 /// Draws the outline of the polygon with the provided brush at the provided thickness.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="color">The color.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="path">The path.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     Color color,
     float thickness,
     IPath path) =>
 source.Draw(new SolidBrush(color), thickness, path);
Esempio n. 18
0
 /// <summary>
 /// Flood fills the image in the shape of the provided polygon with the specified brush.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="path">The path.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPath path) =>
 source.Fill(GraphicsOptions.Default, brush, new ShapeRegion(path));
Esempio n. 19
0
 /// <summary>
 /// Rotates an image by the given angle in degrees.
 /// </summary>
 /// <param name="source">The image to rotate.</param>
 /// <param name="degrees">The angle in degrees to perform the rotation.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Rotate(this IImageProcessingContext source, float degrees) =>
 Rotate(source, degrees, KnownResamplers.Bicubic);
Esempio n. 20
0
 /// <summary>
 /// Flood fills the image in the shape of the provided polygon with the specified brush..
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="color">The color.</param>
 /// <param name="path">The path.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Fill(
     this IImageProcessingContext source,
     GraphicsOptions options,
     Color color,
     IPath path) =>
 source.Fill(options, new SolidBrush(color), path);
 /// <summary>
 /// Applies Bradley Adaptive Threshold to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source)
 => source.ApplyProcessor(new AdaptiveThresholdProcessor());
Esempio n. 22
0
 /// <summary>
 /// Flood fills the image in the shape of the provided polygon with the specified brush..
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="color">The color.</param>
 /// <param name="path">The path.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color, IPath path) =>
 source.Fill(new SolidBrush(color), path);
 /// <summary>
 /// Applies Bradley Adaptive Threshold to the image.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="upper">Upper (white) color for thresholding.</param>
 /// <param name="lower">Lower (black) color for thresholding.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower)
 => source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower));
Esempio n. 24
0
 public NoAA(IImageProcessingContext context)
 {
     this.context = context;
 }
Esempio n. 25
0
 /// <summary>
 /// Applies quantization to the image.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="quantizer">The quantizer to apply to perform the operation.</param>
 /// <param name="maxColors">The maximum number of colors to return.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext <TPixel> Quantize <TPixel>(this IImageProcessingContext <TPixel> source, IQuantizer <TPixel> quantizer, int maxColors)
     where TPixel : struct, IPixel <TPixel>
 => source.ApplyProcessor(new QuantizeProcessor <TPixel>(quantizer, maxColors));
 /// <summary>
 /// Draws the outline of the polygon with the provided pen.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="pen">The pen.</param>
 /// <param name="path">The path.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IPen pen,
     IPath path) =>
 source.ApplyProcessor(new DrawPathProcessor(options, pen, path));
Esempio n. 27
0
 /// <summary>
 /// Crops an image to the area of greatest entropy.
 /// </summary>
 /// <param name="source">The image to crop.</param>
 /// <param name="threshold">The threshold for entropic density.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext EntropyCrop(this IImageProcessingContext source, float threshold) =>
 source.ApplyProcessor(new EntropyCropProcessor(threshold));
 /// <summary>
 /// Draws the outline of the polygon with the provided pen.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="pen">The pen.</param>
 /// <param name="path">The path.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path) =>
 source.Draw(source.GetShapeGraphicsOptions(), pen, path);
Esempio n. 29
0
 /// <summary>
 /// Alters the colors of the image recreating an oil painting effect  with levels and brushSize
 /// set to <value>10</value> and <value>15</value> respectively.
 /// </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 OilPaint(this IImageProcessingContext source, Rectangle rectangle) =>
 OilPaint(source, 10, 15, rectangle);
Esempio n. 30
0
 /// <summary>
 /// Applies sepia 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 Sepia(this IImageProcessingContext source)
 => Sepia(source, 1F);