Ejemplo n.º 1
0
 //--------------------------------------------------------------------
 public void MoveTo(double x0, double y0)
 {
     this.latestSVGPathCmd = SvgPathCommand.MoveTo;
     myvxs.AddMoveTo(
         this.latest_moveTo_X = this.latest_x = x0,
         this.latest_moveTo_Y = this.latest_y = y0);
 }
Ejemplo n.º 2
0
 //--------------------------------------------------------------------
 public void MoveTo(double x0, double y0)
 {
     _latestSVGPathCmd = SvgPathCommand.MoveTo;
     _myvxs.AddMoveTo(
         _latest_moveTo_X = _latest_x = x0,
         _latest_moveTo_Y = _latest_y = y0);
 }
        void CreateStartLineCap(VertexStore outputVxs, Vector v0, Vector v1, double edgeWidth)
        {
            switch (this.LineCapStyle)
            {
            default: throw new NotSupportedException();

            case LineCap.Butt:
                outputVxs.AddMoveTo(v1.X, v1.Y);    // moveto
                outputVxs.AddLineTo(v0.X, v0.Y);
                break;

            case LineCap.Square:
            {
                Vector delta = (v0 - v1).Rotate(90).NewLength(edgeWidth);
                //------------------------
                outputVxs.AddMoveTo(v1.X + delta.X, v1.Y + delta.Y);
                outputVxs.AddLineTo(v0.X + delta.X, v0.Y + delta.Y);
            }
            break;

            case LineCap.Round:
                capVectors.Clear();
                BuildBeginCap(v0.X, v0.Y, v1.X, v1.Y, capVectors);
                //----------------------------------------------------
                int j = capVectors.Count;
                outputVxs.AddMoveTo(v1.X, v1.Y);
                for (int i = j - 1; i >= 0; --i)
                {
                    Vector v = capVectors[i];
                    outputVxs.AddLineTo(v.X, v.Y);
                }
                break;
            }
        }
Ejemplo n.º 4
0
 //--------------------------------------------------------------------
 public void MoveTo(double x, double y)
 {
     this.latestSVGPathCmd = SvgPathCommand.MoveTo;
     myvxs.AddMoveTo(
         this.lastMoveX = this.lastX = x,
         this.lastMoveY = this.lastY = y);
 }
Ejemplo n.º 5
0
 public void MoveTo(double x0, double y0)
 {
     if (_latest_moveTo_X != x0 || _latest_moveTo_Y != y0)
     {
         _latestSVGPathCmd = SvgPathCommand.MoveTo;
         _myvxs.AddMoveTo(
             _latest_moveTo_X = _latest_x = x0,
             _latest_moveTo_Y = _latest_y = y0);
     }
     else if (_myvxs.Count == 0)
     {
         _myvxs.AddMoveTo(
             _latest_moveTo_X = _latest_x = x0,
             _latest_moveTo_Y = _latest_y = y0);
     }
 }
