createNormalizeMatrix method

Artifact createNormalizeMatrix(
  1. int desiredWidth,
  2. int desiredHeight
)

Creates a new Artifact with the specified desired width and height, by resizing the current Artifact.

If the current Artifact is punctuation, it will not be cropped and will be centered in the new Artifact. Otherwise, the current Artifact will be trimmed and then wrapped with false values before being resized.

Parameters:

  • desiredWidth: The desired width of the new Artifact.
  • desiredHeight: The desired height of the new Artifact.

Returns: A new Artifact with the specified dimensions, containing a resized version of the original Artifact's content.

Implementation

Artifact 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,
    );
  }
}