curveToで1pxの線を描くには、配置座標を0.5px刻みにしないと駄目?
/**
* Copyright sakusan393 ( http://wonderfl.net/user/sakusan393 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/x4SE
*/
package {
import flash.display.*;
import flash.text.*;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var tf:TextField = new TextField();
tf.autoSize = "left";
var tfm:TextFormat = new TextFormat();
tfm.size = 14;
tfm.bold = true;
tf.defaultTextFormat = tfm;
tf.text = "curveToで1pxの線を描くには、配置座標を0.5px刻みにしないと駄目?"
addChild(tf);
tf.x = 10;
tf.y = 10;
//moveToで太さ最小(1px )の線を引く
var lineTf:TextField = new TextField();
lineTf.autoSize= "left";
lineTf.text = "lineToで書いた線 (基点x:10,y:100 ~ 終点x:455,y:100)";
addChild(lineTf);
lineTf.x = 10;
lineTf.y = 75;
var line:Shape = new Shape();
line.graphics.lineStyle(1,0,1,false,"none");
line.graphics.moveTo(10, 100);
line.graphics.lineTo(455, 100);
line.graphics.endFill();
addChild(line);
//curveToで太さ1pxの線を引く
//太さが2pxになってる?
var lineTf2:TextField = new TextField();
lineTf2.autoSize = "left";
lineTf2.text = "curveToで書いた線 (基点x:10,y:200 ~ 終点x:455,y:200)";
addChild(lineTf2);
lineTf2.x = 10;
lineTf2.y = 175;
var lineCurve:Shape = new Shape();
lineCurve.graphics.lineStyle(1,0,1,false,"none");
lineCurve.graphics.moveTo(10, 200);
lineCurve.graphics.curveTo(200, 200,455,200);
lineCurve.graphics.endFill();
addChild(lineCurve);
//curveToで太さ1pxの線を引く その2
//配置座標を"y.5"とすると1pxになった
//lineToとcurveToで線の基準点が違うということ???
var lineTf3:TextField = new TextField();
lineTf3.autoSize = "left";
lineTf3.text = "curveToで書いた線 (基点x:10,y:300.5 ~ 終点x:455,y:300.5)";
addChild(lineTf3);
lineTf3.x = 10;
lineTf3.y = 275;
var lineCurve2:Shape = new Shape();
lineCurve2.graphics.lineStyle(1,0,1,false,"none");
lineCurve2.graphics.moveTo(10, 300.5);
lineCurve2.graphics.curveTo(200, 300.5,455,300.5);
lineCurve2.graphics.endFill();
addChild(lineCurve2);
}
}
}