Java 类sun.awt.image.MultiResolutionCachedImage 实例源码

项目:OpenJSharp    文件:CImage.java   
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) return null;

    final Dimension2D size = nativeGetNSImageSize(ptr);
    final int w = (int)size.getWidth();
    final int h = (int)size.getHeight();

    Dimension2D[] sizes
            = nativeGetNSImageRepresentationSizes(ptr,
                    size.getWidth(), size.getHeight());

    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(w, h, (width, height)
                    -> toImage(w, h, width, height))
            : new MultiResolutionCachedImage(w, h, sizes, (width, height)
                    -> toImage(w, h, width, height));
}
项目:jdk8u-jdk    文件:CImage.java   
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) return null;

    final Dimension2D size = nativeGetNSImageSize(ptr);
    final int w = (int)size.getWidth();
    final int h = (int)size.getHeight();

    Dimension2D[] sizes
            = nativeGetNSImageRepresentationSizes(ptr,
                    size.getWidth(), size.getHeight());

    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(w, h, (width, height)
                    -> toImage(w, h, width, height))
            : new MultiResolutionCachedImage(w, h, sizes, (width, height)
                    -> toImage(w, h, width, height));
}
项目:openjdk9    文件:CImage.java   
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) return null;

    final Dimension2D size = nativeGetNSImageSize(ptr);
    final int w = (int)size.getWidth();
    final int h = (int)size.getHeight();

    Dimension2D[] sizes
            = nativeGetNSImageRepresentationSizes(ptr,
                    size.getWidth(), size.getHeight());

    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(w, h, (width, height)
                    -> toImage(w, h, width, height))
            : new MultiResolutionCachedImage(w, h, sizes, (width, height)
                    -> toImage(w, h, width, height));
}
项目:infobip-open-jdk-8    文件:CImage.java   
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) return null;

    final Dimension2D size = nativeGetNSImageSize(ptr);
    final int w = (int)size.getWidth();
    final int h = (int)size.getHeight();

    Dimension2D[] sizes
            = nativeGetNSImageRepresentationSizes(ptr,
                    size.getWidth(), size.getHeight());

    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(w, h, (width, height)
                    -> toImage(w, h, width, height))
            : new MultiResolutionCachedImage(w, h, sizes, (width, height)
                    -> toImage(w, h, width, height));
}
项目:jdk8u-dev-jdk    文件:CImage.java   
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) return null;

    final Dimension2D size = nativeGetNSImageSize(ptr);
    final int w = (int)size.getWidth();
    final int h = (int)size.getHeight();

    Dimension2D[] sizes
            = nativeGetNSImageRepresentationSizes(ptr,
                    size.getWidth(), size.getHeight());

    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(w, h, (width, height)
                    -> toImage(w, h, width, height))
            : new MultiResolutionCachedImage(w, h, sizes, (width, height)
                    -> toImage(w, h, width, height));
}
项目:OpenJSharp    文件:AquaUtils.java   
static Image generateLightenedImage(final Image image, final int percent) {
    final GrayFilter filter = new GrayFilter(true, percent);
    return (image instanceof MultiResolutionCachedImage)
            ? ((MultiResolutionCachedImage) image).map(
                    rv -> generateLightenedImage(rv, filter))
            : generateLightenedImage(image, filter);
}
项目:OpenJSharp    文件:AquaImageFactory.java   
static IconUIResource getAppIconCompositedOn(final Image background) {

        if (background instanceof MultiResolutionCachedImage) {
            int width = background.getWidth(null);
            Image mrIconImage = ((MultiResolutionCachedImage) 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));
    }
项目:jdk8u-jdk    文件:AquaUtils.java   
static Image generateLightenedImage(final Image image, final int percent) {
    final GrayFilter filter = new GrayFilter(true, percent);
    return (image instanceof MultiResolutionCachedImage)
            ? ((MultiResolutionCachedImage) image).map(
                    rv -> generateLightenedImage(rv, filter))
            : generateLightenedImage(image, filter);
}
项目:jdk8u-jdk    文件:AquaImageFactory.java   
static IconUIResource getAppIconCompositedOn(final Image background) {

        if (background instanceof MultiResolutionCachedImage) {
            int width = background.getWidth(null);
            Image mrIconImage = ((MultiResolutionCachedImage) 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));
    }
