Provided a complex shape of irregular form, drawn on a 2D surface (let's say a canvas). Provided also a point on that canvas in form of coordinates (e.g. a coordinate of a mouse click).

How to determine if the point resides inside, on the edge or outside of the said object.

For simplicity, let's consider the edge to be one pixel (point) wide.

To facilitate the question and suggest the level of complexity, let's consider a shape as shown on the image below.

![enter image description here](https://i.stack.imgur.com/Znofa.png)

So, to sum up:

1. Is the point with given coordinates inside the shape?
2. Is it on the edge?
3. Or is it outside of the shape?