4

i'm drawing a rectangle, and an ellipse, on glass.

brush = new SolidBrush(0xFF000000); //solid (i.e. non-opaque) black
graphics.FillRectangle(brush, x,    y,    30, 30);
graphics.FillEllipse(brush,   x+33, y-15, 30, 30);
  • drawing with ellipse: it's opaque
  • drawing with rectangle: it's not opaque

alt text

What is going on here?

You can see the same also applies for other colors:

brush = new SolidBrush(0xFFff0000); //solid (i.e. non-opaque) red
graphics.FillRectangle(brush, x, y,    30, 30);
graphics.FillEllipse(brush,   x, y+33, 30, 30);

brush = new SolidBrush(0xFF00ff00); //solid (i.e. non-opaque) green
graphics.FillRectangle(brush, x, y,    30, 30);
graphics.FillEllipse(brush,   x, y+33, 30, 30);

brush = new SolidBrush(0xFF0000ff); //solid (i.e. non-opaque) blue
graphics.FillRectangle(brush, x, y,    30, 30);
graphics.FillEllipse(brush,   x, y+33, 30, 30);

brush = new SolidBrush(0xFFffffff); //solid (i.e. non-opaque) white
graphics.FillRectangle(brush, x, y,    30, 30);
graphics.FillEllipse(brush,   x, y+33, 30, 30);

alt text

Conclusion: Why does:

  • FillEllipse with an opaque color draw opaque
  • FillRectangle with an opaque color draws partially transparent

Note: This question is very nearly a duplicate of my other question. Except this question focuses on the difference between FillRectangle and FillEllipse - whereas that question deals with *How to draw opaque colors on glass.

See also

Community
  • 1
  • 1
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219

0 Answers0