void (Component c, Graphics graphics, int x, int y) { Graphics2D g = (Graphics2D)graphics.create(); try { g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int width = mySourceIcon.getIconWidth(); int height = mySourceIcon.getIconHeight(); Image image = IconLoader.toImage(mySourceIcon); if (image == null) return; BufferedImage bufferedImage = ImageUtil.toBufferedImage(image); double scale = (double)bufferedImage.getWidth() / width; AffineTransform transform = g.getTransform(); transform.concatenate(AffineTransform.getScaleInstance(1d/scale, 1d/scale)); transform.concatenate(AffineTransform.getTranslateInstance(x * scale, y * scale)); g.setTransform(transform); g.setPaint(new TexturePaint(bufferedImage, new Rectangle(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight()))); int hash = Objects.hash(x, y, getIconWidth(), getIconHeight(), scale, myArcRatio); if (myLastShapeHash != hash) { if (mySuperEllipse) { myLastShape = getSuperEllipse(0, 0, getIconWidth() * scale, getIconHeight() * scale, myArcRatio); } else { double actualArc = myArcRatio * Math.min(width, height) * scale; myLastShape = new RoundRectangle2D.Double(0, 0, getIconWidth() * scale, getIconHeight() * scale, actualArc, actualArc); } myLastShapeHash = hash; } g.fill(myLastShape); if (mySuperEllipse && Boolean.getBoolean("idea.debug.rounded.icon.mode")) { printDebugMessage(g, x, y, "n=" + String.format("%.2f", getPower(myArcRatio)), scale); } } finally { g.dispose(); } }