@Override
    public void paint(@NotNull Graphics2D g, double x, double y, double width, double height, Paint paint) {
      if (paint == null) paint = g.getPaint();
      g = (Graphics2D)g.create();
      g.translate(x, y);
      g.clip(new Rectangle2D.Double(0, 0, width, height));

      g.setComposite(AlphaComposite.SrcOver);
      BufferedImage image = paint instanceof Color ? getImage(g, (Color)paint, height) : createImage(g, paint, height);
      if (image == null) return;

      double period = ImageUtil.getRealWidth(image) / ImageUtil.getImageScale(image);
      double offset = (x % period + period) % period; // normalize
      g.translate(-offset, 0);
      for (double dx = -offset; dx < width; dx += period) {
        StartupUiUtil.drawImage(g, image, 0, 0, null);
        g.translate(period, 0);
      }
      g.dispose();
    }
@Override
    public void paint(@NotNull Graphics2D g, double x, double y, double width, double height, Paint paint)