コード例 #1
0
ファイル: GLPainter.cs プロジェクト: luislasonbra/PixelFarm
        public MultiPartTessResult CreateMultiPartTessResult(MultiPartPolygon multipartPolygon)
        {
            //store internal gfx path inside render vx
            MultiPartTessResult multipartTessResult = new MultiPartTessResult();

            _igfxPathBuilder.CreateGraphicsPathForMultiPartRenderVx(multipartPolygon,
                                                                    multipartTessResult,
                                                                    _glsx.GetTessTool(),
                                                                    _glsx.GetSmoothBorderBuilder());
            //
            return(multipartTessResult);
        }
コード例 #2
0
ファイル: GLPainter.cs プロジェクト: luislasonbra/PixelFarm
            internal void CreateGraphicsPathForMultiPartRenderVx(
                MultiPartPolygon multipartPolygon,
                MultiPartTessResult multipartTessResult,
                TessTool tessTool,
                SmoothBorderBuilder borderBuilder)
            {
                //a multipart polygon contains a  list of  expand coord (x,y) set.

                List <float[]> expandCoordsList = multipartPolygon.expandCoordsList;
                List <int[]>   endPointList     = multipartPolygon.contourEndPoints;


                int listCount = expandCoordsList.Count;

                for (int i = 0; i < listCount; ++i)
                {
                    //expand x,y
                    float[] expandCoords = expandCoordsList[i];
                    int[]   endPoints    = endPointList[i];
                    //area
                    int localVertexCount;

                    tessTool.TessAndAddToMultiPartResult(expandCoords,
                                                         endPoints,
                                                         multipartTessResult,
                                                         out localVertexCount);

                    //borders
                    //build smooth border
                    int m = endPoints.Length;
                    int latest_endPoint = 0;
                    multipartTessResult.BeginBorderPart();
                    for (int n = 0; n < m; ++n)
                    {
                        int endPoint = endPoints[n];                     //'x' , not include 'y'
                        int len      = (endPoint - latest_endPoint) + 1; //so len we add +1 for 'y'
                        int borderTriangleStripCount;
                        //expand coords for draw array
                        float[] smoothBorderXYs = borderBuilder.BuildSmoothBorders(expandCoords, latest_endPoint, len, out borderTriangleStripCount);
                        latest_endPoint += len + 2;
                        multipartTessResult.AddSmoothBorders(smoothBorderXYs, borderTriangleStripCount);
                    }
                    multipartTessResult.EndBorderPart();
                }
            }