Set brush size to avoid over-large borders.
Attempted brute force method.

This eats a *lot* of time and memory.
cleanup
Trying pixel regions for computation
Brute forcing, but intelligently.

Although this is still brute-forcing through the pixels, it involves
*significantly* fewer paint operations

    max(x + y) rather than max(x * y)

so it ends up being *significantly* faster.

The next step might be to use the pixel regions to do the write in one
fell swoop; it will probably save using brushes (which has proven
problematic) and ensuring state of UI (like, no selection)
Cleaned up and commented.
Abandoned branch: Brute forcing using built-in functions.
Merged: Use pixel region computation

Android supports more than one elastic region. e.g. In the case of a
stretchable border with an image in the center, the areas around the
center image can stretch.

Unfortunately, this GIMP plugin did not support that, since it simply
selected the whole opaque region and drew the borders based on that.
To do this properly requires much more interrogation of the elastic
and content layers.

After experimentation (note previous commit is the abandoned first
attempt) I found the pixel regions to be a fast and straightforward
way to provide this logic.  Unfortunately, directly querying and
manipulating the layers is extremely slow -- minutes rather than
seconds slow.

I may build on this by using pixel regions to write the resulting
border as well, which should give a further boost in performance.