OffscreenCanvasExample.java 文件源码

java
阅读 32 收藏 0 点赞 0 评论 0

项目:piccolo2d.java 作者:
/**
 * Render offscreen graphics into the frame.
 */
private void render() {
    final BufferStrategy bufferStrategy = frame.getBufferStrategy();
    do {
        do {
            final Graphics2D graphics = (Graphics2D) bufferStrategy.getDrawGraphics();
            // canvas is not opaque, so fill with background color
            graphics.setPaint(background);
            graphics.fillRect(0, 0, 400, 400);
            // then let canvas render into graphics
            canvas.render(graphics);
            graphics.dispose();
        } while (bufferStrategy.contentsRestored());
        bufferStrategy.show();
    } while (bufferStrategy.contentsLost());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号