Example #1
0
 /// <summary>
 /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush
 /// </summary>
 /// <typeparam name="TColor">The type of the color.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="color">The color.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="points">The points.</param>
 /// <param name="options">The options.</param>
 /// <returns>The <see cref="Image{TColor}"/>.</returns>>
 public static Image <TColor> DrawLines <TColor>(this Image <TColor> source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
     where TColor : struct, IPackedPixel, IEquatable <TColor>
 {
     return(source.DrawLines(new SolidBrush <TColor>(color), thickness, points, options));
 }
Example #2
0
 /// <summary>
 /// Draws the provided Points as an open Linear path with the supplied pen
 /// </summary>
 /// <typeparam name="TColor">The type of the color.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="pen">The pen.</param>
 /// <param name="points">The points.</param>
 /// <param name="options">The options.</param>
 /// <returns>The <see cref="Image{TColor}"/>.</returns>
 public static Image <TColor> DrawLines <TColor>(this Image <TColor> source, IPen <TColor> pen, Vector2[] points, GraphicsOptions options)
     where TColor : struct, IPackedPixel, IEquatable <TColor>
 {
     return(source.Draw(pen, new Path(new LinearLineSegment(points)), options));
 }
Example #3
0
        /// <summary>
        /// Draws the given image together with the current one by blending their pixels.
        /// </summary>
        /// <param name="source">The image this method extends.</param>
        /// <param name="image">The image to blend with the currently processing image.</param>
        /// <typeparam name="TPixel">The pixel format.</typeparam>
        /// <param name="size">The size to draw the blended image.</param>
        /// <param name="location">The location to draw the blended image.</param>
        /// <param name="options">The options.</param>
        /// <returns>The <see cref="Image{TPixel}"/>.</returns>
        public static Image <TPixel> DrawImage <TPixel>(this Image <TPixel> source, Image <TPixel> image, Size size, Point location, GraphicsOptions options)
            where TPixel : struct, IPixel <TPixel>
        {
            if (size == default(Size))
            {
                size = new Size(image.Width, image.Height);
            }

            if (location == default(Point))
            {
                location = Point.Empty;
            }

            source.ApplyProcessor(new DrawImageProcessor <TPixel>(image, size, location, options), source.Bounds);
            return(source);
        }
Example #4
0
 /// <summary>
 /// Draws the given image together with the current one by blending their pixels.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="image">The image to blend with the currently processing image.</param>
 /// <param name="options">The options, including the blending type and belnding amount.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static Image <TPixel> Blend <TPixel>(this Image <TPixel> source, Image <TPixel> image, GraphicsOptions options)
     where TPixel : struct, IPixel <TPixel>
 {
     return(DrawImage(source, image, default(Size), default(Point), options));
 }
Example #5
0
 /// <summary>
 /// Alters the colors of the image recreating an old Lomograph camera effect.
 /// </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>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static Image <TPixel> Lomograph <TPixel>(this Image <TPixel> source, GraphicsOptions options)
     where TPixel : struct, IPixel <TPixel>
 {
     return(Lomograph(source, source.Bounds, options));
 }
Example #6
0
 /// <summary>
 /// Alters the colors of the image recreating an old Lomograph camera effect.
 /// </summary>
 /// <typeparam name="TPixel">The pixel format.</typeparam>
 /// <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>
 /// <param name="options">The options effecting pixel blending.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static Image <TPixel> Lomograph <TPixel>(this Image <TPixel> source, Rectangle rectangle, GraphicsOptions options)
     where TPixel : struct, IPixel <TPixel>
 {
     source.ApplyProcessor(new LomographProcessor <TPixel>(options), rectangle);
     return(source);
 }
Example #7
0
 /// <summary>
 /// Flood fills the image with in the region with the specified brush.
 /// </summary>
 /// <typeparam name="TColor">The type of the color.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="region">The region.</param>
 /// <param name="options">The graphics options.</param>
 /// <returns>The <see cref="Image{TColor}"/>.</returns>
 public static Image <TColor> Fill <TColor>(this Image <TColor> source, IBrush <TColor> brush, Region region, GraphicsOptions options)
     where TColor : struct, IPackedPixel, IEquatable <TColor>
 {
     return(source.Apply(new FillRegionProcessor <TColor>(brush, region, options)));
 }
Example #8
0
 /// <summary>
 /// Flood fills the image with in the region with the specified color.
 /// </summary>
 /// <typeparam name="TColor">The type of the color.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="color">The color.</param>
 /// <param name="region">The region.</param>
 /// <param name="options">The options.</param>
 /// <returns>The <see cref="Image{TColor}"/>.</returns>
 public static Image <TColor> Fill <TColor>(this Image <TColor> source, TColor color, Region region, GraphicsOptions options)
     where TColor : struct, IPackedPixel, IEquatable <TColor>
 {
     return(source.Fill(new SolidBrush <TColor>(color), region, options));
 }
Example #9
0
        /// <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>
        /// <param name="options">The options effecting pixel blending.</param>
        /// <returns>The <see cref="Image{TPixel}"/>.</returns>
        public static Image <TPixel> Vignette <TPixel>(this Image <TPixel> source, TPixel color, float radiusX, float radiusY, Rectangle rectangle, GraphicsOptions options)
            where TPixel : struct, IPixel <TPixel>
        {
            VignetteProcessor <TPixel> processor = new VignetteProcessor <TPixel>(color, options)
            {
                RadiusX = radiusX, RadiusY = radiusY
            };

            source.ApplyProcessor(processor, rectangle);
            return(source);
        }
Example #10
0
 /// <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="options">The options effecting pixel blending.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static Image <TPixel> Vignette <TPixel>(this Image <TPixel> source, GraphicsOptions options)
     where TPixel : struct, IPixel <TPixel>
 {
     return(Vignette(source, NamedColors <TPixel> .Black, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds, options));
 }
Example #11
0
 /// <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="rectangle">
 /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
 /// </param>
 /// <param name="options">The options effecting pixel blending.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static Image <TPixel> Vignette <TPixel>(this Image <TPixel> source, Rectangle rectangle, GraphicsOptions options)
     where TPixel : struct, IPixel <TPixel>
 {
     return(Vignette(source, NamedColors <TPixel> .Black, 0, 0, rectangle, options));
 }
Example #12
0
 /// <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="radiusX">The the x-radius.</param>
 /// <param name="radiusY">The the y-radius.</param>
 /// <param name="options">The options effecting pixel blending.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static Image <TPixel> Vignette <TPixel>(this Image <TPixel> source, float radiusX, float radiusY, GraphicsOptions options)
     where TPixel : struct, IPixel <TPixel>
 {
     return(Vignette(source, NamedColors <TPixel> .Black, radiusX, radiusY, source.Bounds, options));
 }
 /// <summary>
 /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
 /// </summary>
 /// <typeparam name="TColor">The type of the color.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="color">The color.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="points">The points.</param>
 /// <param name="options">The options.</param>
 /// <returns>The <see cref="Image{TColor}"/>.</returns>
 public static Image <TColor> DrawPolygon <TColor>(this Image <TColor> source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
     where TColor : struct, IPixel <TColor>
 {
     return(source.DrawPolygon(new SolidBrush <TColor>(color), thickness, points, options));
 }
 /// <summary>
 /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
 /// </summary>
 /// <typeparam name="TColor">The type of the color.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="points">The points.</param>
 /// <param name="options">The options.</param>
 /// <returns>The <see cref="Image{TColor}"/>.</returns>
 public static Image <TColor> DrawPolygon <TColor>(this Image <TColor> source, IBrush <TColor> brush, float thickness, Vector2[] points, GraphicsOptions options)
     where TColor : struct, IPixel <TColor>
 {
     return(source.Draw(new Pen <TColor>(brush, thickness), new Polygon(new LinearLineSegment(points)), options));
 }
 /// <summary>
 /// Draws the provided Points as a closed Linear Polygon with the provided Pen.
 /// </summary>
 /// <typeparam name="TColor">The type of the color.</typeparam>
 /// <param name="source">The image this method extends.</param>
 /// <param name="pen">The pen.</param>
 /// <param name="points">The points.</param>
 /// <param name="options">The options.</param>
 /// <returns>The <see cref="Image{TColor}"/>.</returns>
 public static Image <TColor> DrawPolygon <TColor>(this Image <TColor> source, IPen <TColor> pen, Vector2[] points, GraphicsOptions options)
     where TColor : struct, IPixel <TColor>
 {
     return(source.Draw(pen, new Polygon(new LinearLineSegment(points)), options));
 }