Пример #1
0
 /// <summary>
 /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="points">The points.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext DrawPolygon(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     float thickness,
     params PointF[] points) =>
 source.DrawPolygon(options, new Pen(brush, thickness), points);
 /// <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="options">The options.</param>
 /// <param name="color">The color.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="path">The path.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     Color color,
     float thickness,
     IPath path) =>
 source.Draw(options, new SolidBrush(color), thickness, path);
 /// <summary>
 /// Draws the outline of the rectangle with the provided brush at the provided thickness.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="shape">The shape.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     float thickness,
     RectangleF shape) =>
 source.Draw(options, new Pen(brush, thickness), shape);
 /// <summary>
 /// Draws the outline of the rectangle with the provided brush at the provided thickness.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="color">The color.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="shape">The shape.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     Color color,
     float thickness,
     RectangleF shape) =>
 source.Draw(options, new SolidBrush(color), thickness, shape);
Пример #5
0
 /// <summary>
 /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="points">The points.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext DrawLines(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     float thickness,
     params PointF[] points) =>
 source.Draw(options, new Pen(brush, thickness), new Path(new LinearLineSegment(points)));
Пример #6
0
 /// <summary>
 /// Draws the provided Points as an open Linear path at the provided thickness with the supplied 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="thickness">The thickness.</param>
 /// <param name="points">The points.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>>
 public static IImageProcessingContext DrawLines(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     Color color,
     float thickness,
     params PointF[] points) =>
 source.DrawLines(options, new SolidBrush(color), thickness, points);
 /// <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="options">The options.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="path">The shape.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     float thickness,
     IPath path) =>
 source.Draw(options, new Pen(brush, thickness), path);
Пример #8
0
        /// <summary>
        /// Clones the shape graphic options and applies changes required to force clearing.
        /// </summary>
        /// <param name="shapeOptions">The options to clone</param>
        /// <returns>A clone of shapeOptions with ColorBlendingMode, AlphaCompositionMode, and BlendPercentage set</returns>
        internal static ShapeGraphicsOptions CloneForClearOperation(this ShapeGraphicsOptions shapeOptions)
        {
            var options = shapeOptions.GraphicsOptions.DeepClone();

            options.ColorBlendingMode    = PixelFormats.PixelColorBlendingMode.Normal;
            options.AlphaCompositionMode = PixelFormats.PixelAlphaCompositionMode.Src;
            options.BlendPercentage      = 1;

            return(new ShapeGraphicsOptions(options, shapeOptions.ShapeOptions));
        }
Пример #9
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 graphics options.</param>
        /// <param name="brush">The brush.</param>
        /// <param name="path">The shape.</param>
        /// <returns>The <see cref="Image{TPixel}"/>.</returns>
        public static IImageProcessingContext Fill(
            this IImageProcessingContext source,
            ShapeGraphicsOptions options,
            IBrush brush,
            Action <PathBuilder> path)
        {
            var pb = new PathBuilder();

            path(pb);

            return(source.Fill(options, brush, pb.Build()));
        }
Пример #10
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 graphics options.</param>
        /// <param name="brush">The brush.</param>
        /// <param name="paths">The shapes.</param>
        /// <returns>The <see cref="Image{TPixel}"/>.</returns>
        public static IImageProcessingContext Fill(
            this IImageProcessingContext source,
            ShapeGraphicsOptions options,
            IBrush brush,
            IPathCollection paths)
        {
            foreach (IPath s in paths)
            {
                source.Fill(options, brush, s);
            }

            return(source);
        }
Пример #11
0
        /// <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="paths">The paths.</param>
        /// <returns>The <see cref="Image{TPixel}"/>.</returns>
        public static IImageProcessingContext Draw(
            this IImageProcessingContext source,
            ShapeGraphicsOptions options,
            IPen pen,
            IPathCollection paths)
        {
            foreach (IPath path in paths)
            {
                source.Draw(options, pen, path);
            }

            return(source);
        }
