public void DrawDropletLabel(CGContext canvas, string label, SKPoint center, float radius, float strokeWidth, bool biggie, Swipe swipe) { using (var labelPaint = new SKPaint { Style = SKPaintStyle.Stroke, TextSize = swipe % (0.5f * radius), TextAlign = SKTextAlign.Center, Color = new SKColor(255, 255, 255, 191), StrokeWidth = swipe % strokeWidth, IsAntialias = true }) { CG.DrawTextS(canvas, label, swipe % new SKPoint(center.X, center.Y + 0.1f * radius), labelPaint); if (biggie) { CG.DrawTextS(canvas, ">4μL", swipe % new SKPoint(center.X, center.Y + 0.6f * radius), labelPaint); } } }
public void DrawDevice(KDeviceHandler.KDevice device, CGContext canvas, float canvasX, float canvasY, float canvasWidth, float canvasHeight, float deviceX, float deviceY, float deviceWidth, float deviceHeight, float padRadius, float margin, Swipe swipe) { DrawBackground(canvas, canvasX, canvasY, canvasWidth, canvasHeight); float padStrokeWidth = padRadius / 10.0f; float padStrokeWidthAccent = 0.75f * padStrokeWidth; SKRect coldZoneRect = new SKRect(deviceX + margin, deviceY + margin, deviceX + margin + device.coldZoneWidth * 2 * padRadius, deviceY + margin + device.rowsNo * 2 * padRadius); SKRect hotZoneRect = new SKRect(deviceX + margin + (device.coldZoneWidth + device.warmZoneWidth) * 2 * padRadius, deviceY + margin, deviceX + margin + (device.coldZoneWidth + device.warmZoneWidth + device.hotZoneWidth) * 2 * padRadius, deviceY + margin + device.rowsNo * 2 * padRadius); DrawHeatZone(canvas, coldZoneRect, padRadius, coldZoneRect.Width / (2 * device.coldZoneWidth), coldColor, swipe); DrawHeatZone(canvas, hotZoneRect, padRadius, hotZoneRect.Width / (2 * device.hotZoneWidth), hotColor, swipe); using (var zoneTextPaint = new SKPaint { Style = SKPaintStyle.Fill, TextSize = swipe % padRadius, TextAlign = SKTextAlign.Center, Color = SKColors.Blue, IsAntialias = true }) { CG.DrawTextS(canvas, "< " + KDeviceHandler.coldTemp, swipe % new SKPoint(coldZoneRect.MidX, coldZoneRect.Bottom + margin), zoneTextPaint); CG.DrawTextS(canvas, "> " + KDeviceHandler.hotTemp, swipe % new SKPoint(hotZoneRect.MidX, hotZoneRect.Bottom + margin), zoneTextPaint); } float strokePaintStrokeWidth = padStrokeWidth; float strokeAccentPaintStrokeWidth = padStrokeWidthAccent; using (var strokePaint = new SKPaint { Style = SKPaintStyle.Stroke, Color = SKColors.Black, StrokeWidth = swipe % strokePaintStrokeWidth, StrokeJoin = SKStrokeJoin.Round, IsAntialias = true }) using (var strokeAccentPaint = new SKPaint { Style = SKPaintStyle.Stroke, Color = SKColors.White, StrokeWidth = swipe % strokeAccentPaintStrokeWidth, StrokeJoin = SKStrokeJoin.Round, StrokeCap = SKStrokeCap.Round, IsAntialias = true }) using (var fillPaint = new SKPaint { Style = SKPaintStyle.Fill, Color = SKColors.Goldenrod, IsAntialias = true }) // SKColors.DarkGoldenrod / Goldenrod / PaleGoldenrod / LightGoldenrodYellow / Gold using (var holePaint = new SKPaint { Style = SKPaintStyle.Fill, Color = SKColors.Black, IsAntialias = true }) using (var holeAccentPaint = new SKPaint { Style = SKPaintStyle.Fill, Color = SKColors.White, IsAntialias = true }) { for (int j = 0; j < device.rowsNo; j++) { for (int i = 0; i < device.colsNo; i++) { DrawPad(canvas, new SKPoint(deviceX + margin + padRadius + i * 2 * padRadius, deviceY + margin + padRadius + j * 2 * padRadius), padRadius, strokePaint, strokePaintStrokeWidth, fillPaint, holePaint, strokeAccentPaint, strokeAccentPaintStrokeWidth, holeAccentPaint, swipe); } } } }
public /*interface Painter*/ void DrawText(string text, SKPoint point, SKPaint paint) { CG.DrawTextS(canvas, text, point, paint); }