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

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

源代码1 项目: dragonwell8_jdk   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码2 项目: TencentKona-8   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码3 项目: jdk8u60   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码4 项目: openjdk-jdk8u   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码6 项目: openjdk-jdk9   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码7 项目: jdk8u-jdk   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码8 项目: hottub   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码9 项目: jdk8u_jdk   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码10 项目: jdk8u-jdk   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
源代码11 项目: jdk8u-dev-jdk   文件: AquaPainter.java
/**
 * Paints a native control, which identified by its size and a set of
 * additional arguments using a cached image.
 *
 * @param  g Graphics to draw the control
 * @param  control the reference to the native control
 * @param  controlState the state of the native control
 * @param  bounds the rectangle where the native part should be drawn.
 *         Note: the focus can/will be drawn outside of this bounds.
 */
static void paintFromSingleCachedImage(final Graphics2D g,
                                       final JRSUIControl control,
                                       final JRSUIState controlState,
                                       final Rectangle bounds) {
    if (bounds.width <= 0 || bounds.height <= 0) {
        return;
    }

    int focus = 0;
    if (controlState.is(JRSUIConstants.Focused.YES)) {
        focus = JRSUIConstants.FOCUS_SIZE;
    }

    final int imgX = bounds.x - focus;
    final int imgY = bounds.y - focus;
    final int imgW = bounds.width + (focus << 1);
    final int imgH = bounds.height + (focus << 1);
    final GraphicsConfiguration config = g.getDeviceConfiguration();
    final ImageCache cache = ImageCache.getInstance();
    final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
                                                bounds, controlState);
    Image img = cache.getImage(key);
    if (img == null) {
        img = new MultiResolutionCachedImage(imgW, imgH,
                (rvWidth, rvHeight) -> createImage(imgX, imgY,
                 rvWidth, rvHeight, bounds, control, controlState));

        if (!controlState.is(JRSUIConstants.Animating.YES)) {
            cache.setImage(key, img);
        }
    }

    g.drawImage(img, imgX, imgY, imgW, imgH, null);
}
 
 类所在包
 类方法
 同包方法