示例#1
0
        private void AddLineCap(PointFP p1, PointFP p2, int lineCap)
        {
            if (lineCap == PenFP.LINECAP_BUTT || p1.Equals(p2))
            {
                return;
            }
            var dx  = p2.X - p1.X;
            var dy  = p2.Y - p1.Y;
            var len = PointFP.Distance(dx, dy);
            var cap = lineCap == PenFP.LINECAP_ROUND
                    ? GraphicsPathFP.ROUNDCAP : GraphicsPathFP.SQUARECAP;

            dx = MathFP.Mul(_ffRad, MathFP.Div(dx, len));
            dy = MathFP.Mul(_ffRad, MathFP.Div(dy, len));

            var m = new MatrixFP(dx, dx, dy, -dy, p2.X, p2.Y);

            _outline.AddMoveTo(new PointFP(0, GraphicsPathFP.ONE).Transform(m));
            for (var i = 0; i < cap.Length; i++)
            {
                _outline.AddLineTo(new PointFP(cap[i]).Transform(m));
            }
            _outline.AddLineTo(new PointFP(0, -GraphicsPathFP.ONE).Transform(m));
            _outline.AddClose();
        }
示例#2
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * get the tail outline.
         * @param ff_rad
         * @return
         */
        public LineFP GetTailOutline(int ffRad)
        {
            var c = GetCenter();
            var p = new PointFP(Pt2.X - c.X, Pt2.Y - c.Y);

            p.Reset(p.Y, -p.X);
            var dis = PointFP.Distance(PointFP.Origin, p);

            if (dis == 0)
            {
                dis = 1;
            }
            p.Reset(MathFP.Div(MathFP.Mul(p.X, ffRad), dis),
                    MathFP.Div(MathFP.Mul(p.Y, ffRad), dis));
            return(new LineFP(Pt2.X - p.X, Pt2.Y - p.Y, Pt2.X + p.X, Pt2.Y + p.Y));
        }
示例#3
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * get the lenght of the line.
         */
        public int GetLength()
        {
            return(PointFP.Distance(Pt1, Pt2));
        }