예제 #1
0
 public bool HitTest(int x, int y)
 {
     //check if point in polygon
     if (!validBoundingRect)
     {
         PixelFarm.Agg.BoundingRect.GetBoundingRect(new Agg.VertexStoreSnap(vxs), ref boundingRect);
         validBoundingRect = true;
     }
     if (this.boundingRect.Contains(x, y))
     {
         //fine tune
         //hit test ***
         return(VertexHitTester.IsPointInVxs(this.vxs, x, y));
     }
     return(false);
 }
예제 #2
0
 public override bool HitTest(int x, int y)
 {
     if (!validBoundingRect)
     {
         var spriteShape = lionFill.GetSpriteShape();
         PixelFarm.Agg.BoundingRect.GetBoundingRect(new PixelFarm.Agg.VertexStoreSnap(spriteShape.Path.Vxs), ref boundingRect);
         validBoundingRect = true;
     }
     if (this.boundingRect.Contains(x, y))
     {
         //fine tune
         //hit test ***
         var spriteShape = lionFill.GetSpriteShape();
         return(VertexHitTester.IsPointInVxs(spriteShape.Path.Vxs, x, y));
     }
     return(false);
 }
예제 #3
0
        static bool HitTestOnSubPart(SvgRenderVx _svgRenderVx, float x, float y)
        {
            int partCount = _svgRenderVx.SvgVxCount;


            for (int i = partCount - 1; i >= 0; --i)
            {
                //we do hittest top to bottom => (so => iter backward)

                SvgPart vx = _svgRenderVx.GetInnerVx(i);
                if (vx.Kind != SvgRenderVxKind.Path)
                {
                    continue;
                }
                VertexStore innerVxs = vx.GetVxs();
                //fine tune
                //hit test ***
                if (VertexHitTester.IsPointInVxs(innerVxs, x, y))
                {
                    return(true);
                }
            }
            return(false);
        }