Detect objects in shape

Hello, I am scratching my head about this: how do I detect if my object (circle in this case) is inside a custom shape/outline?

Here is a sample image:

How would I be able to detect if the green circle is in the shape fully (which it is), and if the blue circle is? And HOW can I find the percentage on how much of the blue circle is in the custom shape/outline?