I thought about this function again. Actually it could be used for any kind of corners. Just introduce a new parameter: "mask" which lets users define the mask manually.

Could you update the code accordingly? Shouldn't be much work. Otherwise I could do that quickly...