public static @NotNull Rectangle2D align(@NotNull Graphics2D g,
                                  @NotNull EnumSet<Align> align,
                                  double x, double y, double prefWidth, double prefHeight,
                                  @NotNull StrokeType strokeType, double strokeWidth) {
    if (align.contains(Align.CENTER_X) && prefWidth >= strokeWidth * 2) {
      double[] p = LinePainter2D.alignSizeXY(g, x, prefWidth, strokeType, strokeWidth, true);
      x = p[0];
      prefWidth = p[1];
    }
    if (align.contains(Align.CENTER_Y) && prefHeight >= strokeWidth * 2) {
      double[] p = LinePainter2D.alignSizeXY(g, y, prefHeight, strokeType, strokeWidth, true);
      y = p[0];
      prefHeight = p[1];
    }
    return new Rectangle2D.Double(x, y, prefWidth, prefHeight);
  }
public static @NotNull Rectangle2D align(@NotNull Graphics2D g,
                                  @NotNull EnumSet<Align> align,
                                  double x, double y, double prefWidth, double prefHeight,
                                  @NotNull StrokeType strokeType, double strokeWidth)