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

下面列出了怎么用sun.awt.image.MultiResolutionCachedImage的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk8u60   文件: 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));
}
 
源代码2 项目: 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));
}
 
源代码3 项目: hottub   文件: 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));
}
 
源代码4 项目: 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));
}
 
源代码5 项目: 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));
}
 
源代码6 项目: dragonwell8_jdk   文件: 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));
}
 
源代码7 项目: dragonwell8_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);
}
 
源代码8 项目: dragonwell8_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));
    }
 
源代码9 项目: TencentKona-8   文件: 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));
}
 
源代码10 项目: TencentKona-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);
}
 
源代码11 项目: TencentKona-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));
    }
 
源代码12 项目: jdk8u60   文件: 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);
}
 
源代码13 项目: jdk8u60   文件: 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));
    }
 
源代码14 项目: openjdk-jdk8u   文件: 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));
}
 
源代码15 项目: openjdk-jdk8u   文件: 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);
}
 
源代码16 项目: openjdk-jdk8u   文件: 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));
    }
 
源代码17 项目: openjdk-jdk8u-backup   文件: 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));
}
 
源代码18 项目: openjdk-jdk8u-backup   文件: 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);
}
 
源代码19 项目: openjdk-jdk8u-backup   文件: 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));
    }
 
源代码20 项目: Bytecoder   文件: 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);
}
 
源代码21 项目: openjdk-jdk9   文件: 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);
}
 
源代码22 项目: openjdk-jdk9   文件: 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));
}
 
源代码23 项目: openjdk-jdk9   文件: 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);
}
 
源代码24 项目: openjdk-jdk9   文件: 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));
    }
 
源代码25 项目: 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);
}
 
源代码26 项目: 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));
    }
 
源代码27 项目: hottub   文件: 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);
}
 
源代码28 项目: hottub   文件: 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));
    }
 
源代码29 项目: 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));
}
 
源代码30 项目: 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);
}
 
 类所在包
 类方法
 同包方法