/// <summary>
        /// Replaces a target color in the image with another replacement color.
        /// Fuzziness allows for more general smoothing of the replacement.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="target">The target color to be replaced.</param>
        /// <param name="replacement">The color to be placed into the image.</param>
        /// <param name="fuzziness">The smoothness/preciseness with which the color replacement will be treated.
        /// Higher value designates a more general replacement.</param>
        public static void ReplaceColor(this ImageEditorState @this, Color target,
                                        Color replacement, int fuzziness = 0)
        {
            var newImage = ImageProcessor.Instance.ReplaceColor(@this.Image, target, replacement, fuzziness);

            @this.Update(newImage);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the output format for the current image to the matching ISupportedImageFormat.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="format">The ISupportedImageFormat object that will apply the formatting.</param>
        public static void Format(this ImageEditorState @this, ISupportedImageFormat format)
        {
            var newImage = ImageProcessor.Instance.Format(@this.Image, format);

            @this.Update(newImage);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Resizes an image to fit within the given dimensions while keeping it's aspect ratio.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="size">The new size that the image will be fitted to.</param>
        public static void Constrain(this ImageEditorState @this, Size size)
        {
            var newImage = ImageProcessor.Instance.Constrain(@this.Image, size);

            @this.Update(newImage);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Tints the image with a given color.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="hue">The color used to tint the image.</param>
        public static void Tint(this ImageEditorState @this, Color hue)
        {
            var newImage = ImageProcessor.Instance.Tint(@this.Image, hue);

            @this.Update(newImage);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Rotates the image.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="degrees">The degrees by which the image will be rotated.</param>
        public static void Rotate(this ImageEditorState @this, int degrees)
        {
            var newImage = ImageProcessor.Instance.Rotate(@this.Image, degrees);

            @this.Update(newImage);
        }
        /// <summary>
        /// Changes the background color of the image.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="color">The new color of the background.</param>
        public static void BackgroundColor(this ImageEditorState @this, Color color)
        {
            var newImage = ImageProcessor.Instance.BackgroundColor(@this.Image, color);

            @this.Update(newImage);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Adds a Vignette effect to the image.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="color">The color of the vignette effect.</param>
        public static void Vignette(this ImageEditorState @this, Color color)
        {
            var newImage = ImageProcessor.Instance.Vignette(@this.Image, color);

            @this.Update(newImage);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Applies an IMatrixFilter effect to the current image.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="filter">The IMatrixFilter used to apply the effect.</param>
        public static void Filter(this ImageEditorState @this, IMatrixFilter filter)
        {
            var newImage = ImageProcessor.Instance.Filter(@this.Image, filter);

            @this.Update(newImage);
        }
        /// <summary>
        /// Detects the edges of an image using a particular algorithm and displays the calculated outlines.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="filter">The particular IEdgeFilter object that is used to perform the calculation.</param>
        /// <param name="greyscale">Whether or not the resulting image will be displayed as greyscale.</param>
        public static void DetectEdges(this ImageEditorState @this, IEdgeFilter filter, bool greyscale = true)
        {
            var newImage = ImageProcessor.Instance.DetectEdges(@this.Image, filter, greyscale);

            @this.Update(newImage);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Pixelates an image with the given size.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="radius">The size of the resulting pixels.</param>
        public static void Pixelate(this ImageEditorState @this, int radius)
        {
            var newImage = ImageProcessor.Instance.Pixelate(@this.Image, radius);

            @this.Update(newImage);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Changes the opacity of the image, allowing colors underneath to show through.
        /// </summary>
        /// <param name="this">The current ImageEditorState.</param>
        /// <param name="percentage">The new value of each pixel's alpha, as a percentage.</param>
        public static void Alpha(this ImageEditorState @this, int percentage)
        {
            var newImage = ImageProcessor.Instance.Alpha(@this.Image, percentage);

            @this.Update(newImage);
        }