项目:openjdk-jdk10    文件:GrayFilter.java   
/**
 * Creates a disabled image
 *
 * @param i  an {@code Image} to be created as disabled
 * @return  the new grayscale image created from {@code i}
 */
public static Image createDisabledImage(Image i) {
    if (i instanceof MultiResolutionImage) {
        return MultiResolutionCachedImage
                .map((MultiResolutionImage) i,
                     (img) -> createDisabledImageImpl(img));
    }
    return createDisabledImageImpl(i);
}
项目:openjdk-jdk10    文件:CImage.java   
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) {
        return null;
    }

    AtomicReference<Dimension2D> sizeRef = new AtomicReference<>();
    execute(ptr -> {
        sizeRef.set(nativeGetNSImageSize(ptr));
    });
    final Dimension2D size = sizeRef.get();
    if (size == null) {
        return null;
    }
    final int w = (int)size.getWidth();
    final int h = (int)size.getHeight();
    AtomicReference<Dimension2D[]> repRef = new AtomicReference<>();
    execute(ptr -> {
        repRef.set(nativeGetNSImageRepresentationSizes(ptr, size.getWidth(),
                                                       size.getHeight()));
    });
    Dimension2D[] sizes = repRef.get();

    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(w, h, (width, height)
                    -> toImage(w, h, width, height))
            : new MultiResolutionCachedImage(w, h, sizes, (width, height)
                    -> toImage(w, h, width, height));
}
项目:openjdk-jdk10    文件:AquaUtils.java   
private static Image map(Image image, ImageFilter filter) {
    if (image instanceof MultiResolutionImage) {
        return MultiResolutionCachedImage
                .map((MultiResolutionImage) image,
                     (img) -> generateFilteredImage(img, filter));
    }
    return generateFilteredImage(image, filter);
}
项目:openjdk-jdk10    文件:AquaImageFactory.java   
static IconUIResource getAppIconCompositedOn(final Image background) {

        if (background instanceof MultiResolutionCachedImage) {
            int width = background.getWidth(null);
            Image mrIconImage = ((MultiResolutionCachedImage) 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));
    }
项目:openjdk9    文件:AquaUtils.java   
static Image generateLightenedImage(final Image image, final int percent) {
    final GrayFilter filter = new GrayFilter(true, percent);
    return (image instanceof MultiResolutionCachedImage)
            ? ((MultiResolutionCachedImage) image).map(
                    rv -> generateLightenedImage(rv, filter))
            : generateLightenedImage(image, filter);
}
项目:openjdk9    文件:AquaImageFactory.java   
static IconUIResource getAppIconCompositedOn(final Image background) {

        if (background instanceof MultiResolutionCachedImage) {
            int width = background.getWidth(null);
            Image mrIconImage = ((MultiResolutionCachedImage) 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));
    }
项目:jdk8u_jdk    文件:CImage.java   
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) return null;

    Dimension2D size = nativeGetNSImageSize(ptr);
    final int baseWidth = (int)size.getWidth();
    final int baseHeight = (int)size.getHeight();

    Dimension2D[] sizes = nativeGetNSImageRepresentationSizes(ptr, size.getWidth(), size.getHeight());

    // The image may be represented in the only size which differs from the base one.
    // For instance, the app's dock icon is represented in a Retina-scaled size on Retina.
    // Check if a single represenation has a bigger size and in that case use it as the dest size.
    if (sizes != null && sizes.length == 1 &&
        (sizes[0].getWidth() > baseWidth && sizes[0].getHeight() > baseHeight))
    {
        size = sizes[0];
    }
    final int dstWidth  = (int)size.getWidth();
    final int dstHeight = (int)size.getHeight();


    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(baseWidth, baseHeight, (width, height)
                    -> toImage(dstWidth, dstHeight))
            : new MultiResolutionCachedImage(baseWidth, baseHeight, sizes, (width, height)
                    -> toImage(width, height));
}
项目:jdk8u_jdk    文件:AquaUtils.java   
static Image generateLightenedImage(final Image image, final int percent) {
    final GrayFilter filter = new GrayFilter(true, percent);
    return (image instanceof MultiResolutionCachedImage)
            ? ((MultiResolutionCachedImage) image).map(
                    rv -> generateLightenedImage(rv, filter))
            : generateLightenedImage(image, filter);
}
项目:jdk8u_jdk    文件:AquaImageFactory.java   
static IconUIResource getAppIconCompositedOn(final Image background) {

        if (background instanceof MultiResolutionCachedImage) {
            int width = background.getWidth(null);
            Image mrIconImage = ((MultiResolutionCachedImage) 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));
    }
