1

I recently have found a strange behavior of DrawPolygon API of GDI plus. That is if I set the alpha value of the pen to 255 (No transparency), it gives me a result, but if I set the alpha to a number between 0-255, it gives me another result.

Here are they:

This is the result with no transparency

This is the result with no transparency

And this is the result with if I set the alpha value of the pen to 100:

And this is the result with if I set the alpha value of the pen to 100:

Without the difference of the pen's alpha value, they both have the same condition as below:

gdi.InterpolationMode = GDI.Drawing2D.InterpolationMode.NearestNeighbor;
gdi.SmoothingMode = GDI.Drawing2D.SmoothingMode.None;
gdi.CompositingMode = GDI.Drawing2D.CompositingMode.SourceCopy;

GDI.Pen pen = new GDI.Pen(GDI.Color.FromArgb(a, r, g, b), 1); // The pen width is 1

And the array of points for drawing: {(0, 2), (2, 2), (1, 0)}

Do you know the reason for this difference?

Community
  • 1
  • 1
  • This is a strange behavior because I think drawing area cannot be influenced by the alpha value of the pen. So maybe it is a bug of framework? Does anyone have a clue about this problem? – Huyết Công Tử Jul 26 '17 at 02:29

0 Answers0