src/macosx/classes/com/apple/laf/AquaIcon.java

Print this page

        

*** 35,44 **** --- 35,45 ---- import apple.laf.JRSUIConstants.Size; import apple.laf.*; import com.apple.laf.AquaUtilControlSize.*; import com.apple.laf.AquaUtils.RecyclableSingleton; + import sun.awt.image.MultiResolutionBufferedImage; public class AquaIcon { interface InvertableIcon extends Icon { public Icon getInvertedIcon(); }
*** 193,209 **** public CachableJRSUIIcon(final int width, final int height) { super(width, height); } Image createImage() { ! final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIState.getInstance()); initIconPainter(painter); ! final BufferedImage img = new BufferedImage(getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB_PRE); final Graphics g = img.getGraphics(); ! g.setClip(new Rectangle(0, 0, getIconWidth(), getIconHeight())); ! painter.paint(g, null, 0, 0, getIconWidth(), getIconHeight()); g.dispose(); return img; } public abstract void initIconPainter(final AquaPainter<JRSUIState> painter); --- 194,226 ---- public CachableJRSUIIcon(final int width, final int height) { super(width, height); } Image createImage() { ! final AquaPainter<JRSUIState> painter = ! AquaPainter.create(JRSUIState.getInstance()); initIconPainter(painter); ! final int w = getIconWidth(); ! final int h = getIconHeight(); ! Image baseImage = createImage(painter, w, h, w, h); ! ! return new MultiResolutionBufferedImage( ! baseImage, (rvWidth, rvHeight) -> ! createImage(painter, w, h, rvWidth, rvHeight)); ! } ! ! private static Image createImage(AquaPainter<JRSUIState> painter, ! int width, int height, int rvWidth, int rvHeight) { ! final BufferedImage img = new BufferedImage(rvWidth, rvHeight, ! BufferedImage.TYPE_INT_ARGB_PRE); final Graphics g = img.getGraphics(); ! g.setClip(new Rectangle(0, 0, rvWidth, rvHeight)); ! ! ((Graphics2D) g).scale(rvWidth / width, rvHeight / height); ! painter.paint(g, null, 0, 0, width, height); ! g.dispose(); return img; } public abstract void initIconPainter(final AquaPainter<JRSUIState> painter);