类java.awt.image.BufferStrategy源码实例Demo

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

源代码1 项目: jdk8u-jdk   文件: VSyncedBSManager.java
/**
 * Lets the manager know that this buffer strategy is no longer interested
 * in being v-synced.
 */
public static synchronized void releaseVsync(BufferStrategy bs) {
    VSyncedBSManager bsm = getInstance(false);
    if (bsm != null) {
        bsm.relinquishVsync(bs);
    }
}
 
源代码2 项目: design_principles_dojo   文件: GameCanvas.java
public void draw() throws Exception {
    BufferStrategy strategy = getBufferStrategy();
    Graphics2D graphics = (Graphics2D) strategy.getDrawGraphics();
    graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    graphics.setColor(Color.white);
    graphics.fill(new Rectangle(dimension));

    currentScreen = currentScreen.getNextScreen();
    currentScreen.draw(graphics);

    graphics.dispose();
    strategy.show();
}
 
源代码3 项目: dragonwell8_jdk   文件: VSyncedBSManager.java
/**
 * Lets the manager know that this buffer strategy is no longer interested
 * in being v-synced.
 */
public static synchronized void releaseVsync(BufferStrategy bs) {
    VSyncedBSManager bsm = getInstance(false);
    if (bsm != null) {
        bsm.relinquishVsync(bs);
    }
}
 
源代码4 项目: openjdk-8-source   文件: VSyncedBSManager.java
@Override
public synchronized void relinquishVsync(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy b = strategy.get();
        if (b == bs) {
            strategy.clear();
            strategy = null;
        }
    }
}
 
源代码5 项目: dragonwell8_jdk   文件: VSyncedBSManager.java
@Override
public synchronized boolean checkAllowed(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy current = strategy.get();
        if (current != null) {
            return (current == bs);
        }
    }
    strategy = new WeakReference<BufferStrategy>(bs);
    return true;
}
 
public void render() {
    ImageCapabilities imgBackBufCap = new ImageCapabilities(true);
    ImageCapabilities imgFrontBufCap = new ImageCapabilities(true);
    BufferCapabilities bufCap =
        new BufferCapabilities(imgFrontBufCap,
            imgBackBufCap, BufferCapabilities.FlipContents.COPIED);
    try {

        createBufferStrategy(2, bufCap);
    } catch (AWTException ex) {
        createBufferStrategy(2);
    }

    BufferStrategy bs = getBufferStrategy();
    do {
        Graphics g =  bs.getDrawGraphics();
        g.setColor(Color.green);
        g.fillRect(0, 0, getWidth(), getHeight());

        g.setColor(Color.red);
        g.drawString("Rendering test", 20, 20);

        g.drawImage(bi, 50, 50, null);

        g.dispose();
        bs.show();
    } while (bs.contentsLost()||bs.contentsRestored());
}
 
public void render() {
    ImageCapabilities imgBackBufCap = new ImageCapabilities(true);
    ImageCapabilities imgFrontBufCap = new ImageCapabilities(true);
    BufferCapabilities bufCap =
        new BufferCapabilities(imgFrontBufCap,
            imgBackBufCap, BufferCapabilities.FlipContents.COPIED);
    try {

        createBufferStrategy(2, bufCap);
    } catch (AWTException ex) {
        createBufferStrategy(2);
    }

    BufferStrategy bs = getBufferStrategy();
    do {
        Graphics g =  bs.getDrawGraphics();
        g.setColor(Color.green);
        g.fillRect(0, 0, getWidth(), getHeight());

        g.setColor(Color.red);
        g.drawString("Rendering test", 20, 20);

        g.drawImage(bi, 50, 50, null);

        g.dispose();
        bs.show();
    } while (bs.contentsLost()||bs.contentsRestored());
}
 
源代码8 项目: openjdk-8   文件: VSyncedBSManager.java
/**
 * Lets the manager know that this buffer strategy is no longer interested
 * in being v-synced.
 */
public static synchronized void releaseVsync(BufferStrategy bs) {
    VSyncedBSManager bsm = getInstance(false);
    if (bsm != null) {
        bsm.relinquishVsync(bs);
    }
}
 
源代码9 项目: TencentKona-8   文件: VSyncedBSManager.java
/**
 * Lets the manager know that this buffer strategy is no longer interested
 * in being v-synced.
 */
public static synchronized void releaseVsync(BufferStrategy bs) {
    VSyncedBSManager bsm = getInstance(false);
    if (bsm != null) {
        bsm.relinquishVsync(bs);
    }
}
 