Ejemplo n.º 6
0
        public void GetSmooth()
        {
            if (this.isValidSmooth)
            {
                return;
            }
            this.isValidSmooth = true;
            //lets smooth it
            //string str1 = dbugDumpPointsToString(contPoints);
            //string str2 = dbugDumpPointsToString2(contPoints);
            //var data2 = CurvePreprocess.RdpReduce(contPoints, 2);
            var data2 = contPoints;

            CubicBezier[] cubicBzs = CurveFit.Fit(data2, 8);

            //PathWriter pWriter = new PathWriter();
            //pWriter.StartFigure();

            //int j = cubicBzs.Length;
            //for (int i = 0; i < j; ++i)
            //{
            //    CubicBezier bz = cubicBzs[i];
            //    pWriter.MoveTo(bz.p0.x, bz.p0.y);
            //    pWriter.LineTo(bz.p0.x, bz.p0.y);

            //    pWriter.Curve4(bz.p1.x, bz.p1.y,
            //            bz.p2.x, bz.p2.y,
            //            bz.p3.x, bz.p3.y);
            //}
            //pWriter.CloseFigureCCW();
            vxs = new VertexStore();
            int j = cubicBzs.Length;

            //1.
            if (j > 0)
            {
                //1st
                CubicBezier bz0 = cubicBzs[0];
                vxs.AddMoveTo(bz0.p0.x, bz0.p0.y);
                vxs.AddLineTo(bz0.p0.x, bz0.p0.y);
                vxs.AddP3c(bz0.p1.x, bz0.p1.y);
                vxs.AddP3c(bz0.p2.x, bz0.p2.y);
                vxs.AddLineTo(bz0.p3.x, bz0.p3.y);
                //-------------------------------
                for (int i = 1; i < j; ++i) //start at 1
                {
                    CubicBezier bz = cubicBzs[i];
                    vxs.AddP3c(bz.p1.x, bz.p1.y);
                    vxs.AddP3c(bz.p2.x, bz.p2.y);
                    vxs.AddLineTo(bz.p3.x, bz.p3.y);
                }
                //-------------------------------
                //close
                vxs.AddLineTo(bz0.p0.x, bz0.p0.y);
            }
            vxs.AddCloseFigure();
            PixelFarm.Agg.VertexSource.CurveFlattener cflat = new PixelFarm.Agg.VertexSource.CurveFlattener();
            vxs = cflat.MakeVxs(vxs);
        }
