1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
116 * // Display the buffer
117 * strategy.show();
118 *
119 * // Repeat the rendering if the drawing buffer was lost
120 * } while (strategy.contentsLost());
121 * }
122 *
123 * // Dispose the window
124 * w.setVisible(false);
125 * w.dispose();
126 * </code></pre>
127 *
128 * @see java.awt.Window
129 * @see java.awt.Canvas
130 * @see java.awt.GraphicsConfiguration
131 * @see VolatileImage
132 * @author Michael Martak
133 * @since 1.4
134 */
135 public abstract class BufferStrategy {
136
137 /**
138 * Returns the {@code BufferCapabilities} for this
139 * {@code BufferStrategy}.
140 *
141 * @return the buffering capabilities of this strategy
142 */
143 public abstract BufferCapabilities getCapabilities();
144
145 /**
146 * Creates a graphics context for the drawing buffer. This method may not
147 * be synchronized for performance reasons; use of this method by multiple
148 * threads should be handled at the application level. Disposal of the
149 * graphics object obtained must be handled by the application.
150 *
151 * @return a graphics context for the drawing buffer
152 */
153 public abstract Graphics getDrawGraphics();
154
155 /**
|
1 /*
2 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
116 * // Display the buffer
117 * strategy.show();
118 *
119 * // Repeat the rendering if the drawing buffer was lost
120 * } while (strategy.contentsLost());
121 * }
122 *
123 * // Dispose the window
124 * w.setVisible(false);
125 * w.dispose();
126 * </code></pre>
127 *
128 * @see java.awt.Window
129 * @see java.awt.Canvas
130 * @see java.awt.GraphicsConfiguration
131 * @see VolatileImage
132 * @author Michael Martak
133 * @since 1.4
134 */
135 public abstract class BufferStrategy {
136
137 /**
138 * Constructor for subclasses to call.
139 */
140 public BufferStrategy() {}
141
142 /**
143 * Returns the {@code BufferCapabilities} for this
144 * {@code BufferStrategy}.
145 *
146 * @return the buffering capabilities of this strategy
147 */
148 public abstract BufferCapabilities getCapabilities();
149
150 /**
151 * Creates a graphics context for the drawing buffer. This method may not
152 * be synchronized for performance reasons; use of this method by multiple
153 * threads should be handled at the application level. Disposal of the
154 * graphics object obtained must be handled by the application.
155 *
156 * @return a graphics context for the drawing buffer
157 */
158 public abstract Graphics getDrawGraphics();
159
160 /**
|