GDI +: Why is it transparent on FillRectangle on glass, and FillEllipse is opaque?

I draw a rectangle and an ellipse on the glass.

brush = new SolidBrush(0xFF000000); //solid (ie non-opaque) black graphics.FillRectangle(brush, x, y, 30, 30); graphics.FillEllipse(brush, x+33, y-15, 30, 30); 
  • ellipse pattern: opaque
  • rectangle pattern: not opaque

alt text

What's going on here?

You can see the same thing with other colors:

 brush = new SolidBrush(0xFFff0000); //solid (ie non-opaque) red graphics.FillRectangle(brush, x, y, 30, 30); graphics.FillEllipse(brush, x, y+33, 30, 30); brush = new SolidBrush(0xFF00ff00); //solid (ie non-opaque) green graphics.FillRectangle(brush, x, y, 30, 30); graphics.FillEllipse(brush, x, y+33, 30, 30); brush = new SolidBrush(0xFF0000ff); //solid (ie non-opaque) blue graphics.FillRectangle(brush, x, y, 30, 30); graphics.FillEllipse(brush, x, y+33, 30, 30); brush = new SolidBrush(0xFFffffff); //solid (ie non-opaque) white graphics.FillRectangle(brush, x, y, 30, 30); graphics.FillEllipse(brush, x, y+33, 30, 30); 

alt text

Conclusion : Why:

  • FillEllipse with Opaque Color Opaque FillEllipse
  • FillRectangle with opaque color draws partially transparent

Note: This question is almost duplicated by my other question . In addition, this question focuses on the difference between FillRectangle and FillEllipse - whereas this question deals with * How to draw opaque colors on glass.

see also

+4
source share

All Articles