void (final @NotNull Graphics2D g, double x, double y, double width, double height, @Nullable Double arc, @NotNull StrokeType strokeType, double strokeWidth, @NotNull Object valueAA) { if (width < 0 || height < 0) return; double sw = alignToInt(strokeWidth, g); // align conforms to LinePainter2D x = alignToInt(x, g); y = alignToInt(y, g); double[] strokeSplit = LinePainter2D.getStrokeSplit(ScaleContext.create(g), strokeType, sw, false); double sw_1 = strokeSplit[0]; double sw_2 = strokeSplit[1]; double dsw = sw * 2; if (strokeType == StrokeType.INSIDE) dsw = 0; double x_out = x - sw_1; double y_out = y - sw_1; double w_out = sw_1 + width + sw_2; double h_out = sw_1 + height + sw_2; final Shape rect = arc != null ? new RoundRectangle2D.Double(x_out, y_out, w_out, h_out, arc + dsw, arc + dsw) : new Rectangle2D.Double(x_out, y_out, w_out, h_out); PaintUtil.paintWithAA(g, arc != null ? valueAA : RenderingHints.VALUE_ANTIALIAS_DEFAULT, () -> g.fill(rect)); }