SkiaSharp 在路径上制作位图可点击

SkiaSharp make a bitmap on a path clickable

我画了一个圆形路径,每 1 度角添加一个位图。现在,我想使用 Xamarin 表单收听每个位图在该 Circle 路径上的点击!我如何实现这一点。 我已经在 xamarin 上进行了操作 touches 并开始获取触摸坐标,但无法准确获取选择了哪个位图?

编辑:

 foreach (var item in bitmapPoints)
  {
    using (Stream streami = assembly.GetManifestResourceStream(resID))
    {
      redBitmap = SKBitmap.Decode(streami);
    }
      canvas.DrawBitmap(redBitmap,item, null);
  }

现在我正在尝试为 Canvas 上绘制的每个位图启用点击事件。我应该制作具有 HiTest 方法的自定义 BitMap class 吗?如果是这样,要传递给 HiTest 的 Rect x 和 y 应该是什么?

这叫做 "Hit Testing" - Xamarin 在他们的 SkiaSharp 文档中有一个 sample

public bool HitTest(SKPoint location)
{
    // Invert the matrix
    SKMatrix inverseMatrix;

    if (Matrix.TryInvert(out inverseMatrix))
    {
        // Transform the point using the inverted matrix
        SKPoint transformedPoint = inverseMatrix.MapPoint(location);

        // Check if it's in the untransformed bitmap rectangle
        SKRect rect = new SKRect(0, 0, bitmap.Width, bitmap.Height);
        return rect.Contains(transformedPoint);
    }
    return false;
}