コード例 #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 CreateOval(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax)
        {
            GraphicsPathFP path = GraphicsPathFP.CreateArc(ff_xmin, ff_ymin, ff_xmax, ff_ymax, 0, MathFP.PI * 2, false);

            path.AddClose();
            return(path);
        }
コード例 #3
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
        public void  FillOval(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax)
        {
            GraphicsPathFP path = GraphicsPathFP.CreateOval(ff_xmin, ff_ymin, ff_xmax, ff_ymax);

            path.AddClose();
            FillPath(path);
        }
コード例 #4
0
ファイル: GraphicsPathFP.cs プロジェクト: nakijun/adasg
        public virtual GraphicsPathFP CalcOutline(PenFP lineStyle)
        {
            GraphicsPathFP     outline          = new GraphicsPathFP();
            GraphicsPathSketch outlineGenerator = new GraphicsPathOutline(this, outline, lineStyle);

            Visit(outlineGenerator);
            return(outline);
        }
コード例 #5
0
ファイル: GraphicsPathFP.cs プロジェクト: nakijun/adasg
        public static GraphicsPathFP CreateLine(int ff_x1, int ff_y1, int ff_x2, int ff_y2)
        {
            GraphicsPathFP path = new GraphicsPathFP();

            path.AddMoveTo(new PointFP(ff_x1, ff_y1));
            path.AddLineTo(new PointFP(ff_x2, ff_y2));
            return(path);
        }
コード例 #6
0
ファイル: GraphicsPathOutline.cs プロジェクト: nakijun/adasg
 private void  CurveBegin(PointFP control)
 {
     AddLineJoin(lastPoint, currPoint, control);
     drawingCurve = true;
     curvePath1   = new GraphicsPathFP();
     curvePath2   = new GraphicsPathFP();
     curveBegin   = new PointFP(currPoint);
 }
コード例 #7
0
ファイル: GraphicsPathRenderer.cs プロジェクト: nakijun/adasg
 public void  ScanPath(GraphicsPathFP path, MatrixFP matrix, int mode)
 {
     scanIndex       = 0;
     drawMode        = mode;
     transformMatrix = matrix;
     path.Visit(this);
     transformMatrix = null;
     RadixSort(scanbuf, scanbuf_tmp, scanIndex);
 }
コード例 #8
0
ファイル: GraphicsPathFP.cs プロジェクト: nakijun/adasg
        public static GraphicsPathFP CreatePolygon(PointFP[] points)
        {
            GraphicsPathFP path = CreatePolyline(points);

            if (points.Length > 0)
            {
                path.AddClose();
            }
            return(path);
        }
コード例 #9
0
ファイル: GraphicsPathOutline.cs プロジェクト: nakijun/adasg
 public GraphicsPathOutline(GraphicsPathFP pathFP, GraphicsPathFP outline, PenFP lineStyle) : base()
 {
     this.path      = pathFP;
     this.outline   = outline;
     this.lineStyle = lineStyle;
     ff_rad         = lineStyle.Width / 2;
     startLineCap   = lineStyle.StartCap;
     endLineCap     = lineStyle.EndCap;
     lineJoin       = lineStyle.LineJoin;
 }
コード例 #10
0
ファイル: GraphicsPathFP.cs プロジェクト: nakijun/adasg
        public static GraphicsPathFP CreatePolyline(PointFP[] points)
        {
            GraphicsPathFP path = new GraphicsPathFP();

            if (points.Length > 0)
            {
                path.AddMoveTo(points[0]);
                for (int i = 1; i < points.Length; i++)
                {
                    path.AddLineTo(points[i]);
                }
            }
            return(path);
        }
コード例 #11
0
ファイル: GraphicsPathFP.cs プロジェクト: nakijun/adasg
 public void  AddPath(GraphicsPathFP path)
 {
     if (path.cmdsSize > 0)
     {
         ExtendIfNeeded(path.cmdsSize, path.pntsSize);
         Array.Copy(path.cmds, 0, cmds, cmdsSize, path.cmdsSize);
         for (int i = 0; i < path.pntsSize; i++)
         {
             pnts[i + pntsSize] = new PointFP(path.pnts[i]);
         }
         cmdsSize += path.cmdsSize;
         pntsSize += path.pntsSize;
     }
 }
コード例 #12
0
ファイル: GraphicsPathRenderer.cs プロジェクト: nakijun/adasg
 public void  DrawPath(GraphicsPathFP path, BrushFP style, int mode)
 {
     scanIndex = 0;
     drawMode  = mode;
     path.Visit(this);
     RadixSort(scanbuf, scanbuf_tmp, scanIndex);
     fillStyle = style;
     //fillStyle.SetBounds(ff_xmin, ff_ymin, ff_xmax, ff_ymax);
     if (transformMatrix != null)
     {
         fillStyle.GraphicsMatrix = transformMatrix;
     }
     DrawBuffer();
     fillStyle = null;
 }