Пример #12
0
 /// <summary>
 /// Flood fills the image in the shape of the provided polygon with the specified brush without any blending.
 /// </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="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Clear(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     Color color,
     IPath path) =>
 source.Clear(options, new SolidBrush(color), path);
 /// <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 graphics options.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="path">The shape.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Fill(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     IPath path) =>
 source.ApplyProcessor(new FillPathProcessor(options, brush, path));
 /// <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="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IPen pen,
     IPath path) =>
 source.Fill(options, pen.StrokeFill, new ShapePath(path, pen));
 /// <summary>
 /// Flood fills the image in the shape of a Linear polygon described by the points
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="color">The color.</param>
 /// <param name="points">The points.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext FillPolygon(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     Color color,
     params PointF[] points) =>
 source.Fill(options, new SolidBrush(color), new Polygon(new LinearLineSegment(points)));
 /// <summary>
 /// Flood fills the image in the shape of a Linear polygon described by the points
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="points">The points.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext FillPolygon(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     params PointF[] points) =>
 source.Fill(options, brush, new Polygon(new LinearLineSegment(points)));
 /// <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 graphics options.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="path">The shape.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Fill(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     IPath path) =>
 source.Fill(options, brush, new ShapeRegion(path));
Пример #18
0
 /// <summary>
 /// Draws the provided Points as an open Linear path with the supplied 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="points">The points.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext DrawLines(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IPen pen,
     params PointF[] points) =>
 source.Draw(options, pen, new Path(new LinearLineSegment(points)));
 /// <summary>
 /// Draws the outline of the rectangle 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="shape">The shape.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IPen pen,
     RectangleF shape) =>
 source.Draw(options, pen, new RectangularPolygon(shape.X, shape.Y, shape.Width, shape.Height));
Пример #20
0
 /// <summary>
 /// Flood fills the image in the shape of the provided polygon with the specified brush without any blending.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The graphics options.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="path">The shape.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Clear(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     IPath path) =>
 source.Fill(options.CloneForClearOperation(), brush, path);
Пример #21
0
 /// <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="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Draw(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IPen pen,
     IPath path) =>
 source.ApplyProcessor(new DrawPathProcessor(options, pen, path));
 /// <summary>
 /// Flood fills the image in the shape of the provided rectangle with the specified brush without any blending.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="brush">The brush.</param>
 /// <param name="shape">The shape.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Clear(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     RectangleF shape) =>
 source.Clear(options, brush, new RectangularPolygon(shape.X, shape.Y, shape.Width, shape.Height));
Пример #23
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,
     ShapeGraphicsOptions options,
     Color color,
     Action <PathBuilder> path) =>
 source.Fill(options, new SolidBrush(color), path);
 /// <summary>
 /// Flood fills the image in the shape of the provided rectangle with the specified brush without any blending.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="color">The color.</param>
 /// <param name="shape">The shape.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Clear(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     Color color,
     RectangleF shape) =>
 source.Clear(options, new SolidBrush(color), shape);
Пример #25
0
 /// <summary>
 /// Flood fills the image with in the region 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 brush.</param>
 /// <param name="region">The region.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Fill(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     IBrush brush,
     Region region) =>
 source.ApplyProcessor(new FillRegionProcessor(options, brush, region));
Пример #26
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="paths">The paths.</param>
 /// <returns>The <see cref="Image{TPixel}"/>.</returns>
 public static IImageProcessingContext Fill(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     Color color,
     IPathCollection paths) =>
 source.Fill(options, new SolidBrush(color), paths);
Пример #27
0
 /// <summary>
 /// Flood fills the image with in the region with the specified color.
 /// </summary>
 /// <param name="source">The image this method extends.</param>
 /// <param name="options">The options.</param>
 /// <param name="color">The color.</param>
 /// <param name="region">The region.</param>
 /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
 public static IImageProcessingContext Fill(
     this IImageProcessingContext source,
     ShapeGraphicsOptions options,
     Color color,
     Region region) =>
 source.Fill(options, new SolidBrush(color), region);