源代码10 项目: TencentKona-8   文件: VSyncedBSManager.java
@Override
public synchronized boolean checkAllowed(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy current = strategy.get();
        if (current != null) {
            return (current == bs);
        }
    }
    strategy = new WeakReference<BufferStrategy>(bs);
    return true;
}
 
源代码11 项目: openjdk-jdk9   文件: BufferStrategyExceptionTest.java
public void render() {
    ImageCapabilities imgBackBufCap = new ImageCapabilities(true);
    ImageCapabilities imgFrontBufCap = new ImageCapabilities(true);
    BufferCapabilities bufCap =
        new BufferCapabilities(imgFrontBufCap,
            imgBackBufCap, BufferCapabilities.FlipContents.COPIED);
    try {

        createBufferStrategy(2, bufCap);
    } catch (AWTException ex) {
        createBufferStrategy(2);
    }

    BufferStrategy bs = getBufferStrategy();
    do {
        Graphics g =  bs.getDrawGraphics();
        g.setColor(Color.green);
        g.fillRect(0, 0, getWidth(), getHeight());

        g.setColor(Color.red);
        g.drawString("Rendering test", 20, 20);

        g.drawImage(bi, 50, 50, null);

        g.dispose();
        bs.show();
    } while (bs.contentsLost()||bs.contentsRestored());
}
 
源代码12 项目: jdk8u_jdk   文件: VSyncedBSManager.java
/**
 * Lets the manager know that this buffer strategy is no longer interested
 * in being v-synced.
 */
public static synchronized void releaseVsync(BufferStrategy bs) {
    VSyncedBSManager bsm = getInstance(false);
    if (bsm != null) {
        bsm.relinquishVsync(bs);
    }
}
 
源代码13 项目: jdk8u60   文件: VSyncedBSManager.java
/**
 * Lets the manager know that this buffer strategy is no longer interested
 * in being v-synced.
 */
public static synchronized void releaseVsync(BufferStrategy bs) {
    VSyncedBSManager bsm = getInstance(false);
    if (bsm != null) {
        bsm.relinquishVsync(bs);
    }
}
 
源代码14 项目: hottub   文件: VSyncedBSManager.java
@Override
public synchronized boolean checkAllowed(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy current = strategy.get();
        if (current != null) {
            return (current == bs);
        }
    }
    strategy = new WeakReference<BufferStrategy>(bs);
    return true;
}
 
源代码15 项目: jdk8u_jdk   文件: VSyncedBSManager.java
@Override
public synchronized boolean checkAllowed(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy current = strategy.get();
        if (current != null) {
            return (current == bs);
        }
    }
    strategy = new WeakReference<BufferStrategy>(bs);
    return true;
}
 
源代码16 项目: hottub   文件: BufferStrategyExceptionTest.java
public void render() {
    ImageCapabilities imgBackBufCap = new ImageCapabilities(true);
    ImageCapabilities imgFrontBufCap = new ImageCapabilities(true);
    BufferCapabilities bufCap =
        new BufferCapabilities(imgFrontBufCap,
            imgBackBufCap, BufferCapabilities.FlipContents.COPIED);
    try {

        createBufferStrategy(2, bufCap);
    } catch (AWTException ex) {
        createBufferStrategy(2);
    }

    BufferStrategy bs = getBufferStrategy();
    do {
        Graphics g =  bs.getDrawGraphics();
        g.setColor(Color.green);
        g.fillRect(0, 0, getWidth(), getHeight());

        g.setColor(Color.red);
        g.drawString("Rendering test", 20, 20);

        g.drawImage(bi, 50, 50, null);

        g.dispose();
        bs.show();
    } while (bs.contentsLost()||bs.contentsRestored());
}
 
源代码17 项目: openjdk-jdk8u   文件: VSyncedBSManager.java
/**
 * Lets the manager know that this buffer strategy is no longer interested
 * in being v-synced.
 */
public static synchronized void releaseVsync(BufferStrategy bs) {
    VSyncedBSManager bsm = getInstance(false);
    if (bsm != null) {
        bsm.relinquishVsync(bs);
    }
}
 
源代码18 项目: openjdk-jdk8u   文件: VSyncedBSManager.java
@Override
public synchronized boolean checkAllowed(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy current = strategy.get();
        if (current != null) {
            return (current == bs);
        }
    }
    strategy = new WeakReference<BufferStrategy>(bs);
    return true;
}
 
