void (Graphics2D g, double xStart, double xEnd, double y) { Shape clip = g.getClip(); final Rectangle2D rectangle = new Rectangle2D.Double(xStart, y - 3, xEnd - xStart, 3); final Rectangle2D waveClip = clip != null ? clip.getBounds2D().createIntersection(rectangle) : rectangle; if (waveClip.isEmpty()) return; Graphics2D g2d = (Graphics2D)g.create(); try { g2d.setComposite(AlphaComposite.SrcOver); g2d.setClip(waveClip); xStart -= xStart % 4; g2d.translate(xStart, y - 3); StartupUiUtil.drawImage(g2d, myImage, 0, 0, null); } finally { g2d.dispose(); } }