GDI +:为什么FillRectangle在玻璃上是透明的,而FillEllipse是不透明的?

时间:2010-11-26 15:20:21

标签: gdi+ aero dwm

我在玻璃上画了一个矩形和一个椭圆。

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);
  • 使用椭圆绘图:它是不透明
  • 用矩形绘制:它是不透明

alt text

这里发生了什么?

您可以看到同样适用于其他颜色:

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

结论:为什么:

  • FillEllipse使用不透明颜色绘制不透明
  • FillRectangle使用不透明的颜色绘制部分透明
  

注意:此问题几乎与my other question重复。   除了这个问题侧重于   FillRectangle和之间的差异   FillEllipse - 而那个问题   处理*如何绘制不透明的颜色   在玻璃上。

另见

0 个答案:

没有答案