コード例 #1
0
        public bool HitTest(Container container, ref Vector2 localPoint)
        {
            localPoint = container.GlobalToLocal(HitTestContext.screenPoint);

            int x = (int)Math.Floor((localPoint.x / scaleX - offsetX) * _data.scale);
            int y = (int)Math.Floor((localPoint.y / scaleY - offsetY) * _data.scale);

            if (x < 0 || y < 0 || x >= _data.pixelWidth)
            {
                return(false);
            }

            int pos  = y * _data.pixelWidth + x;
            int pos2 = pos / 8;
            int pos3 = pos % 8;

            if (pos2 >= 0 && pos2 < _data.pixels.Length)
            {
                return(((_data.pixels[pos2] >> pos3) & 0x1) > 0);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 public bool HitTest(Container container, ref Vector2 localPoint)
 {
     localPoint = container.GlobalToLocal(HitTestContext.screenPoint);
     return(rect.Contains(localPoint.x, localPoint.y));
 }