当前位置: 首页>>代码示例>>Java>>正文


Java SurfaceManager.getImageScale方法代码示例

本文整理汇总了Java中sun.awt.image.SurfaceManager.getImageScale方法的典型用法代码示例。如果您正苦于以下问题:Java SurfaceManager.getImageScale方法的具体用法?Java SurfaceManager.getImageScale怎么用?Java SurfaceManager.getImageScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.awt.image.SurfaceManager的用法示例。


在下文中一共展示了SurfaceManager.getImageScale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawHiDPIImage

import sun.awt.image.SurfaceManager; //导入方法依赖的package包/类
private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2,
                               int dy2, int sx1, int sy1, int sx2, int sy2,
                               Color bgcolor, ImageObserver observer) {
    final int scale = SurfaceManager.getImageScale(img);
    sx1 = Region.clipScale(sx1, scale);
    sx2 = Region.clipScale(sx2, scale);
    sy1 = Region.clipScale(sy1, scale);
    sy2 = Region.clipScale(sy2, scale);
    try {
        return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1,
                                    sx2, sy2, bgcolor, observer);
    } catch (InvalidPipeException e) {
        try {
            revalidateAll();
            return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1,
                                        sy1, sx2, sy2, bgcolor, observer);
        } catch (InvalidPipeException e2) {
            // Still catching the exception; we are not yet ready to
            // validate the surfaceData correctly.  Fail for now and
            // try again next time around.
            return false;
        }
    } finally {
        surfaceData.markDirty();
    }
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:27,代码来源:SunGraphics2D.java

示例2: isHiDPIImage

import sun.awt.image.SurfaceManager; //导入方法依赖的package包/类
private boolean isHiDPIImage(final Image img) {
    return (SurfaceManager.getImageScale(img) != 1) ||
           (resolutionVariantHint != SunHints.INTVAL_RESOLUTION_VARIANT_OFF
                && img instanceof MultiResolutionImage);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:SunGraphics2D.java

示例3: drawHiDPIImage

import sun.awt.image.SurfaceManager; //导入方法依赖的package包/类
private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2,
                               int dy2, int sx1, int sy1, int sx2, int sy2,
                               Color bgcolor, ImageObserver observer) {

    if (SurfaceManager.getImageScale(img) != 1) {  // Volatile Image
        final int scale = SurfaceManager.getImageScale(img);
        sx1 = Region.clipScale(sx1, scale);
        sx2 = Region.clipScale(sx2, scale);
        sy1 = Region.clipScale(sy1, scale);
        sy2 = Region.clipScale(sy2, scale);
    } else if (img instanceof MultiResolutionImage) {
        // get scaled destination image size

        int width = img.getWidth(observer);
        int height = img.getHeight(observer);

        Image resolutionVariant = getResolutionVariant(
                (MultiResolutionImage) img, width, height,
                dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2);

        if (resolutionVariant != img && resolutionVariant != null) {
            // recalculate source region for the resolution variant

            ImageObserver rvObserver = MultiResolutionToolkitImage.
                    getResolutionVariantObserver(img, observer,
                            width, height, -1, -1);

            int rvWidth = resolutionVariant.getWidth(rvObserver);
            int rvHeight = resolutionVariant.getHeight(rvObserver);

            if (0 < width && 0 < height && 0 < rvWidth && 0 < rvHeight) {

                float widthScale = ((float) rvWidth) / width;
                float heightScale = ((float) rvHeight) / height;

                sx1 = Region.clipScale(sx1, widthScale);
                sy1 = Region.clipScale(sy1, heightScale);
                sx2 = Region.clipScale(sx2, widthScale);
                sy2 = Region.clipScale(sy2, heightScale);

                observer = rvObserver;
                img = resolutionVariant;
            }
        }
    }

    try {
        return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1,
                                    sx2, sy2, bgcolor, observer);
    } catch (InvalidPipeException e) {
        try {
            revalidateAll();
            return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1,
                                        sy1, sx2, sy2, bgcolor, observer);
        } catch (InvalidPipeException e2) {
            // Still catching the exception; we are not yet ready to
            // validate the surfaceData correctly.  Fail for now and
            // try again next time around.
            return false;
        }
    } finally {
        surfaceData.markDirty();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:65,代码来源:SunGraphics2D.java

示例4: isHiDPIImage

import sun.awt.image.SurfaceManager; //导入方法依赖的package包/类
private static boolean isHiDPIImage(final Image img) {
    return SurfaceManager.getImageScale(img) != 1;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:4,代码来源:SunGraphics2D.java


注:本文中的sun.awt.image.SurfaceManager.getImageScale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。