'C# how to resize bitmap to fit polygon shape

I am trying to find a function that takes a Bitmap and a polygon shape (arrays of Point[]) and wraps the Bitmap to the shape of that polygon and morphing it to fit properly then returning a new Bitmap which can then be drawn to screen and it will draw the shape of the polygon but filled with the texture perfectly stretched to fit it.

So far I've tried TextureBrush however that only allows Tiling and other things and does not seem to support stretching the Bitmap.

I also tried GraphicsPath but that only allowed extracting the polygon shape from the Bitmap not wrapping the Bitmap to that shape.

Example:

Heres a world map Text

And here is the map wrapped to fit a polygon Text

This is what I'm looking for does anybody know how its done?

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source