Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex Flash绘图API中的边界线是在形状内部还是外部绘制的?_Apache Flex_Flash_Graphics_Css - Fatal编程技术网

Apache flex Flash绘图API中的边界线是在形状内部还是外部绘制的?

Apache flex Flash绘图API中的边界线是在形状内部还是外部绘制的?,apache-flex,flash,graphics,css,Apache Flex,Flash,Graphics,Css,当我在ActionScript中使用Flash播放器的绘图API(即Graphics类)绘制矩形等时,该形状的边界线是在形状的外部还是内部绘制的?也就是说,以下哪个图表正确地描述了在自定义组件的内容区域边界上绘制的矩形 我查看了,找不到任何提示。我编写了一个简短的测试,使用一个固定大小的自定义组件,绘制一些线作为参考,然后在白色背景上绘制一个具有30像素宽边框的矩形。这就是它的样子,请参见下面的代码: 因此,参考问题中的图片,第二张图(“居中”)正确地描述了Flash Player的绘图方式

当我在ActionScript中使用Flash播放器的绘图API(即
Graphics
类)绘制矩形等时,该形状的边界线是在形状的外部还是内部绘制的?也就是说,以下哪个图表正确地描述了在自定义组件的内容区域边界上绘制的矩形


我查看了,找不到任何提示。

我编写了一个简短的测试,使用一个固定大小的自定义组件,绘制一些线作为参考,然后在白色背景上绘制一个具有30像素宽边框的矩形。这就是它的样子,请参见下面的代码:

因此,参考问题中的图片,第二张图(“居中”)正确地描述了Flash Player的绘图方式

还要注意,内线(45像素)正好位于矩形内部,而外线(15像素)与矩形的外部限制对齐

这是测试应用程序的代码:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:test="*">
    <test:TestCanvas horizontalCenter="0" verticalCenter="0" id="canvas" />
</mx:Application>
public class TestCanvas extends UIComponent
{
    public function TestCanvas()
    {
        super();
    }

    override protected function measure():void
    {
        super.measure();
        this.measuredWidth = this.minWidth = 300;
        this.measuredHeight = this.minHeight = 300;
    }

    override protected function updateDisplayList(w:Number, h:Number):void
    {
        super.updateDisplayList(w, h);
        this.graphics.clear();

        this.graphics.lineStyle(undefined);
        this.graphics.beginFill(0xffffff);
        this.graphics.drawRect(0, 0, w, h);
        this.graphics.endFill();

        this.graphics.lineStyle(0, 0xff0000, 0.5);
        this.graphics.moveTo(0, 15);
        this.graphics.lineTo(300, 15);
        this.graphics.moveTo(0, 45);
        this.graphics.lineTo(300, 45);
        this.graphics.moveTo(15, 0);
        this.graphics.lineTo(15, 300);
        this.graphics.moveTo(45, 0);
        this.graphics.lineTo(45, 300);

        this.graphics.lineStyle(0, 0xff0000, 0.75);
        this.graphics.moveTo(0, 30);
        this.graphics.lineTo(300, 30);
        this.graphics.moveTo(30, 0);
        this.graphics.lineTo(30, 300);

        this.graphics.lineStyle(30, 0x0000ff, 0.25, false, "normal", null, JointStyle.MITER);
        this.graphics.drawRect(30, 30, 240, 240);
    }