} // avoid sharing Id and getting it globally clobbered! public static bool Same(Swipe swipe1, Swipe swipe2) { return(swipe1.scale == swipe2.scale && swipe1.translate.X == swipe2.translate.X && swipe1.translate.Y == swipe2.translate.Y); }
public static SKRect Inverse(SKRect r, Swipe w) { return(new SKRect((r.Left - w.translate.X) / w.scale, (r.Top - w.translate.Y) / w.scale, (r.Right - w.translate.X) / w.scale, (r.Bottom - w.translate.Y) / w.scale)); }
// Inverse transformations public static SKPoint Inverse(SKPoint p, Swipe w) { return(new SKPoint((p.X - w.translate.X) / w.scale, (p.Y - w.translate.Y) / w.scale)); }
public /*interface ChartPainter*/ void DrawCourseFill(List <KChartEntry> list, int seriesIndex, float bottom, SKColor color, Swipe pinchPan) { if (list.Count > 1) { using (var paint = FillPaint(color)) { var path = new SKPath(); path.MoveTo(pinchPan % new SKPoint(list[0].Ypoint[seriesIndex].X, bottom)); path.LineTo(pinchPan % list[0].Ypoint[seriesIndex]); for (int i = 0; i < list.Count; i++) { path.LineTo(pinchPan % list[i].Ypoint[seriesIndex]); } path.LineTo(pinchPan % new SKPoint(list[list.Count - 1].Ypoint[seriesIndex].X, bottom)); path.Close(); canvas.DrawPath(path, paint); } } }
public /*interface ChartPainter*/ void DrawCourseRange(List <KChartEntry> list, int seriesIndex, SKColor color, Swipe pinchPan) { if (list.Count == 1) { canvas.DrawCircle(list[0].Ypoint[seriesIndex], pinchPan % 3, FillPaint(color)); } if (list.Count > 1) { using (var paint = FillPaint(color)) { var path = new SKPath(); KChartEntry entry0 = list[0]; SKPoint meanPoint0 = entry0.Ypoint[seriesIndex]; float range0 = entry0.YpointRange[seriesIndex]; path.MoveTo(pinchPan % new SKPoint(meanPoint0.X, meanPoint0.Y + range0)); path.LineTo(pinchPan % new SKPoint(meanPoint0.X, meanPoint0.Y - range0)); for (int i = 0; i < list.Count; i++) { KChartEntry entry = list[i]; SKPoint meanPoint = entry.Ypoint[seriesIndex]; float range = entry.YpointRange[seriesIndex]; path.LineTo(pinchPan % new SKPoint(meanPoint.X, meanPoint.Y - range)); } for (int i = list.Count - 1; i >= 0; i--) { KChartEntry entry = list[i]; SKPoint meanPoint = entry.Ypoint[seriesIndex]; float range = entry.YpointRange[seriesIndex]; path.LineTo(pinchPan % new SKPoint(meanPoint.X, meanPoint.Y + range)); } path.Close(); canvas.DrawPath(path, paint); } } }
public /*interface ChartPainter*/ void DrawCourse(List <KChartEntry> list, int seriesIndex, float pointSize, SKColor color, Swipe pinchPan) { if (list.Count == 1) { canvas.DrawCircle(list[0].Ypoint[seriesIndex], pinchPan % 3, FillPaint(color)); } if (list.Count > 1) { using (var paint = LinePaint(pointSize, color)) { var path = new SKPath(); path.MoveTo(pinchPan % list[0].Ypoint[seriesIndex]); for (int i = 0; i < list.Count; i++) { path.LineTo(pinchPan % list[i].Ypoint[seriesIndex]); } canvas.DrawPath(path, paint); } } }