Having a rich UI application in which I want to show image with complex shape like this

Now what I want is to crop my image as per Mask image, Actually image is coming dynamic and can be imported from Camera or Gallery(square or rectangle shape) and I want that image to fit in my layout frame like above
So just wondering that how do I have achieve this? Any idea /hint welcome
Background frame

Mask

Like this
Finally got the solution while changing mask image and using of
XfermodewithBitmapMask
see output
Source can be found here