SixLabors / ImageSharp.Drawing

:pen: Extensions to ImageSharp containing a cross-platform 2D polygon manipulation API and drawing operations.
https://sixlabors.com/products/imagesharp-drawing/
Other
282 stars 38 forks source link

Vertical line with a width of 1 pixel is not drawn #236

Closed Michiel-de-Wolde closed 2 years ago

Michiel-de-Wolde commented 2 years ago

Prerequisites

Description

Please find attached sample code that draws an L shape with 1-pixel width lines. The vertical line is not drawn. Change the width to 2 pixels and the L shape is correctly drawn. ConsoleApp1.zip

Steps to Reproduce

For completeness I include the code, which is also present in the zip.

using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
Image<Rgb24> image = new(200, 200, Color.White);
// The vertical line of this L shape is not drawn.
image.Mutate(d => d.DrawLines(new Pen(Color.Black, width: 1), new PointF[]
{
    new PointF(50, 160),
    new PointF(25, 160),
    new PointF(25, 100)
}));
// Changing the width to 2 causes correct drawing of the L shape.
image.Mutate(d => d.DrawLines(new Pen(Color.Black, width: 2), new PointF[]
{
    new PointF(150, 160),
    new PointF(125, 160),
    new PointF(125, 100)
}));
image.SaveAsPng(@"D:\Temp\image.png");
Console.WriteLine("Press enter");
Console.ReadLine();

System Configuration

JimBobSquarePants commented 2 years ago

@Michiel-de-Wolde If you update to the latest MyGet build 1.0.0-beta14.16 then the issue will go away.

Michiel-de-Wolde commented 2 years ago

Thank you. Super-quick response, great work. I tried the suggested version 1.0.0-beta14.16: problem solved.