By default, the cells are assumed to be of equal size (hence scale-9 image dimensions are normally a multiple of 3). By using {@link #xaxis} and {@link #yaxis}, this partitioning can be controlled directly.
Here's a diagram showing the stretching and axes, H = horizontally stretched, V = vertically stretched, U = unstretched.
xaxis 0 1 2 --------------------------------- | | | | 0 | U | H | U | | | | | --------------------------------- | | | | yaxis 1 | V | H&V | V | | | | | --------------------------------- | | | | 2 | U | H | U | | | | | ---------------------------------
Example 1: the horizontal middle of an image is a single pixel. This code will do that and automatically grow the left and right columns:
Scale9 s9 = ...; s9.xaxis.resize(1, 1);
Example 2: there are no top and bottom rows. This code will stretch all of the image vertically, but keep the left and right third of the image fixed horizontally:
Scale9 s9 = ...; s9.yaxis.resize(0, 0).resize(2, 0);
|
|
|
|