コード例 #1
0
ファイル: Sweep.cs プロジェクト: nancyhome/Drawing
 public void Render(List <Strokedata> strokelist, Strokedata stroke)
 {
     Cleancanvas();
     _swapchain.Present(0, PresentFlags.None);
     Pointtrace.ClearAll();
     Tooltype.type = Tooltype.lasttype;
 }
コード例 #2
0
        protected void Createvertex(Strokedata stroke)
        {
            Pointdata a = null, b = null, c = null, d = null;

            // create test vertex data, making sure to rewind the stream afterward
            lock (stroke.Plist)
            {
                int count             = 0;
                int precise           = 5;
                List <Pointdata> list = CloneTool.Clone(stroke.Plist);
                Pointdata        last = list[0];
                for (int j = 0; j < list.Count; j++)
                {
                    Pointdata p = list[j];
                    if (j >= stroke.Index)
                    {
                        List <Pointdata> pointCircle = MathTool.GetCircle(p, stroke, precise);
                        for (int i = 0; i < precise * 2; i++)
                        {
                            TriangleContext(p, pointCircle[(i + 1) % (precise * 2)], pointCircle[i]);
                        }
                        if (count > 0)
                        {
                            if (last.y.Equals(p.y))
                            {
                                a = new Pointdata(last.x, MathTool.GetRelateY(MathTool.GetRealY(last) + stroke.Line * (1f)));
                                b = new Pointdata(last.x, MathTool.GetRelateY(MathTool.GetRealY(last) - stroke.Line * (1f)));
                                c = new Pointdata(p.x, MathTool.GetRelateY(MathTool.GetRealY(p) + stroke.Line * (1f)));
                                d = new Pointdata(p.x, MathTool.GetRelateY(MathTool.GetRealY(p) - stroke.Line * (1f)));
                            }
                            else
                            {
                                a = MathTool.GetpointA(last, p, stroke.Line);
                                b = MathTool.GetpointB(last, p, stroke.Line);
                                c = MathTool.GetpointC(last, p, stroke.Line);
                                d = MathTool.GetpointD(last, p, stroke.Line);
                            }
                        }
                        count++;
                        if (a != null)
                        {
                            TriangleContext(a, c, b);
                            TriangleContext(a, b, c);

                            TriangleContext(c, d, b);
                            TriangleContext(c, b, d);
                        }

                        last         = p;
                        stroke.Index = j;
                    }
                }
            }
        }
コード例 #3
0
ファイル: MathTool.cs プロジェクト: nancyhome/Drawing
        public static List <Pointdata> GetCircle(Pointdata p, Strokedata s, int precise)
        {
            List <Pointdata> pointlist = new List <Pointdata>();

            for (float i = 0; i < precise * 2; i++)
            {
                pointlist.Add(new Pointdata(GetRelateX((float)(GetRealX(p) + s.Line * (1f) * Math.Cos(Math.PI * i / precise))),
                                            GetRelateY((float)(GetRealY(p) + s.Line * (1f) * Math.Sin(Math.PI * i / precise)))));
            }
            return(pointlist);
        }
コード例 #4
0
        public void Render(List <Strokedata> strokelist, Strokedata stroke)
        {
            int curtype = stroke.Type;

            this.shaderfile = Tooltype.Getfx(stroke.Type);
            Compilevertex();
            Compilepixel();
            if (stroke.Plist.Count > 0)
            {
                Createvertex(stroke);
            }
            _swapchain.Present(0, PresentFlags.None);
        }
コード例 #5
0
 public virtual void Render(List <Strokedata> strokelist, Strokedata stroke)
 {
 }