GDI+:为什么 FillRectangle 在玻璃上是透明的,而 FillEllipse 是不透明的?
我正在玻璃上画一个矩形和一个椭圆形。
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);
- 使用椭圆绘制:不透明
- 使用矩形绘制:不不透明
这是怎么回事?
您可以看到同样的情况也适用于其他颜色:
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);
结论:为什么:
- <使用不透明颜色的 code>FillEllipse 绘制不透明
FillRectangle
使用不透明颜色绘制部分透明
注意:这个问题几乎与我的其他问题。 除了这个问题集中在
FillRectangle
和之间的区别FillEllipse
- 而这个问题 处理*如何绘制不透明颜色 在玻璃上。
另请参阅
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
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);
Conclusion: Why does:
FillEllipse
with an opaque color draw opaqueFillRectangle
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 betweenFillRectangle
andFillEllipse
- whereas that question
deals with *How to draw opaque colors
on glass.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论