createNormalizeMatrix method
Creates a new Matrix with the specified desired width and height, by resizing the current Matrix.
If the current Matrix is punctuation, it will not be cropped and will be centered in the new Matrix. Otherwise, the current Matrix will be trimmed and then wrapped with false values before being resized.
Parameters:
desiredWidth
: The desired width of the new Matrix.desiredHeight
: The desired height of the new Matrix.
Returns: A new Matrix with the specified dimensions, containing a resized version of the original Matrix's content.
Implementation
Matrix createNormalizeMatrix(
final int desiredWidth,
final int desiredHeight,
) {
// help resizing by ensuring there's a border
if (isPunctuation()) {
// do not crop and center
return _createWrapGridWithFalse()._createResizedGrid(
desiredWidth,
desiredHeight,
);
} else {
// Resize
return trim()._createWrapGridWithFalse()._createResizedGrid(
desiredWidth,
desiredHeight,
);
}
}