Пример #1
0
        public void FillGfxPath(Drawing.Color color, InternalGraphicsPath igpth)
        {
            switch (SmoothMode)
            {
            case SmoothMode.No:
            {
                int subPathCount = igpth.FigCount;

                for (int i = 0; i < subPathCount; ++i)
                {
                    Figure f = igpth.GetFig(i);
                    if (f.SupportVertexBuffer)
                    {
                        basicFillShader.FillTriangles(
                            f.GetAreaTessAsVBO(tessTool),
                            f.TessAreaVertexCount,
                            color);
                    }
                    else
                    {
                        float[] tessArea = f.GetAreaTess(this.tessTool);
                        if (tessArea != null)
                        {
                            this.basicFillShader.FillTriangles(tessArea, f.TessAreaVertexCount, color);
                        }
                    }
                }
            }
            break;

            case SmoothMode.Smooth:
            {
                int           subPathCount = igpth.FigCount;
                float         saved_Width  = StrokeWidth;
                Drawing.Color saved_Color  = StrokeColor;
                //temp set stroke width to 2 amd stroke color
                //to the same as bg color (for smooth border).
                //and it will be set back later.
                //
                StrokeColor = color;
                StrokeWidth = 1.5f;         //TODO: review this ***
                //
                float[] tessArea;
                for (int i = 0; i < subPathCount; ++i)
                {
                    //draw each sub-path
                    Figure f = igpth.GetFig(i);
                    if (f.SupportVertexBuffer)
                    {
                        //TODO: review here again
                        //draw area
                        basicFillShader.FillTriangles(
                            f.GetAreaTessAsVBO(tessTool),
                            f.TessAreaVertexCount,
                            color);
                        //draw smooth border
                        smoothLineShader.DrawTriangleStrips(
                            f.GetSmoothBorders(smoothBorderBuilder),
                            f.BorderTriangleStripCount);
                    }
                    else
                    {
                        if ((tessArea = f.GetAreaTess(this.tessTool)) != null)
                        {
                            //draw area
                            basicFillShader.FillTriangles(tessArea, f.TessAreaVertexCount, color);
                            //draw smooth border
                            smoothLineShader.DrawTriangleStrips(
                                f.GetSmoothBorders(smoothBorderBuilder),
                                f.BorderTriangleStripCount);
                        }
                    }
                }
                //restore stroke width and color
                StrokeWidth = saved_Width;         //restore back
                StrokeColor = saved_Color;
            }
            break;
            }
        }