コード例 #1
0
ファイル: GraphicsPathOutline.cs プロジェクト: nakijun/adasg
        private void  CurveEnd(PointFP control1, PointFP control2, PointFP curveEnd)
        {
            drawingCurve = false;
            if (needDrawStartCap)
            {
                startCapP1 = new PointFP(curveBegin);
                startCapP2 = new PointFP(control1);
                //AddLineCap(control1, curveBegin, startLineCap);
                needDrawStartCap = false;
            }
            LineFP head = new LineFP();
            LineFP tail = new LineFP();

            CalcHeadTail(curveBegin, control1, head, new LineFP());
            outline.AddMoveTo(head.P1);
            outline.AddPath(curvePath1);
            CalcHeadTail(control2, curveEnd, new LineFP(), tail);
            outline.AddLineTo(tail.P1);
            outline.AddLineTo(tail.P2);
            outline.ExtendIfNeeded(curvePath1.cmdsSize, curvePath1.pntsSize);
            int j = curvePath2.pntsSize - 1;

            for (int i = curvePath2.cmdsSize - 1; i >= 0; i--)
            {
                outline.AddLineTo(curvePath2.pnts[j--]);
            }
            outline.AddLineTo(head.P2);
            outline.AddClose();
            curvePath1    = null;
            curvePath2    = null;
            lastCurveTail = null;
            lastPoint     = new PointFP(control2);
            drawingCurve  = false;
        }
コード例 #2
0
ファイル: GraphicsPathFP.cs プロジェクト: nakijun/adasg
        public static GraphicsPathFP CreateRoundRect(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax, int ff_rx, int ff_ry)
        {
            int            ff_rmax;
            int            FF_PI = MathFP.PI;
            GraphicsPathFP path  = new GraphicsPathFP();

            path.AddMoveTo(new PointFP(ff_xmin + ff_rx, ff_ymin));
            path.AddLineTo(new PointFP(ff_xmax - ff_rx, ff_ymin));
            ff_rmax = MathFP.Min(ff_xmax - ff_xmin, ff_ymax - ff_ymin) / 2;
            if (ff_rx > ff_rmax)
            {
                ff_rx = ff_rmax;
            }
            if (ff_ry > ff_rmax)
            {
                ff_ry = ff_rmax;
            }
            if (ff_rx != 0 && ff_ry != 0)
            {
                path.AddPath(GraphicsPathFP.CreateArc(ff_xmax - ff_rx * 2, ff_ymin, ff_xmax, ff_ymin + ff_ry * 2, (-FF_PI) / 2, 0, false, false));
            }
            path.AddLineTo(new PointFP(ff_xmax, ff_ymin + ff_ry));
            path.AddLineTo(new PointFP(ff_xmax, ff_ymax - ff_ry));
            if (ff_rx != 0 && ff_ry != 0)
            {
                path.AddPath(GraphicsPathFP.CreateArc(ff_xmax - ff_rx * 2, ff_ymax - ff_ry * 2, ff_xmax, ff_ymax, 0, FF_PI / 2, false, false));
            }
            path.AddLineTo(new PointFP(ff_xmax - ff_rx, ff_ymax));
            path.AddLineTo(new PointFP(ff_xmin + ff_rx, ff_ymax));
            if (ff_rx != 0 && ff_ry != 0)
            {
                path.AddPath(GraphicsPathFP.CreateArc(ff_xmin, ff_ymax - ff_ry * 2, ff_xmin + ff_rx * 2, ff_ymax, FF_PI / 2, FF_PI, false, false));
            }
            path.AddLineTo(new PointFP(ff_xmin, ff_ymax - ff_ry));
            path.AddLineTo(new PointFP(ff_xmin, ff_ymin + ff_ry));
            if (ff_rx != 0 && ff_ry != 0)
            {
                path.AddPath(GraphicsPathFP.CreateArc(ff_xmin, ff_ymin, ff_xmin + ff_rx * 2, ff_ymin + ff_ry * 2, -FF_PI, (-FF_PI) / 2, false, false));
            }
            path.AddClose();
            return(path);
        }