0

enter image description here

I used some basic code to draw lines on an bitmap, but I cannot think of any reason why the surroundings of these lines are not deep black. If there is any solution I would be really interested in it. Thank you!

This is my code:

Bitmap bm = new Bitmap(3200, 1600, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
double step = werte.Count / 3200;
Pen whitePen = new Pen(Color.White, 3);
var graphics = Graphics.FromImage(bm);
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 3200, 1600);
int lastangezeigtH = (int)(1600 - ((werte[(int)(0 * step)] - min) * 1600 / deltaMinMax));
for (int i = 1; i < 3200; i++)
{
    double h = (werte[(int)(i * step)] - min) * 1600 / deltaMinMax;
    int angezeigtH = (int)(1600 - h);
    //bm.SetPixel(i, angezeigtH, Color.White);
    graphics.DrawLine(whitePen,i - 1, lastangezeigtH, i, angezeigtH);
    lastangezeigtH = angezeigtH;
}
  • Does this answer your question? [How to make drawLine smoother?](https://stackoverflow.com/questions/5569215/) and [Good looking graphics in C# window form](https://stackoverflow.com/questions/17222990/) and [Adding antialiasing](https://stackoverflow.com/questions/36094055/) and [Possible to have anti-aliasing when drawing a clipped image?](https://stackoverflow.com/questions/19053067/) and [How can I draw smoothed/rounded/curved line graphs? (C#)](https://stackoverflow.com/questions/4388911/) –  Aug 06 '21 at 18:48
  • I tried turning anti-alias on, but it unfortunately didn't help: But thank you for the suggestion! – Heda Dasser Aug 06 '21 at 18:51
  • 1
    There are a few modes to test when searching the look you want. Antialiasing will __avoid steps by introducing__ smoothing colors, so if you want black and white only do turn it __off__! – TaW Aug 06 '21 at 19:05

0 Answers0