PixelFarm.DrawingGL.Figure.GetAreaTess C# (CSharp) Method

GetAreaTess() public method

public GetAreaTess ( TessTool &tess ) : float[]
tess TessTool
return float[]
        public float[] GetAreaTess(ref TessTool tess)
        {
            if (areaTess == null)
            {
                List<Vertex> vertextList = tess.TessPolygon(coordXYs);
                //-----------------------------   
                //switch how to fill polygon
                int j = vertextList.Count;
                float[] vtx = new float[j * 2];
                int n = 0;
                for (int p = 0; p < j; ++p)
                {
                    var v = vertextList[p];
                    vtx[n] = (float)v.m_X;
                    vtx[n + 1] = (float)v.m_Y;
                    n += 2;
                }
                //triangle list
                tessAreaTriangleCount = j;
                //-------------------------------------                              
                return this.areaTess = vtx;
            }
            return areaTess;
        }
    }

Usage Example

示例#1
0
        //-------------------------------------------------------------------------------
        public void FillGfxPath(Drawing.Color color, InternalGraphicsPath igpth)
        {
            switch (SmoothMode)
            {
            case CanvasSmoothMode.No:
            {
                List <Figure> figures      = igpth.figures;
                int           subPathCount = figures.Count;
                for (int i = 0; i < subPathCount; ++i)
                {
                    Figure  f        = figures[i];
                    float[] tessArea = f.GetAreaTess(ref this.tessTool);
                    if (tessArea != null)
                    {
                        this.basicFillShader.FillTriangles(tessArea, f.TessAreaTriangleCount, color);
                    }
                }
            }
            break;

            case CanvasSmoothMode.Smooth:
            {
                List <Figure> figures      = igpth.figures;
                int           subPathCount = figures.Count;
                float         prevWidth    = StrokeWidth;

                StrokeColor = color;
                StrokeWidth = 0.5f;
                for (int i = 0; i < subPathCount; ++i)
                {
                    Figure  f        = figures[i];
                    float[] tessArea = f.GetAreaTess(ref this.tessTool);
                    if (tessArea != null)
                    {
                        basicFillShader.FillTriangles(tessArea, f.TessAreaTriangleCount, color);
                        smoothLineShader.DrawTriangleStrips(f.GetSmoothBorders(), f.BorderTriangleStripCount);
                    }
                }
                StrokeWidth = prevWidth;
            }
            break;
            }
        }
All Usage Examples Of PixelFarm.DrawingGL.Figure::GetAreaTess