コード例 #13
0
ファイル: GraphicsPathFP.cs プロジェクト: nakijun/adasg
 public GraphicsPathFP(GraphicsPathFP from)
 {
     cmdsSize = from.cmdsSize;
     pntsSize = from.pntsSize;
     if (cmdsSize > 0)
     {
         cmds = new sbyte[cmdsSize];
         pnts = new PointFP[pntsSize];
         Array.Copy(from.cmds, 0, cmds, 0, cmdsSize);
         for (int i = 0; i < pntsSize; i++)
         {
             pnts[i] = new PointFP(from.pnts[i]);
         }
     }
 }
コード例 #14
0
ファイル: GraphicsPathFP.cs プロジェクト: nakijun/adasg
        public static GraphicsPathFP CreateSmoothCurves(PointFP[] points, int offset, int numberOfSegments, int ff_factor, bool closed)
        {
            int            len  = points.Length;
            GraphicsPathFP path = new GraphicsPathFP();

            if (numberOfSegments < 1 ||
                numberOfSegments > points.Length - 1 ||
                offset < 0 ||
                offset + numberOfSegments > len - 1)
            {
                return(path);
            }

            PointFP[] PC1s = new PointFP[points.Length];
            PointFP[] PC2s = new PointFP[points.Length];
            if (!closed)
            {
                PC1s[0]       = points[0];
                PC2s[len - 1] = points[len - 1];
            }
            else
            {
                PC1s[0]       = CalcControlPoint(points[len - 1], points[0], points[1], ff_factor);
                PC2s[0]       = CalcControlPoint(points[1], points[0], points[len - 1], ff_factor);
                PC1s[len - 1] = CalcControlPoint(points[len - 2], points[len - 1], points[0], ff_factor);
                PC2s[len - 1] = CalcControlPoint(points[0], points[len - 1], points[len - 2], ff_factor);
            }
            for (int i = 1; i < len - 1; i++)
            {
                PC1s[i] = CalcControlPoint(points[i - 1], points[i], points[i + 1], ff_factor);
                PC2s[i] = CalcControlPoint(points[i + 1], points[i], points[i - 1], ff_factor);
            }

            path.AddMoveTo(points[offset]);
            for (int i = 0; i < numberOfSegments; i++)
            {
                path.AddCurveTo(PC1s[offset + i], PC2s[offset + i + 1], points[offset + i + 1]);
            }
            if (closed)
            {
                path.AddCurveTo(PC1s[len - 1], PC2s[0], points[0]);
                path.AddClose();
            }
            return(path);
        }
コード例 #15
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);
        }
コード例 #16
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  DrawLine(int ff_x1, int ff_y1, int ff_x2, int ff_y2)
 {
     DrawPath(GraphicsPathFP.CreateLine(ff_x1, ff_y1, ff_x2, ff_y2));
 }
コード例 #17
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  FillPie(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax, int ff_startangle, int ff_sweepangle)
 {
     FillPath(GraphicsPathFP.CreateArc(ff_xmin, ff_ymin, ff_xmax, ff_ymax, ff_startangle, ff_sweepangle, true));
 }
コード例 #18
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  DrawCurves(PointFP[] points, int offset, int numberOfSegments, int ff_factor)
 {
     DrawPath(GraphicsPathFP.CreateSmoothCurves(points, offset, numberOfSegments, ff_factor, false));
 }
コード例 #19
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  DrawPolygon(PointFP[] points)
 {
     DrawPath(GraphicsPathFP.CreatePolygon(points));
 }
コード例 #20
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  DrawRoundRect(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax, int ff_rx, int ff_ry)
 {
     DrawPath(GraphicsPathFP.CreateRoundRect(ff_xmin, ff_ymin, ff_xmax, ff_ymax, ff_rx, ff_ry));
 }
