/*
* @(#)BufferCapabilities.java 1.10 06/04/07
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package java.awt;
/**
* Capabilities and properties of buffers.
*
* @see java.awt.image.BufferStrategy#getCapabilities()
* @see GraphicsConfiguration#getBufferCapabilities
* @author Michael Martak
* @since 1.4
*/
public class BufferCapabilities implements Cloneable {
private ImageCapabilities frontCaps;
private ImageCapabilities backCaps;
private FlipContents flipContents;
/**
* Creates a new object for specifying buffering capabilities
* @param frontCaps the capabilities of the front buffer; cannot be
* <code>null</code>
* @param backCaps the capabilities of the back and intermediate buffers;
* cannot be <code>null</code>
* @param flipContents the contents of the back buffer after page-flipping,
* <code>null</code> if page flipping is not used (implies blitting)
* @exception IllegalArgumentException if frontCaps or backCaps are
* <code>null</code>
*/
public BufferCapabilities(ImageCapabilities frontCaps,
ImageCapabilities backCaps, FlipContents flipContents) {
if (frontCaps == null || backCaps == null) {
throw new IllegalArgumentException(
"Image capabilities specified cannot be null");
}
this.frontCaps = frontCaps;
this.backCaps = backCaps;
this.flipContents = flipContents;
}
/**
* @return the image capabilities of the front (displayed) buffer
*/
public ImageCapabilities getFrontBufferCapabilities() {
return frontCaps;
}
/**
* @return the image capabilities of all back buffers (intermediate buffers
* are considered back buffers)
*/
public ImageCapabilities getBackBufferCapabilities() {
return backCaps;
}
/**
* @return whether or not the buffer strategy uses page flipping; a set of
* buffers that uses page flipping
* can swap the contents internally between the front buffer and one or
* more back buffers by switching the video pointer (or by copying memory
* internally). A non-flipping set of
* buffers uses blitting to copy the contents from one buffer to
* another; when this is the case, <code>getFlipContents</code> returns
* <code>null</code>
*/
public boolean isPageFlipping() {
return (getFlipContents() != null);
}
/**
* @return the resulting contents of the back buffer after page-flipping.
* This value is <code>null</code> when the <code>isPageFlipping</code>
* returns <code>false</code>, implying blitting. It can be one of
* <code>FlipContents.UNDEFINED</code>
* (the assumed default), <code>FlipContents.BACKGROUND</code>,
* <code>FlipContents.PRIOR</code>, or
* <code>FlipContents.COPIED</code>.
* @see #isPageFlipping
* @see FlipContents#UNDEFINED
* @see FlipContents#BACKGROUND
* @see FlipContents#PRIOR
* @see FlipContents#COPIED
*/
public FlipContents getFlipContents() {
return flipContents;
}
/**
* @return whether page flipping is only available in full-screen mode. If this
* is <code>true</code>, full-screen exclusive mode is required for
* page-flipping.
* @see #isPageFlipping
* @see GraphicsDevice#setFullScreenWindow
*/
public boolean isFullScreenRequired() {
=1= |