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

Print this page

        

*** 123,142 **** } private static final int kAlertIconSize = 64; static IconUIResource getAppIconCompositedOn(final Image background) { ! final BufferedImage iconImage = getAppIconImageCompositedOn(background, 1); ! ! if (background instanceof MultiResolutionIconImage) { ! BufferedImage background2x ! = ((MultiResolutionIconImage) background).resolutionVariant; ! BufferedImage icon2xImage = getAppIconImageCompositedOn(background2x, 2); ! ! return new IconUIResource(new ImageIcon( ! new MultiResolutionIconImage(iconImage, icon2xImage))); } return new IconUIResource(new ImageIcon(iconImage)); } static BufferedImage getAppIconImageCompositedOn(final Image background, int scaleFactor) { --- 123,140 ---- } private static final int kAlertIconSize = 64; static IconUIResource getAppIconCompositedOn(final Image background) { ! if (background instanceof MultiResolutionBufferedImage) { ! int width = background.getWidth(null); ! Image mrIconImage = ((MultiResolutionBufferedImage) background).map( ! rv -> getAppIconImageCompositedOn(rv, rv.getWidth(null) / width)); ! return new IconUIResource(new ImageIcon(mrIconImage)); } + + BufferedImage iconImage = getAppIconImageCompositedOn(background, 1); return new IconUIResource(new ImageIcon(iconImage)); } static BufferedImage getAppIconImageCompositedOn(final Image background, int scaleFactor) {
*** 310,323 **** if (icon instanceof MultiResolutionImage) { return icon; } ! Image icon2x = AquaUtils.getCImageCreator().createImageFromName( ! imageName, 2 * icon.getWidth(null), 2 * icon.getHeight(null)); ! return new MultiResolutionBufferedImage( ! BufferedImage.TYPE_INT_ARGB_PRE, 0, icon, icon2x); } public static class NineSliceMetrics { public final int wCut, eCut, nCut, sCut; public final int minW, minH; --- 308,327 ---- if (icon instanceof MultiResolutionImage) { return icon; } ! int w = icon.getWidth(null); ! int h = icon.getHeight(null); ! ! Dimension[] sizes = new Dimension[]{ ! new Dimension(w, h), new Dimension(2 * w, 2 * h) ! }; ! ! return new MultiResolutionBufferedImage(icon, sizes, (width, height) -> ! AquaUtils.getCImageCreator().createImageFromName( ! imageName, width, height)); } public static class NineSliceMetrics { public final int wCut, eCut, nCut, sCut; public final int minW, minH;
*** 522,552 **** } public static Color getSelectionInactiveForegroundColorUIResource() { return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR)); } - - static class MultiResolutionIconImage extends BufferedImage - implements MultiResolutionImage { - - BufferedImage resolutionVariant; - - public MultiResolutionIconImage(BufferedImage image, BufferedImage resolutionVariant) { - super(image.getWidth(), image.getHeight(), image.getType()); - this.resolutionVariant = resolutionVariant; - Graphics g = getGraphics(); - g.drawImage(image, 0, 0, null); - g.dispose(); - } - - @Override - public Image getResolutionVariant(int width, int height) { - return ((width <= getWidth() && height <= getHeight())) - ? this : resolutionVariant; - } - - @Override - public List<Image> getResolutionVariants() { - return Arrays.asList(this, resolutionVariant); - } - } } --- 526,531 ----