BufferCapabilities.java: Document.

2005-05-04  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/BufferCapabilities.java: Document.

From-SVN: r99234
This commit is contained in:
Thomas Fitzsimmons 2005-05-04 22:13:45 +00:00 committed by Thomas Fitzsimmons
parent e33e218bad
commit 29572b4dae
2 changed files with 140 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2005-05-04 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/awt/BufferCapabilities.java: Document.
2005-05-04 Tom Tromey <tromey@redhat.com> 2005-05-04 Tom Tromey <tromey@redhat.com>
* java/nio/channels/FileLock.java (toString): Entirely avoid * java/nio/channels/FileLock.java (toString): Entirely avoid

View File

@ -1,4 +1,4 @@
/* BufferCapabilities.java -- /* BufferCapabilities.java -- double-buffering capabilities descriptor
Copyright (C) 2002, 2005 Free Software Foundation, Inc. Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
@ -39,79 +39,204 @@ exception statement from your version. */
package java.awt; package java.awt;
/** /**
* Needs documentation... * A double-buffering capability descriptor. This class exposes
* details about the double-buffering algorithms used by image
* buffers.
*
* BufferCapabilities represents algorithms that involve at least two
* buffers but it can also specify so-called "multi-buffer" schemes
* involving more than two buffers. This class describes the
* capabilities of the front and back buffers as well as the results
* of "flipping" -- that is, what happens when an image is transferred
* from the back buffer to the front buffer.
*
* Flipping may or may not be supported or may be supported only in
* fullscreen mode. If it is not supported then "blitting" is implied
* -- that is, the contents of the back buffer are copied using a fast
* block transfer operation from the back buffer to the front buffer.
*
* The front buffer is the one that is displayed.
* *
* @author Eric Blake (ebb9@email.byu.edu) * @author Eric Blake (ebb9@email.byu.edu)
*
* @see BufferStrategy#getCapabilities() * @see BufferStrategy#getCapabilities()
* @see GraphicsConfiguration#getCapabilities() * @see GraphicsConfiguration#getCapabilities()
*
* @since 1.4 * @since 1.4
* @status updated to 1.4, lacks documentation
*/ */
public class BufferCapabilities implements Cloneable public class BufferCapabilities implements Cloneable
{ {
/**
* A type-safe enumeration of buffer flipping results.
*
* @see AttributeValue
*/
public static final class FlipContents extends AttributeValue public static final class FlipContents extends AttributeValue
{ {
/**
* The names of the different flipping results.
*/
private static final String[] NAMES private static final String[] NAMES
= { "undefined", "background", "prior", "copied" }; = { "undefined", "background", "prior", "copied" };
/**
* The contents of the back buffer are undefined after flipping.
*/
public static final FlipContents UNDEFINED = new FlipContents(0); public static final FlipContents UNDEFINED = new FlipContents(0);
/**
* The back buffer is cleared with the background color after
* flipping.
*/
public static final FlipContents BACKGROUND = new FlipContents(1); public static final FlipContents BACKGROUND = new FlipContents(1);
/**
* The back buffer contains the pre-flipping contents of the front
* buffer after flipping. In other words a true "flip" has been
* performed.
*/
public static final FlipContents PRIOR = new FlipContents(2); public static final FlipContents PRIOR = new FlipContents(2);
/**
* The back buffer has the same contents as the front buffer after
* flipping.
*/
public static final FlipContents COPIED = new FlipContents(3); public static final FlipContents COPIED = new FlipContents(3);
/**
* Create a new flipping result descriptor.
*
* @param value the enumeration value
*/
private FlipContents(int value) private FlipContents(int value)
{ {
super(value, NAMES); super(value, NAMES);
} }
} // class FlipContents }
/**
* Front buffer capabilities descriptor.
*/
private final ImageCapabilities front; private final ImageCapabilities front;
/**
* Back buffer capabilities descriptor.
*/
private final ImageCapabilities back; private final ImageCapabilities back;
/**
* Describes the results of a "flip" operation.
*/
private final FlipContents flip; private final FlipContents flip;
/** /**
* Creates a buffer capabilities object. * Creates a buffer capabilities object.
* *
* @exception IllegalArgumentException If frontCaps or backCaps are null. * @param frontCaps front buffer capabilities descriptor
* @param backCaps back buffer capabilities descriptor
* @param flipContents the results of a flip operation or null if
* flipping is not supported
*
* @exception IllegalArgumentException if frontCaps or backCaps is
* null
*/ */
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back, public BufferCapabilities(ImageCapabilities frontCaps,
FlipContents flip) ImageCapabilities backCaps,
FlipContents flipContents)
{ {
if (front == null || back == null)
throw new IllegalArgumentException();
this.front = front; this.front = front;
this.back = back; this.back = back;
this.flip = flip; this.flip = flip;
if (front == null || back == null)
throw new IllegalArgumentException();
} }
/**
* Retrieve the front buffer's image capabilities.
*
* @return the front buffer's image capabilities
*/
public ImageCapabilities getFrontBufferCapabilities() public ImageCapabilities getFrontBufferCapabilities()
{ {
return front; return front;
} }
/**
* Retrieve the back buffer's image capabilities.
*
* @return the back buffer's image capabilities
*/
public ImageCapabilities getBackBufferCapabilities() public ImageCapabilities getBackBufferCapabilities()
{ {
return back; return back;
} }
/**
* Return whether or not flipping is supported.
*
* @return true if flipping is supported, false otherwise
*/
public boolean isPageFlipping() public boolean isPageFlipping()
{ {
return flip != null; return flip != null;
} }
/**
* Retrieve the result of a flipping operation. If this method
* returns null then flipping is not supported. This implies that
* "blitting", a fast block transfer, is used to copy the contents
* of the back buffer to the front buffer. Other possible return
* values are:
* <ul>
* <li><code>FlipContents.UNDEFINED</code> the contents of the
* back buffer are undefined after flipping.</li>
* <li><code>FlipContents.BACKGROUND</code> the contents of the
* back buffer are cleared to the background color after
* flipping.</li>
* <li><code>FlipContents.PRIOR</code> the back buffer contains
* the pre-flipping contents of the front * buffer after
* flipping.</li>
* <li><code>FlipContents.COPIED</code> the back buffer has the
* same contents as the front buffer after flipping.</li>
* </ul>
*
* @return the result of a flipping operation or null if flipping is
* not supported
*/
public FlipContents getFlipContents() public FlipContents getFlipContents()
{ {
return flip; return flip;
} }
/**
* Returns true if flipping is only supported in fullscreen mode.
*
* @return true if flipping is only supported in fullscreen mode,
* false otherwise
*/
public boolean isFullScreenRequired() public boolean isFullScreenRequired()
{ {
return true; return true;
} }
/**
* Returns true if flipping can involve more than two buffers. One
* or more intermediate buffers may be available in addition to the
* front and back buffers.
*
* @return true if there are more than two buffers available for
* flipping, false otherwise
*/
public boolean isMultiBufferAvailable() public boolean isMultiBufferAvailable()
{ {
return false; return false;
} }
/**
* Clone this buffering capability descriptor.
*
* @return a clone of this buffer capability descriptor
*/
public Object clone() public Object clone()
{ {
try try
@ -120,7 +245,7 @@ public class BufferCapabilities implements Cloneable
} }
catch (CloneNotSupportedException e) catch (CloneNotSupportedException e)
{ {
throw (Error) new InternalError().initCause(e); // Impossible throw (Error) new InternalError().initCause(e);
} }
} }
} // class BufferCapabilities }