项目:lookaside_java-1.8.0-openjdk    文件:CImage.java   
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) {
        return null;
    }

    AtomicReference<Dimension2D> sizeRef = new AtomicReference<>();
    execute(ptr -> {
        sizeRef.set(nativeGetNSImageSize(ptr));
    });
    final Dimension2D size = sizeRef.get();
    if (size == null) {
        return null;
    }
    final int w = (int)size.getWidth();
    final int h = (int)size.getHeight();
    AtomicReference<Dimension2D[]> repRef = new AtomicReference<>();
    execute(ptr -> {
        repRef.set(nativeGetNSImageRepresentationSizes(ptr, size.getWidth(),
                                                       size.getHeight()));
    });
    Dimension2D[] sizes = repRef.get();

    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(w, h, (width, height)
                    -> toImage(w, h, width, height))
            : new MultiResolutionCachedImage(w, h, sizes, (width, height)
                    -> toImage(w, h, width, height));
}
项目:lookaside_java-1.8.0-openjdk    文件:AquaUtils.java   
static Image generateLightenedImage(final Image image, final int percent) {
    final GrayFilter filter = new GrayFilter(true, percent);
    return (image instanceof MultiResolutionCachedImage)
            ? ((MultiResolutionCachedImage) image).map(
                    rv -> generateLightenedImage(rv, filter))
            : generateLightenedImage(image, filter);
}
项目:lookaside_java-1.8.0-openjdk    文件:AquaImageFactory.java   
static IconUIResource getAppIconCompositedOn(final Image background) {

        if (background instanceof MultiResolutionCachedImage) {
            int width = background.getWidth(null);
            Image mrIconImage = ((MultiResolutionCachedImage) 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));
    }
项目:infobip-open-jdk-8    文件:AquaUtils.java   
static Image generateLightenedImage(final Image image, final int percent) {
    final GrayFilter filter = new GrayFilter(true, percent);
    return (image instanceof MultiResolutionCachedImage)
            ? ((MultiResolutionCachedImage) image).map(
                    rv -> generateLightenedImage(rv, filter))
            : generateLightenedImage(image, filter);
}
项目:infobip-open-jdk-8    文件:AquaImageFactory.java   
static IconUIResource getAppIconCompositedOn(final Image background) {

        if (background instanceof MultiResolutionCachedImage) {
            int width = background.getWidth(null);
            Image mrIconImage = ((MultiResolutionCachedImage) 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));
    }
项目:jdk8u-dev-jdk    文件:AquaUtils.java   
static Image generateLightenedImage(final Image image, final int percent) {
    final GrayFilter filter = new GrayFilter(true, percent);
    return (image instanceof MultiResolutionCachedImage)
            ? ((MultiResolutionCachedImage) image).map(
                    rv -> generateLightenedImage(rv, filter))
            : generateLightenedImage(image, filter);
}
项目:jdk8u-dev-jdk    文件:AquaImageFactory.java   
static IconUIResource getAppIconCompositedOn(final Image background) {

        if (background instanceof MultiResolutionCachedImage) {
            int width = background.getWidth(null);
            Image mrIconImage = ((MultiResolutionCachedImage) 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));
    }