源代码19 项目: jdk8u-jdk   文件: BufferStrategyExceptionTest.java
public void render() {
    ImageCapabilities imgBackBufCap = new ImageCapabilities(true);
    ImageCapabilities imgFrontBufCap = new ImageCapabilities(true);
    BufferCapabilities bufCap =
        new BufferCapabilities(imgFrontBufCap,
            imgBackBufCap, BufferCapabilities.FlipContents.COPIED);
    try {

        createBufferStrategy(2, bufCap);
    } catch (AWTException ex) {
        createBufferStrategy(2);
    }

    BufferStrategy bs = getBufferStrategy();
    do {
        Graphics g =  bs.getDrawGraphics();
        g.setColor(Color.green);
        g.fillRect(0, 0, getWidth(), getHeight());

        g.setColor(Color.red);
        g.drawString("Rendering test", 20, 20);

        g.drawImage(bi, 50, 50, null);

        g.dispose();
        bs.show();
    } while (bs.contentsLost()||bs.contentsRestored());
}
 
源代码20 项目: openjdk-8   文件: VSyncedBSManager.java
@Override
public synchronized boolean checkAllowed(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy current = strategy.get();
        if (current != null) {
            return (current == bs);
        }
    }
    strategy = new WeakReference<BufferStrategy>(bs);
    return true;
}
 
源代码21 项目: yt-java-game   文件: GamePanel.java
public GamePanel(BufferStrategy bs, int width, int height) {
    GamePanel.width = width;
    GamePanel.height = height;
    this.bs = bs;
    setPreferredSize(new Dimension(width, height));
    setFocusable(true);
    requestFocus();
}
 
源代码22 项目: jdk8u-dev-jdk   文件: VSyncedBSManager.java
@Override
public synchronized void relinquishVsync(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy b = strategy.get();
        if (b == bs) {
            strategy.clear();
            strategy = null;
        }
    }
}
 
源代码23 项目: hottub   文件: VSyncedBSManager.java
@Override
public synchronized void relinquishVsync(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy b = strategy.get();
        if (b == bs) {
            strategy.clear();
            strategy = null;
        }
    }
}
 
源代码24 项目: openjdk-jdk8u-backup   文件: VSyncedBSManager.java
@Override
public synchronized boolean checkAllowed(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy current = strategy.get();
        if (current != null) {
            return (current == bs);
        }
    }
    strategy = new WeakReference<BufferStrategy>(bs);
    return true;
}
 
源代码25 项目: openjdk-jdk8u-backup   文件: VSyncedBSManager.java
@Override
public synchronized void relinquishVsync(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy b = strategy.get();
        if (b == bs) {
            strategy.clear();
            strategy = null;
        }
    }
}
 
源代码26 项目: openjdk-8   文件: BufferStrategyExceptionTest.java
public void render() {
    ImageCapabilities imgBackBufCap = new ImageCapabilities(true);
    ImageCapabilities imgFrontBufCap = new ImageCapabilities(true);
    BufferCapabilities bufCap =
        new BufferCapabilities(imgFrontBufCap,
            imgBackBufCap, BufferCapabilities.FlipContents.COPIED);
    try {

        createBufferStrategy(2, bufCap);
    } catch (AWTException ex) {
        createBufferStrategy(2);
    }

    BufferStrategy bs = getBufferStrategy();
    do {
        Graphics g =  bs.getDrawGraphics();
        g.setColor(Color.green);
        g.fillRect(0, 0, getWidth(), getHeight());

        g.setColor(Color.red);
        g.drawString("Rendering test", 20, 20);

        g.drawImage(bi, 50, 50, null);

        g.dispose();
        bs.show();
    } while (bs.contentsLost()||bs.contentsRestored());
}
 
源代码27 项目: openjdk-8-source   文件: VSyncedBSManager.java
/**
 * Lets the manager know that this buffer strategy is no longer interested
 * in being v-synced.
 */
public static synchronized void releaseVsync(BufferStrategy bs) {
    VSyncedBSManager bsm = getInstance(false);
    if (bsm != null) {
        bsm.relinquishVsync(bs);
    }
}
 
源代码28 项目: openjdk-8-source   文件: VSyncedBSManager.java
@Override
public synchronized boolean checkAllowed(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy current = strategy.get();
        if (current != null) {
            return (current == bs);
        }
    }
    strategy = new WeakReference<BufferStrategy>(bs);
    return true;
}
 
源代码29 项目: jdk8u_jdk   文件: VSyncedBSManager.java
@Override
public synchronized void relinquishVsync(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy b = strategy.get();
        if (b == bs) {
            strategy.clear();
            strategy = null;
        }
    }
}
 
源代码30 项目: Bytecoder   文件: VSyncedBSManager.java
@Override
public synchronized void relinquishVsync(BufferStrategy bs) {
    if (strategy != null) {
        BufferStrategy b = strategy.get();
        if (b == bs) {
            strategy.clear();
            strategy = null;
        }
    }
}
 
 类所在包
 同包方法