//------------------------------------------------------------------------------- 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; } }
//------------------------------------------------------------------------------- void FillGfxPath(Drawing.Color color, MultiPartTessResult multipartTessResult) { switch (SmoothMode) { case SmoothMode.No: { 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.2f; //TODO: review this *** basicFillShader.FillTriangles(multipartTessResult, color); //restore stroke width and color StrokeWidth = saved_Width; //restore back StrokeColor = saved_Color; } break; case SmoothMode.Smooth: { 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.2f; //TODO: review this *** basicFillShader.FillTriangles(multipartTessResult, color); //add smooth border smoothLineShader.DrawTriangleStrips(multipartTessResult); //restore stroke width and color StrokeWidth = saved_Width; //restore back StrokeColor = saved_Color; } break; } }