作者:帅气小子勇哥 | 来源:互联网 | 2023-05-16 09:54
Iamhavingtroubledrawingaveryshortlinewithactionscript3:我在使用actionscript3画一条非常短的线时遇到了麻烦:
I am having trouble drawing a very short line with actionscript3:
我在使用actionscript3画一条非常短的线时遇到了麻烦:
var cSp:Sprite = new Sprite();
var cGx:Graphics = cSp.graphics;
cGx.lineStyle( 1, 0xFF0000, 1, false, LineScaleMode.NONE, null, null, 1 );
cGx.moveTo( 2, 10 );
cGx.lineTo( 3, 10 );
This creates two vertically stacked pixels which are not quite red (#7f0000)!
这会产生两个垂直堆叠的像素,这些像素不是很红(#7f0000)!
vertical line? http://www.freeimagehosting.net/uploads/449212bd1f.png
垂线? http://www.freeimagehosting.net/uploads/449212bd1f.png
(here it is zoomed in:)
(这里放大了:)
zoomed in http://www.freeimagehosting.net/uploads/5c9014a148.png
放大http://www.freeimagehosting.net/uploads/5c9014a148.png
Since I am trying to draw a horizontal line, this is not what I expected. I assume there is some alias/sub-pixel trickery going on here. What's the magic combination of commands to draw a really short line or one pixel?
由于我试图绘制一条水平线,这不是我所期望的。我假设这里有一些别名/子像素技巧。绘制真正短线或一个像素的命令的神奇组合是什么?
Note: if I make my really short line 4 pixels (or more) long, it is rendered as expected (4+ pixels long, 1 pixel tall, every rendered pixel #FF0000)
注意:如果我将我的真正短线设置为4像素(或更长),则会按预期进行渲染(长度超过4像素,高度为1像素,每个渲染像素为#FF0000)
1 个解决方案