コード例 #1
0
ファイル: VectorToolBox.cs プロジェクト: zwcloud/Typography
        /// <summary>
        /// create contour(closed, open) from input flatten XYs,and put into output vxs
        /// </summary>
        /// <param name="flattenXYs"></param>
        /// <param name="vxs"></param>
        /// <param name="closedContour"></param>
        /// <returns></returns>
        public static VxsContext1 Borrow(float[] flattenXYs, out VertexStore vxs, bool closedContour = true)
        {
            VxsContext1 context1 = Borrow(out vxs);

            using (VectorToolBox.Borrow(vxs, out PathWriter pw))
            {
                if (closedContour)
                {
                    pw.WritePolygon(flattenXYs);
                }
                else
                {
                    pw.WritePolylines(flattenXYs);
                }
            }
            return(context1);
        }
コード例 #2
0
ファイル: VectorToolBox.cs プロジェクト: zwcloud/Typography
        public static VxsContext1 Borrow(double[] flattenXYs, out VertexStore vxs, bool closedContour = true)
        {
            VxsContext1 context1 = Borrow(out vxs);

            using (VectorToolBox.Borrow(vxs, out PathWriter pw))
            {
                pw.MoveTo(flattenXYs[0], flattenXYs[1]);
                for (int i = 2; i < flattenXYs.Length;)
                {
                    pw.LineTo(flattenXYs[i], flattenXYs[i + 1]);
                    i += 2;
                }
                if (closedContour)
                {
                    pw.CloseFigure();
                }
            }
            return(context1);
        }