BuildSmoothBorders() public static method

public static BuildSmoothBorders ( float coordXYs, int &borderTriangleStripCount ) : float[]
coordXYs float
borderTriangleStripCount int
return float[]
Exemplo n.º 1
0
 public float[] GetSmoothBorders()
 {
     if (smoothBorderTess == null)
     {
         return(smoothBorderTess = SmoothBorderBuilder.BuildSmoothBorders(coordXYs, out borderTriangleStripCount));
     }
     return(smoothBorderTess);
 }
Exemplo n.º 2
0
        int _borderTriangleStripCount;                            //for smoothborder
        public float[] GetSmoothBorders(SmoothBorderBuilder smoothBorderBuilder)
        {
            //return existing result if not null
            //or create a newone if the old result is not exist

            return(_smoothBorderTess ??
                   (_smoothBorderTess =
                        smoothBorderBuilder.BuildSmoothBorders(_figures, IsClosedFigure, out _borderTriangleStripCount)));
        }
Exemplo n.º 3
0
            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();
                }
            }
Exemplo n.º 4
0
        //-------------------------------------------------------------------------------

        public void DrawRect(float x, float y, float w, float h)
        {
            switch (this.SmoothMode)
            {
            case CanvasSmoothMode.Smooth:
            {
                int     borderTriAngleCount;
                float[] triangles = SmoothBorderBuilder.BuildSmoothBorders(
                    CreatePolyLineRectCoords(x, y, w, h), out borderTriAngleCount);
                smoothLineShader.DrawTriangleStrips(triangles, borderTriAngleCount);
            }
            break;

            default:
            {
            }
            break;
            }
        }