Ejemplo n.º 7
0
    public static void Main()
    {
        //TEST
        //this is low-level scanline rasterizer
        //1. create vertex store
        VertexStore vxs = new VertexStore();

        vxs.AddMoveTo(10, 10);
        vxs.AddLineTo(50, 10);
        vxs.AddLineTo(50, 50);
        vxs.AddLineTo(10, 50);
        vxs.AddCloseFigure();

        //2. create scanline rasterizer
        ScanlineRasterizer sclineRas = new ScanlineRasterizer();

        sclineRas.AddPath(vxs);

        //3. create destination bitmap
        DestBitmapRasterizer destBmpRasterizer = new DestBitmapRasterizer();

        //4. create 32bit rgba bitmap blender

        MyBitmapBlender myBitmapBlender = new MyBitmapBlender();

        //5. create output bitmap
        using (MemBitmap membitmap = new MemBitmap(800, 600))
        {
            //6. attach target bitmap to bitmap blender
            myBitmapBlender.Attach(membitmap);

            //7. rasterizer sends the vector content inside sclineRas
            //   to the bitmap blender and

            destBmpRasterizer.RenderWithColor(myBitmapBlender, //blender+ output
                                              sclineRas,       //with vectors input inside
                                              new ScanlinePacked8(),
                                              Color.Red);

            //8. the content inside membitmap is just color image buffer
            //   you can copy it to other image object (eg SkImage, Gdi+ image etc)


            //... example ...
            using (System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(membitmap.Width, membitmap.Height))
            {
                IntPtr mem_ptr = membitmap.GetRawBufferHead();
                System.Drawing.Imaging.BitmapData bmpdata = bmp.LockBits(new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

                unsafe
                {
                    MemMx.memcpy((byte *)bmpdata.Scan0, (byte *)mem_ptr, membitmap.Width * membitmap.Height * 4);
                }
                bmp.UnlockBits(bmpdata);
                bmp.Save("test01.png");
            }
        }
    }
 static void BuildOrgImgRectVxs(int srcW, int srcH, VertexStore output)
 {
     output.Clear();
     output.AddMoveTo(0, 0);
     output.AddLineTo(srcW, 0);
     output.AddLineTo(srcW, srcH);
     output.AddLineTo(0, srcH);
     output.AddCloseFigure();
 }
Ejemplo n.º 9
0
        void GetExampleVxs(VertexStore outputVxs)
        {
            //counter-clockwise
            //a triangle
            //outputVxs.AddMoveTo(10, 20);
            //outputVxs.AddLineTo(50, 60);
            //outputVxs.AddLineTo(70, 20);
            //outputVxs.AddCloseFigure();

            //a quad
            //outputVxs.AddMoveTo(10, 20);
            //outputVxs.AddLineTo(50, 60);
            //outputVxs.AddLineTo(70, 20);
            //outputVxs.AddLineTo(50, 10);
            //outputVxs.AddCloseFigure();



            ////curve4
            //outputVxs.AddMoveTo(5, 5);
            //outputVxs.AddLineTo(50, 60);
            //outputVxs.AddCurve4To(70, 20, 50, 10, 10, 5);
            //outputVxs.AddCloseFigure();

            //curve3
            //outputVxs.AddMoveTo(5, 5);
            //outputVxs.AddLineTo(50, 60);
            //outputVxs.AddCurve3To(70, 20, 10, 5);
            //outputVxs.AddCloseFigure();


            //a quad with hole
            outputVxs.AddMoveTo(10, 20);
            outputVxs.AddLineTo(50, 60);
            outputVxs.AddLineTo(70, 20);
            outputVxs.AddLineTo(50, 10);
            outputVxs.AddCloseFigure();

            outputVxs.AddMoveTo(30, 30);
            outputVxs.AddLineTo(40, 30);
            outputVxs.AddLineTo(40, 35);
            outputVxs.AddLineTo(30, 35);
            outputVxs.AddCloseFigure();
        }
Ejemplo n.º 10
0
        public void MakeSmoothPath()
        {
            if (this.isValidSmooth)
            {
                return;
            }
            this.isValidSmooth = true;
            //--------
            if (contPoints.Count == 0)
            {
                return;
            }
            //return;
            //--------
            //lets smooth it
            //string str1 = dbugDumpPointsToString(contPoints);
            //string str2 = dbugDumpPointsToString2(contPoints);
            //var data2 = CurvePreprocess.RdpReduce(contPoints, 2);
            var data2 = contPoints;

            CubicBezier[] cubicBzs = CurveFit.Fit(data2, 8);
            vxs = new VertexStore();
            int j = cubicBzs.Length;

            //1.
            if (j > 0)
            {
                //1st
                CubicBezier bz0 = cubicBzs[0];
                vxs.AddMoveTo(bz0.p0.x, bz0.p0.y);
                vxs.AddLineTo(bz0.p0.x, bz0.p0.y);
                vxs.AddCurve4To(
                    bz0.p1.x, bz0.p1.y,
                    bz0.p2.x, bz0.p2.y,
                    bz0.p3.x, bz0.p3.y);

                //-------------------------------
                for (int i = 1; i < j; ++i) //start at 1
                {
                    CubicBezier bz = cubicBzs[i];
                    vxs.AddCurve4To(
                        bz.p1.x, bz.p1.y,
                        bz.p2.x, bz.p2.y,
                        bz.p3.x, bz.p3.y);
                }
                //-------------------------------
                //close
                //TODO: we not need this AddLineTo()
                vxs.AddLineTo(bz0.p0.x, bz0.p0.y);
            }
            vxs.AddCloseFigure();
            VertexStore v2 = new VertexStore();

            cflat.MakeVxs(vxs, v2);
            vxs = v2;
        }
        public void dbugLine(double x1, double y1, double x2, double y2, Drawing.Color color)
        {
            dbug_v1.AddMoveTo(x1, y1);
            dbug_v1.AddLineTo(x2, y2);
            //dbug_v1.AddStop();

            dbugStroke.MakeVxs(dbug_v1, dbug_v2);
            Render(dbug_v2, color);
            dbug_v1.Clear();
            dbug_v2.Clear();
        }
Ejemplo n.º 12
0
 public ExampleVxsLineDash2Walker()
 {
     using (Tools.BorrowVxs(out var v1))
     {
         v1 = new VertexStore();
         v1.AddMoveTo(0, -3);
         v1.AddLineTo(4, 0);
         v1.AddLineTo(0, 3);
         v1.AddCloseFigure();
         _vxs = v1.CreateTrim();
     }
 }
Ejemplo n.º 13
0
        public void MakeVxs(VertexStore vxs)
        {
            int contourCount = _contours.Count;

            for (int i = 0; i < contourCount; ++i)
            {
                //each contour
                RawContour   contour  = _contours[i];
                List <Point> xyCoords = contour._xyCoords;
                int          count    = xyCoords.Count;

                if (count > 1)
                {
                    if (contour.IsOutside)
                    {
                        Point p = xyCoords[0];
                        vxs.AddMoveTo(p.X, p.Y);
                        for (int n = 1; n < count; ++n)
                        {
                            p = xyCoords[n];
                            vxs.AddLineTo(p.X, p.Y);
                        }
                        vxs.AddCloseFigure();
                    }
                    else
                    {
                        Point p = xyCoords[count - 1];
                        vxs.AddMoveTo(p.X, p.Y);
                        for (int n = count - 1; n >= 0; --n)
                        {
                            p = xyCoords[n];
                            vxs.AddLineTo(p.X, p.Y);
                        }
                        vxs.AddCloseFigure();
                    }
                }
            }
        }
Ejemplo n.º 14
0
        public static VertexStore MakeVxs(this Ellipse ellipse, ICoordTransformer tx, VertexStore output)
        {
            //1. moveto
            output.AddMoveTo(ellipse.originX + ellipse.radiusX, ellipse.originY, tx);//**

            //2.
            //
            int    numSteps     = ellipse.NumSteps;
            double anglePerStep = MathHelper.Tau / numSteps;
            double angle        = 0;


            double orgX = ellipse.originX;
            double orgY = ellipse.originY;
            double radX = ellipse.radiusX;
            double radY = ellipse.radiusY;

            if (ellipse._cw)
            {
                for (int i = 1; i < numSteps; i++)
                {
                    angle += anglePerStep;
                    output.AddLineTo(
                        orgX + Math.Cos(MathHelper.Tau - angle) * radX,
                        orgY + Math.Sin(MathHelper.Tau - angle) * radY,
                        tx);//**
                }
            }
            else
            {
                for (int i = 1; i < numSteps; i++)
                {
                    angle += anglePerStep;
                    output.AddLineTo(
                        orgX + Math.Cos(angle) * radX,
                        orgY + Math.Sin(angle) * radY,
                        tx);//**
                }
            }


            //3.
            output.AddCloseFigure((int)EndVertexOrientation.CCW, 0);
            //4.
            output.AddNoMore();

            return(output);
        }
Ejemplo n.º 15
0
        public void MakeRegularPath(float strokeW)
        {
            if (this.isValidSmooth)
            {
                return;
            }
            this.isValidSmooth = true;
            //--------

            if (contPoints.Count == 0)
            {
                return;
            }

            //SimplifyPaths();
            _stroke1.Width    = strokeW * 2;
            _stroke1.LineCap  = LineCap.Round;
            _stroke1.LineJoin = LineJoin.Round;

            var tmpVxs = new VertexStore();
            int j      = contPoints.Count;

            for (int i = 0; i < j; ++i)
            {
                //TODO: review here
                //
                Vector2 v = contPoints[i];
                if (i == 0)
                {
                    tmpVxs.AddMoveTo(v.x, v.y);
                }
                else
                {
                    tmpVxs.AddLineTo(v.x, v.y);
                }
            }
            ////

            VertexStore v2 = new VertexStore();

            _stroke1.MakeVxs(tmpVxs, v2);



            vxs = v2;

            //release vxs to pool
        }
Ejemplo n.º 16
0
        static void CreateInnerBorder(VertexStore vxs, double x0, double y0, double x1, double y1, double w)
        {
            //create 'inner border box' of a line a line (x0,y0)=>(x1,y1)

            PixelFarm.VectorMath.Vector2 vector = new PixelFarm.VectorMath.Vector2(x1 - x0, y1 - y0);

            //for inner border, we don't extend both endpoint
            //rotate 270 degree to create a height vector that point 'inside' of the 'rectbox' shape.
            //the box height= w
            PixelFarm.VectorMath.Vector2 vdiff = vector.RotateInDegree(270).NewLength(w);
            vxs.AddMoveTo(x0, y0);
            vxs.AddLineTo(x1, y1);
            vxs.AddLineTo(x1 + vdiff.x, y1 + vdiff.y);
            vxs.AddLineTo(x0 + vdiff.x, y0 + vdiff.y);
            vxs.AddCloseFigure();
        }
Ejemplo n.º 17
0
        static void SimpleSolidLine(VertexStore outputVxs, VertexCmd cmd, double x, double y)
        {
            //solid
            switch (cmd)
            {
            default: throw new NotSupportedException();

            case VertexCmd.MoveTo:
                outputVxs.AddMoveTo(x, y);
                break;

            case VertexCmd.LineTo:
                outputVxs.AddLineTo(x, y);
                break;
            }
        }
Ejemplo n.º 18
0
        public void Close()
        {
            this.vxs = new VertexStore();
            int j = contPoints.Count;

            if (j > 0)
            {
                var p = contPoints[0];
                vxs.AddMoveTo(p.x, p.y);
                for (int i = 1; i < j; ++i)
                {
                    p = contPoints[i];
                    vxs.AddLineTo(p.x, p.y);
                }
                vxs.AddCloseFigure();
            }
        }
Ejemplo n.º 19
0
        void CreateBorder(VertexStore vxs, Vertex2d prev, Vertex2d now, Vertex2d next0, Vertex2d next1)
        {
            //now we are on now
            using (Tools.BorrowVxs(out var vxs1))
            {
                vxs.AddMoveTo(now.x, now.y);

                //create outer line-join
                _strokeMath.CreateJoin(vxs1, prev, now, next0);
                vxs.AppendVertexStore(vxs1);
                //create inner line join

                //next outer line join
                vxs1.Clear();//reuse
                _strokeMath.CreateJoin(vxs1, now, next0, next1);
                vxs.AppendVertexStore(vxs1);

                vxs.AddLineTo(next0.x, next0.y);
                vxs.AddCloseFigure();
            }
        }
Ejemplo n.º 20
0
        static void CreateOuterBorder(VertexStore vxs, double x0, double y0, double x1, double y1, double w)
        {
            //create 'outer border box' of a line (x0,y0)=>(x1,y1)
            PixelFarm.VectorMath.Vector2 vector = new PixelFarm.VectorMath.Vector2(x1 - x0, y1 - y0);

            //for outer border, we need to extend both endpoints with len w
            //this will create overlapped area outside the shape.

            PixelFarm.VectorMath.Vector2 ext_vec = vector.NewLength(w);
            x0 -= ext_vec.x;
            y0 -= ext_vec.y;
            x1 += ext_vec.x;
            y1 += ext_vec.y;

            //rotate 90 degree to create a height vector that point to 'outside' of the 'rectbox' shape.
            //the box height= w
            PixelFarm.VectorMath.Vector2 h_vec = vector.RotateInDegree(90).NewLength(w);
            vxs.AddMoveTo(x0, y0);
            vxs.AddLineTo(x0 + h_vec.x, y0 + h_vec.y);
            vxs.AddLineTo(x1 + h_vec.x, y1 + h_vec.y);
            vxs.AddLineTo(x1, y1);
            vxs.AddCloseFigure();
        }
Ejemplo n.º 21
0
 public static void AddMoveTo(this VertexStore vxs, double x, double y, ICoordTransformer tx)
 {
     tx.Transform(ref x, ref y);
     vxs.AddMoveTo(x, y);
 }
Ejemplo n.º 22
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            SvgPart     svgPart = new SvgPart(SvgRenderVxKind.Path);
            VertexStore vxs     = new VertexStore();

            vxs.AddMoveTo(100, 20);
            vxs.AddLineTo(150, 50);
            vxs.AddLineTo(110, 80);
            vxs.AddCloseFigure();
            //-------------------------------------------
            svgPart.SetVxsAsOriginal(vxs);
            svgPart.FillColor = Color.Red;
            SvgRenderVx svgRenderVx = new SvgRenderVx(new SvgPart[] { svgPart });

            svgRenderVx.DisableBackingImage = true;


            var uiSprite = new UISprite(10, 10); //init size = (10,10), location=(0,0)

            uiSprite.LoadSvg(svgRenderVx);
            viewport.AddContent(uiSprite);

            var spriteEvListener = new GeneralEventListener();

            uiSprite.AttachExternalEventListener(spriteEvListener);



            //box1 = new LayoutFarm.CustomWidgets.SimpleBox(50, 50);
            //box1.BackColor = Color.Red;
            //box1.SetLocation(10, 10);
            ////box1.dbugTag = 1;
            //SetupActiveBoxProperties(box1);
            //viewport.AddContent(box1);
            //--------
            rectBoxController.Init();
            //polygonController.Visible = false;
            viewport.AddContent(polygonController);
            //-------------------------------------------
            viewport.AddContent(rectBoxController);

            //foreach (var ui in rectBoxController.GetControllerIter())
            //{
            //    viewport.AddContent(ui);
            //}

            spriteEvListener.MouseDown += e1 =>
            {
                //mousedown on ui sprite
                polygonController.SetPosition((int)uiSprite.Left, (int)uiSprite.Top);
                polygonController.SetTargetUISprite(uiSprite);
                polygonController.UpdateControlPoints(svgPart);
            };
            spriteEvListener.MouseMove += e1 =>
            {
                if (e1.IsDragging)
                {
                    //drag event on uisprite

                    int left = (int)uiSprite.Left;
                    int top  = (int)uiSprite.Top;

                    int new_left = left + e1.DiffCapturedX;
                    int new_top  = top + e1.DiffCapturedY;
                    uiSprite.SetLocation(new_left, new_top);
                    //-----
                    //also update controller position
                    polygonController.SetPosition(new_left, new_top);
                }
            };
        }
        void WriteOutput(VertexStore outputVxs, bool close)
        {
            //write output to

            if (close)
            {
                int positive_edgeCount = positiveSideVectors.Count;
                int negative_edgeCount = negativeSideVectors.Count;

                int    n = positive_edgeCount - 1;
                Vector v = positiveSideVectors[n];
                outputVxs.AddMoveTo(v.X, v.Y);
                for (; n >= 0; --n)
                {
                    v = positiveSideVectors[n];
                    outputVxs.AddLineTo(v.X, v.Y);
                }
                outputVxs.AddCloseFigure();
                //end ... create join to negative side
                //------------------------------------------
                //create line join from positive  to negative side
                v = negativeSideVectors[0];
                outputVxs.AddMoveTo(v.X, v.Y);
                n = 1;
                for (; n < negative_edgeCount; ++n)
                {
                    v = negativeSideVectors[n];
                    outputVxs.AddLineTo(v.X, v.Y);
                }
                //------------------------------------------
                //close
                outputVxs.AddCloseFigure();
            }
            else
            {
                int positive_edgeCount = positiveSideVectors.Count;
                int negative_edgeCount = negativeSideVectors.Count;

                //no a close shape stroke
                //create line cap for this
                //
                //positive
                Vector v = positiveSideVectors[0];
                //-----------
                //1. moveto

                //2.
                CreateStartLineCap(outputVxs,
                                   v,
                                   negativeSideVectors[0], this.HalfStrokeWidth);
                //-----------

                int n = 1;
                for (; n < positive_edgeCount; ++n)
                {
                    //increment n
                    v = positiveSideVectors[n];
                    outputVxs.AddLineTo(v.X, v.Y);
                }
                //negative

                //----------------------------------
                CreateEndLineCap(outputVxs,
                                 positiveSideVectors[positive_edgeCount - 1],
                                 negativeSideVectors[negative_edgeCount - 1],
                                 this.HalfStrokeWidth);
                //----------------------------------
                for (n = negative_edgeCount - 2; n >= 0; --n)
                {
                    //decrement n
                    v = negativeSideVectors[n];
                    outputVxs.AddLineTo(v.X, v.Y);
                }

                outputVxs.AddCloseFigure();
            }
            //reset
            positiveSideVectors.Clear();
            negativeSideVectors.Clear();
        }