コード例 #21
0
ファイル: GraphicsPathFP.cs プロジェクト: nakijun/adasg
        public static GraphicsPathFP  CreateArc(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax, int ff_startangle, int ff_sweepangle, bool closed, bool standalone)
        {
            if (ff_sweepangle < 0)
            {
                ff_startangle += ff_sweepangle;
                ff_sweepangle  = -ff_sweepangle;
            }
            int segments = MathFP.Round(MathFP.Div(4 * MathFP.Abs(ff_sweepangle), MathFP.PI)) >> SingleFP.DecimalBits;

            if (segments == 0)
            {
                segments = 1;
            }
            GraphicsPathFP path = new GraphicsPathFP();
            int            ff_darg = ff_sweepangle / segments;
            int            ff_arg = ff_startangle;
            int            ff_lastcos = MathFP.Cos(ff_startangle);
            int            ff_lastsin = MathFP.Sin(ff_startangle);
            int            ff_xc = (ff_xmin + ff_xmax) / 2;
            int            ff_yc = (ff_ymin + ff_ymax) / 2;
            int            ff_rx = (ff_xmax - ff_xmin) / 2;
            int            ff_ry = (ff_ymax - ff_ymin) / 2;
            int            ff_RXBETA = MathFP.Mul(17381, ff_rx);
            int            ff_RYBETA = MathFP.Mul(17381, ff_ry);
            int            ff_currcos, ff_currsin, ff_x1, ff_y1, ff_x2, ff_y2;

            if (closed)
            {
                path.AddMoveTo(new PointFP(ff_xc, ff_yc));
            }

            for (int i = 1; i <= segments; i++)
            {
                ff_arg     = i == segments?ff_startangle + ff_sweepangle:ff_arg + ff_darg;
                ff_currcos = MathFP.Cos(ff_arg);
                ff_currsin = MathFP.Sin(ff_arg);
                ff_x1      = ff_xc + MathFP.Mul(ff_rx, ff_lastcos);
                ff_y1      = ff_yc + MathFP.Mul(ff_ry, ff_lastsin);
                ff_x2      = ff_xc + MathFP.Mul(ff_rx, ff_currcos);
                ff_y2      = ff_yc + MathFP.Mul(ff_ry, ff_currsin);
                if (i == 1)
                {
                    if (closed)
                    {
                        path.AddLineTo(new PointFP(ff_x1, ff_y1));
                    }
                    else
                    if (standalone)
                    {
                        path.AddMoveTo(new PointFP(ff_x1, ff_y1));
                    }
                }

                path.AddCurveTo(
                    new PointFP(ff_x1 - MathFP.Mul(ff_RXBETA, ff_lastsin), ff_y1 + MathFP.Mul(ff_RYBETA, ff_lastcos)),
                    new PointFP(ff_x2 + MathFP.Mul(ff_RXBETA, ff_currsin), ff_y2 - MathFP.Mul(ff_RYBETA, ff_currcos)),
                    new PointFP(ff_x2, ff_y2));
                ff_lastcos = ff_currcos;
                ff_lastsin = ff_currsin;
            }
            if (closed)
            {
                path.AddClose();
            }
            return(path);
        }
コード例 #22
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  DrawOval(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax)
 {
     DrawPath(GraphicsPathFP.CreateOval(ff_xmin, ff_ymin, ff_xmax, ff_ymax));
 }
コード例 #23
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  DrawRect(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax)
 {
     DrawPath(GraphicsPathFP.CreateRect(ff_xmin, ff_ymin, ff_xmax, ff_ymax));
 }
コード例 #24
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  DrawPath(GraphicsPathFP path)
 {
     bufferedImage = null;
     renderer.DrawPath(path.CalcOutline(lineStyle), matrix, lineStyle.Brush, GraphicsPathRenderer.MODE_ZERO);
 }
コード例 #25
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  DrawArc(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax, int ff_startangle, int ff_sweepangle)
 {
     DrawPath(GraphicsPathFP.CreateArc(ff_xmin, ff_ymin, ff_xmax, ff_ymax, ff_startangle, ff_sweepangle, false));
 }
コード例 #26
0
ファイル: GraphicsPathRenderer.cs プロジェクト: nakijun/adasg
 public void  DrawPath(GraphicsPathFP path, MatrixFP matrix, BrushFP fillStyle, int mode)
 {
     transformMatrix = matrix;
     DrawPath(path, fillStyle, mode);
     transformMatrix = null;
 }
コード例 #27
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  FillClosedCurves(PointFP[] points, int offset, int numberOfSegments, int ff_factor)
 {
     FillPath(GraphicsPathFP.CreateSmoothCurves(points, offset, numberOfSegments, ff_factor, true));
 }
コード例 #28
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  FillPolygon(PointFP[] points)
 {
     FillPath(GraphicsPathFP.CreatePolygon(points));
 }
コード例 #29
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  FillPath(GraphicsPathFP path)
 {
     bufferedImage = null;
     renderer.DrawPath(path, matrix, fillStyle, paintMode);
 }
コード例 #30
0
ファイル: GraphicsFP.cs プロジェクト: nakijun/adasg
 public void  FillRoundRect(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax, int ff_rx, int ff_ry)
 {
     FillPath(GraphicsPathFP.CreateRoundRect(ff_xmin, ff_ymin, ff_xmax, ff_ymax, ff_rx, ff_ry));
 }