热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何用actionscript绘制一条很短的线?-howtodrawaveryshortlinewithactionscript?

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 个解决方案

#1


Did you try playing with the various caps and joints settings? Your values of null/null would direct Flash to use round caps and round joints. Your [last] parameter of "1" for the miter limit would also be ignored as you wouldn't be using miter joints.

你尝试过使用各种帽子和关节设置吗?您的null / null值将指示Flash使用圆形帽和圆形关节。您的[last]参数“1”对于斜接限制也将被忽略,因为您不会使用斜接接头。

I would suggest trying CapsStyle.NONE first. Then maybe miter joints. For reference: Graphics.lineStyle().

我建议先尝试CapsStyle.NONE。然后可能是斜接关节。供参考:Graphics.lineStyle()。

Edit: Try using pixel hinting, too.

编辑:尝试使用像素提示。


推荐阅读
author-avatar
帅气小子勇哥
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有