如何在Direct2D中绘制透明线 [英] How to draw a transparent line in Direct2D
问题描述
我从Direct2D和VC ++ 2013开始。我试图绘制一条50%透明度的宽线。在Microsoft网站上,我只能找到使用Brush填充透明颜色的透明度示例。有人可以展示如何在Direct2D中绘制透明的线条。谢谢。
以下应该是Microsoft网页上处理不透明度的链接。
不透明蒙版概述
I am starting with Direct2D and VC++2013. I am trying to draw a wide line with 50% transparency. On the Microsoft web site I can only find examples of transparency which use the Brush to fill in a transparent color. Can someone show how to draw lines that are transparent in Direct2D. Thanks.
Below should be a link to the Microsoft webpage that dealing with Opacity.
Opacity Masks Overview
推荐答案
为什么不说你的线是一个矩形而只是用透明色填充它?
[更新]
Why don't you say that your line is a rectangle and simply fill it with your transparent colour ?
[Update]
大多数行是DIAGONAL,所以不能用矩形表示。 (我没有打扰投票,但如果我这样做,我也会投票。)
Most lines are DIAGONAL, so cannot be represented by a rectangle. (I didn't bother voting, but if I did, I would also downvote.)
我同意答案很短。
但你是在你的分析中犯了一个错误,看起来你认为一个矩形是水平的或垂直的,但你犯了一个错误。
当你旋转一个矩形时,它会保持一个矩形,甚至旋转。 br />
通过用矩形替换线,可以创建一个多边形,并且可以使用画笔工具来填充它。
I agree that the answer was short.
But you are making a mistake in your analyze, it looks like you believe that a rectangle is either horizontal or vertical, but you make a mistake.
When you rotate a rectangle, it stay a rectangle, even rotated.
By replacing the line by a rectangle, you make a polygon and the brush tool can be used to fill it.
这篇关于如何在Direct2D中绘制透明线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!