How to draw a subpixel line

前端 未结 5 2660
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 22:27

In the following code, I\'m trying to draw two lines: One with a subpixel width (0.5) and the other with 1px width:

        var img = new Bitmap(256, 256);
              


        
5条回答
  •  时光取名叫无心
    2021-02-19 23:24

    The article Scaling the Pen object mentions a bug in GDI+ Pen that makes it unable to scale down properly when its width is less than 1.5.

    Also, if you try to draw three lines with widths 2.0F, 2.5F and 3.0F respectively, you'll see a visual difference, so your case really looks like some issue with GDI+.

    Three Pens with 0.5 width increment

提交回复
热议问题