コード例 #1
0
        private void DrawShapeOutline(Canvas canvas, Transform transform, Vector2[] shapeVertices, bool closedLoop)
        {
            Vector3 pos = transform.Pos;
            float angle = transform.Angle;
            float scale = transform.Scale;

            if (this.wrapTexture)
            {
                Rect pointBoundingRect = shapeVertices.BoundingBox();
                canvas.State.TextureCoordinateRect = new Rect(
                    pointBoundingRect.W / canvas.State.TextureBaseSize.X,
                    pointBoundingRect.H / canvas.State.TextureBaseSize.Y);
            }
            canvas.State.TransformAngle = angle;
            canvas.State.TransformScale = new Vector2(scale, scale);
            if (closedLoop)
                canvas.FillPolygonOutline(shapeVertices, this.outlineWidth, pos.X, pos.Y, pos.Z);
            else
                canvas.FillThickLineStrip(shapeVertices, this.outlineWidth, pos.X, pos.Y, pos.Z);
        }
コード例 #2
0
        private void DrawShapeArea(Canvas canvas, Transform transform, Vector2[] shapeVertices)
        {
            if (shapeVertices.Length < 3) return;

            Vector3 pos = transform.Pos;
            float angle = transform.Angle;
            float scale = transform.Scale;

            if (this.wrapTexture)
            {
                Rect pointBoundingRect = shapeVertices.BoundingBox();
                canvas.State.TextureCoordinateRect = new Rect(
                    pointBoundingRect.W / canvas.State.TextureBaseSize.X,
                    pointBoundingRect.H / canvas.State.TextureBaseSize.Y);
            }
            canvas.State.TransformAngle = angle;
            canvas.State.TransformScale = new Vector2(scale, scale);
            canvas.FillPolygon(shapeVertices, pos.X, pos.Y, pos.Z);
        }