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);
Graphics graphics = Graphics.FromImage(img);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
// Draw a subpixel line (0.5 width)
graphics.DrawLine(new Pen(Color.Red, (float)0.5), 0, 100, 255, 110);
// Draw a single pixel line (1 width)
graphics.DrawLine(new Pen(Color.Red, (float)1), 0, 110, 255, 120);
img.Save(@"c:\temp\test.png", ImageFormat.Png);
graphics.Dispose();
img.Dispose();
However, in the generated image, both lines appear the same width:
Is there a way for the top line to appear sub-pixel (0.5px)?
Edit: After some research, AGG might be the way to go, of which there is a c# port.