當前位置: 首頁>>代碼示例>>Java>>正文


Java GraphicsConfiguration.getDefaultTransform方法代碼示例

本文整理匯總了Java中java.awt.GraphicsConfiguration.getDefaultTransform方法的典型用法代碼示例。如果您正苦於以下問題:Java GraphicsConfiguration.getDefaultTransform方法的具體用法?Java GraphicsConfiguration.getDefaultTransform怎麽用?Java GraphicsConfiguration.getDefaultTransform使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.GraphicsConfiguration的用法示例。


在下文中一共展示了GraphicsConfiguration.getDefaultTransform方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBackupSurface

import java.awt.GraphicsConfiguration; //導入方法依賴的package包/類
/**
 * Creates a software-based surface (of type BufImgSurfaceData).
 * The software representation is only created when needed, which
 * is only during some situation in which the hardware surface
 * cannot be allocated.  This allows apps to at least run,
 * albeit more slowly than they would otherwise.
 */
protected SurfaceData getBackupSurface() {
    if (sdBackup == null) {
        GraphicsConfiguration gc = vImg.getGraphicsConfig();
        AffineTransform tx = gc.getDefaultTransform();
        double scaleX = tx.getScaleX();
        double scaleY = tx.getScaleY();
        BufferedImage bImg = vImg.getBackupImage(scaleX, scaleY);
        // Sabotage the acceleration capabilities of the BufImg surface
        SunWritableRaster.stealTrackable(bImg
                                         .getRaster()
                                         .getDataBuffer()).setUntrackable();
        sdBackup = BufImgSurfaceData.createData(bImg, scaleX, scaleY);
    }
    return sdBackup;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:VolatileSurfaceManager.java

示例2: initScreenBounds

import java.awt.GraphicsConfiguration; //導入方法依賴的package包/類
static void initScreenBounds() {

        GraphicsDevice[] devices = GraphicsEnvironment
                .getLocalGraphicsEnvironment()
                .getScreenDevices();

        screenBounds = new Rectangle[devices.length];
        scales = new double[devices.length][2];
        for (int i = 0; i < devices.length; i++) {
            GraphicsConfiguration gc = devices[i].getDefaultConfiguration();
            screenBounds[i] = gc.getBounds();
            AffineTransform tx = gc.getDefaultTransform();
            scales[i][0] = tx.getScaleX();
            scales[i][1] = tx.getScaleY();
        }

        maxBounds = screenBounds[0];
        for (int i = 0; i < screenBounds.length; i++) {
            maxBounds = maxBounds.union(screenBounds[i]);
        }
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:RobotMultiDPIScreenTest.java

示例3: initScreenBounds

import java.awt.GraphicsConfiguration; //導入方法依賴的package包/類
static void initScreenBounds() {

        GraphicsDevice[] devices = GraphicsEnvironment
                .getLocalGraphicsEnvironment()
                .getScreenDevices();

        screenBounds = new Rectangle[devices.length];
        scales = new double[devices.length][2];
        for (int i = 0; i < devices.length; i++) {
            GraphicsConfiguration gc = devices[i].getDefaultConfiguration();
            screenBounds[i] = gc.getBounds();
            AffineTransform tx = gc.getDefaultTransform();
            scales[i][0] = tx.getScaleX();
            scales[i][1] = tx.getScaleY();
        }

        for (int i = 0; i < devices.length; i++) {
            for (int j = i + 1; j < devices.length; j++) {
                if (scales[i][0] != scales[j][0] || scales[i][1] != scales[j][1]) {
                    screen1 = i;
                    screen2 = j;
                }
            }
        }
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:WindowResizingOnSetLocationTest.java

示例4: testScaleFactor

import java.awt.GraphicsConfiguration; //導入方法依賴的package包/類
private static void testScaleFactor(final GraphicsConfiguration gc) {
    final Dialog dialog = new Dialog((Frame) null, "Test", true, gc);

    try {
        dialog.setSize(100, 100);
        Panel panel = new Panel() {

            @Override
            public void paint(Graphics g) {
                if (g instanceof Graphics2D) {
                    AffineTransform gcTx = gc.getDefaultTransform();
                    AffineTransform gTx
                            = ((Graphics2D) g).getTransform();
                    passed = gcTx.getScaleX() == gTx.getScaleX()
                            && gcTx.getScaleY() == gTx.getScaleY();
                } else {
                    passed = true;
                }
                dialog.setVisible(false);
            }
        };
        dialog.add(panel);
        dialog.setVisible(true);

        if (!passed) {
            throw new RuntimeException("Transform is not scaled!");
        }
    } finally {
        dialog.dispose();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:32,代碼來源:ScaledTransform.java

示例5: getDefaultTransform

import java.awt.GraphicsConfiguration; //導入方法依賴的package包/類
private AffineTransform getDefaultTransform() {
    GraphicsConfiguration gc = getDeviceConfiguration();
    return (gc == null) ? new AffineTransform() : gc.getDefaultTransform();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:SunGraphics2D.java


注:本文中的java.awt.GraphicsConfiguration.getDefaultTransform方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。