Ejemplo n.º 24
0
 public void AddMoveTo(LineWalkerMark maker, double x, double y) => _vxs.AddMoveTo(x, y);
Ejemplo n.º 25
0
        void SimplifyPaths()
        {
            //return;
            //--------
            //lets smooth it
            //string str1 = dbugDumpPointsToString(contPoints);
            //string str2 = dbugDumpPointsToString2(contPoints);
            //var data2 = CurvePreprocess.RdpReduce(contPoints, 2);
            List <Vector2> data2 = contPoints;

            CubicBezier[] cubicBzs = CurveFit.Fit(data2, 8);
            vxs = new VertexStore();
            int j = cubicBzs.Length;

            //1.
            if (j > 1)
            {
                //1st
                CubicBezier bz0 = cubicBzs[0];
                vxs.AddMoveTo(bz0.p0.x, bz0.p0.y);
                vxs.AddLineTo(bz0.p0.x, bz0.p0.y);
                if (!bz0.HasSomeNanComponent)
                {
                    vxs.AddCurve4To(
                        bz0.p1.x, bz0.p1.y,
                        bz0.p2.x, bz0.p2.y,
                        bz0.p3.x, bz0.p3.y);
                }
                else
                {
                    vxs.AddLineTo(bz0.p3.x, bz0.p3.y);
                }


                //-------------------------------
                for (int i = 1; i < j; ++i) //start at 1
                {
                    CubicBezier bz = cubicBzs[i];
                    if (!bz.HasSomeNanComponent)
                    {
                        vxs.AddCurve4To(
                            bz.p1.x, bz.p1.y,
                            bz.p2.x, bz.p2.y,
                            bz.p3.x, bz.p3.y);
                    }
                    else
                    {
                        vxs.AddLineTo(bz0.p3.x, bz0.p3.y);
                    }
                }
                //-------------------------------
                //close
                //TODO: we not need this AddLineTo()
                vxs.AddLineTo(bz0.p0.x, bz0.p0.y);
                vxs.AddCloseFigure();
            }
            else if (j == 1)
            {
                CubicBezier bz0 = cubicBzs[0];
                vxs.AddMoveTo(bz0.p0.x, bz0.p0.y);

                if (!bz0.HasSomeNanComponent)
                {
                    vxs.AddCurve4To(
                        bz0.p1.x, bz0.p1.y,
                        bz0.p2.x, bz0.p2.y,
                        bz0.p3.x, bz0.p3.y);
                }
                else
                {
                    vxs.AddLineTo(bz0.p3.x, bz0.p3.y);
                }
            }
            else
            {
                // = 0
            }

            //TODO: review here
            VertexStore v2 = new VertexStore();

            cflat.MakeVxs(vxs, v2);
            vxs = v2;
        }
Ejemplo n.º 26
0
 public ShapeBuilder MoveTo(double x0, double y0)
 {
     _vxs.AddMoveTo(x0, y0);
     return(this);
 }