How to make a View with triangular perforations?

I am using the background features to achieve this so far. This works when the dimensions of the View fixed. Now I have a situation where the height of the View not constant, so I need to have a variable height on the fly. I can no longer use fixed-height backgrounds.
Here is the original source background:

And this is what the final View should look like:

Another way to look at the same problem is to allow the center of the image to stretch without distorting the borders? If we could do this, we could use the existing ones available as a background.
How can this be achieved? Has anyone else encountered this problem before? Is there an existing way to deal with this class of problems?
android android-view android-custom-view android-drawable
YS Aug 18 '15 at 13:10 2015-08-18 13:10
source share