26 new FrameworkPropertyMetadata(
false, FrameworkPropertyMetadataOptions.AffectsRender));
122 protected override void OnRender(DrawingContext dc)
127 var cx = RenderSize.Width / 2;
129 var glassFill =
IsOn ? Color.FromRgb(255, 214, 102) : Color.FromArgb(42, 100, 116, 139);
130 var glassStroke =
IsOn ? Color.FromRgb(255, 196, 0) : Color.FromRgb(102, 117, 139);
131 var filament =
IsOn ? Color.FromRgb(122, 75, 0) : Color.FromRgb(100, 116, 139);
132 var baseFill = Color.FromRgb(112, 128, 152);
137 dc.PushOpacity(0.35);
138 dc.DrawEllipse(
new SolidColorBrush(Color.FromRgb(255, 214, 102)),
null,
new Point(cx, top + d * .50), d * .62, d * .62);
143 new SolidColorBrush(glassFill),
144 new Pen(
new SolidColorBrush(glassStroke), 4),
147 var filamentGeometry = Geometry.Parse($
"M {cx - d * .22:F1},{top + d * .56:F1} C {cx - d * .12:F1},{top + d * .38:F1} {cx - d * .02:F1},{top + d * .72:F1} {cx + d * .10:F1},{top + d * .53:F1} C {cx + d * .16:F1},{top + d * .44:F1} {cx + d * .21:F1},{top + d * .49:F1} {cx + d * .25:F1},{top + d * .55:F1}");
148 dc.DrawGeometry(
null,
new Pen(
new SolidColorBrush(filament), 4) { StartLineCap = PenLineCap.Round, EndLineCap = PenLineCap.Round }, filamentGeometry);
150 var neckTop = top + d * .92;
151 var neck =
new StreamGeometry();
152 using (var ctx = neck.Open())
154 ctx.BeginFigure(
new Point(cx - d * .30, neckTop),
true,
true);
155 ctx.LineTo(
new Point(cx + d * .30, neckTop),
true,
false);
156 ctx.LineTo(
new Point(cx + d * .20, neckTop + d * .26),
true,
false);
157 ctx.LineTo(
new Point(cx - d * .20, neckTop + d * .26),
true,
false);
160 dc.DrawGeometry(
new SolidColorBrush(baseFill),
null, neck);
162 DrawBaseRib(dc, cx, neckTop + d * .10, d * .44, baseFill);
163 DrawBaseRib(dc, cx, neckTop + d * .22, d * .36, baseFill);
164 DrawBaseRib(dc, cx, neckTop + d * .34, d * .27, baseFill);
209 var geometry =
new StreamGeometry();
210 using var ctx = geometry.Open();
212 ctx.BeginFigure(
new Point(cx, top + d * .02),
true,
true);
213 ctx.BezierTo(
new Point(cx - d * .36, top + d * .02),
new Point(cx - d * .52, top + d * .27),
new Point(cx - d * .52, top + d * .54),
true,
false);
214 ctx.BezierTo(
new Point(cx - d * .52, top + d * .74),
new Point(cx - d * .35, top + d * .87),
new Point(cx - d * .25, top + d * .96),
true,
false);
215 ctx.LineTo(
new Point(cx + d * .25, top + d * .96),
true,
false);
216 ctx.BezierTo(
new Point(cx + d * .35, top + d * .87),
new Point(cx + d * .52, top + d * .74),
new Point(cx + d * .52, top + d * .54),
true,
false);
217 ctx.BezierTo(
new Point(cx + d * .52, top + d * .27),
new Point(cx + d * .36, top + d * .02),
new Point(cx, top + d * .02),
true,
false);