void CreateClockFace(ICanvasResourceCreator sender) { const float begin = center - radius - lineLength / 2; const float end = center + radius + lineLength / 2; using (var builder = new CanvasPathBuilder(sender)) { // Since we have concentric circles that we want to remain filled we want to use Winding to determine the filled region. builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding); builder.AddCircleFigure(new Vector2(center), radius); builder.AddCircleFigure(new Vector2(center), radius * 0.6f); builder.AddOneLineFigure(center, begin, center, begin + lineLength); builder.AddOneLineFigure(center, end - lineLength, center, end); builder.AddOneLineFigure(begin, center, begin + lineLength, center); builder.AddOneLineFigure(end - lineLength, center, end, center); using (CanvasGeometry clockFaceGeometry = CanvasGeometry.CreatePath(builder)) { clockFaceCachedFill = CanvasCachedGeometry.CreateFill(clockFaceGeometry); clockFaceCachedStroke18 = CanvasCachedGeometry.CreateStroke(clockFaceGeometry, 18, timeCircleStrokeStyle); clockFaceCachedStroke16 = CanvasCachedGeometry.CreateStroke(clockFaceGeometry, 16, timeCircleStrokeStyle); } } }
void CreateClockFace(ICanvasResourceCreator sender) { const float begin = center - radius - lineLength / 2; const float end = center + radius + lineLength / 2; using (var builder = new CanvasPathBuilder(sender)) { // Since we have concentric circles that we want to remain filled we want to use Winding to determine the filled region. builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding); builder.AddCircleFigure(new Vector2(center), radius); builder.AddCircleFigure(new Vector2(center), radius * 0.6f); builder.AddOneLineFigure(center, begin, center, begin + lineLength); builder.AddOneLineFigure(center, end - lineLength, center, end); builder.AddOneLineFigure(begin, center, begin + lineLength, center); builder.AddOneLineFigure(end - lineLength, center, end, center); using (CanvasGeometry clockFaceGeometry = CanvasGeometry.CreatePath(builder)) { clockFaceCachedFill = CanvasCachedGeometry.CreateFill(clockFaceGeometry); clockFaceCachedStroke18 = CanvasCachedGeometry.CreateStroke(clockFaceGeometry, 18, timeCircleStrokeStyle); clockFaceCachedStroke16 = CanvasCachedGeometry.CreateStroke(clockFaceGeometry, 16, timeCircleStrokeStyle); } } }