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
23 * questions.
24 */
25
26 package com.sun.prism;
27
28 import com.sun.prism.impl.TextureResourcePool;
29 import com.sun.prism.impl.VertexBuffer;
30 import com.sun.prism.shape.ShapeRep;
31
32 public interface ResourceFactory extends GraphicsResource {
33
34 /**
35 * Returns status of this graphics device.
36 * If the device is not ready the createRTTexture and
37 * present operations will fail.
38 * Creation of shaders and regular textures will succeed and
39 * return valid resources.
40 * All hardware resources (RenderTargets and SwapChains) have to be recreated
41 * after a device-lost event notification.
42 **/
43
44 public boolean isDeviceReady();
45
46 public TextureResourcePool getTextureResourcePool();
47
187 * Note that the following formats are guaranteed to be supported
188 * across all devices:
189 * <pre><code>
190 * BYTE_RGB
191 * BYTE_RGBA_PRE
192 * BYTE_GRAY
193 * BYTE_ALPHA
194 * </code></pre>
195 * <p>
196 * Support for the other formats depends on the capabilities of the
197 * device. Be sure to call this method before attempting to create
198 * a {@code Texture} with a non-standard format and plan to have an
199 * alternate codepath if the given format is not supported.
200 *
201 * @param format the {@code PixelFormat} to test
202 * @return true if the given format is supported; false otherwise
203 */
204 public boolean isFormatSupported(PixelFormat format);
205
206 /**
207 * Returns the maximum supported texture dimension for this device.
208 * For example, if this method returns 2048, it means that textures
209 * larger than 2048x2048 cannot be created.
210 *
211 * @return the maximum supported texture dimension
212 */
213 public int getMaximumTextureSize();
214
215 public int getRTTWidth(int w, Texture.WrapMode wrapMode);
216 public int getRTTHeight(int h, Texture.WrapMode wrapMode);
217
218 public Texture createMaskTexture(int width, int height, Texture.WrapMode wrapMode);
219 public Texture createFloatTexture(int width, int height);
220 public RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode);
221 public RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode, boolean antiAliasing);
222
223 /**
224 * A Texture may have been obtained from a different resource factory.
225 * @param tex the texture to check.
226 * @return whether this texture is compatible.
|
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
23 * questions.
24 */
25
26 package com.sun.prism;
27
28 import com.sun.prism.Texture.WrapMode;
29 import com.sun.prism.impl.TextureResourcePool;
30 import com.sun.prism.impl.VertexBuffer;
31 import com.sun.prism.shape.ShapeRep;
32
33 public interface ResourceFactory extends GraphicsResource {
34
35 /**
36 * Returns status of this graphics device.
37 * If the device is not ready the createRTTexture and
38 * present operations will fail.
39 * Creation of shaders and regular textures will succeed and
40 * return valid resources.
41 * All hardware resources (RenderTargets and SwapChains) have to be recreated
42 * after a device-lost event notification.
43 **/
44
45 public boolean isDeviceReady();
46
47 public TextureResourcePool getTextureResourcePool();
48
188 * Note that the following formats are guaranteed to be supported
189 * across all devices:
190 * <pre><code>
191 * BYTE_RGB
192 * BYTE_RGBA_PRE
193 * BYTE_GRAY
194 * BYTE_ALPHA
195 * </code></pre>
196 * <p>
197 * Support for the other formats depends on the capabilities of the
198 * device. Be sure to call this method before attempting to create
199 * a {@code Texture} with a non-standard format and plan to have an
200 * alternate codepath if the given format is not supported.
201 *
202 * @param format the {@code PixelFormat} to test
203 * @return true if the given format is supported; false otherwise
204 */
205 public boolean isFormatSupported(PixelFormat format);
206
207 /**
208 * Returns true iff the indicated {@link WrapMode wrap mode} is directly
209 * supported (i.e. not simulated) by the underlying pipeline and platform.
210 *
211 * @param mode the desired {@code WrapMode}
212 * @return true iff the wrap mode is supported and not simulated
213 */
214 public boolean isWrapModeSupported(WrapMode mode);
215
216 /**
217 * Returns the maximum supported texture dimension for this device.
218 * For example, if this method returns 2048, it means that textures
219 * larger than 2048x2048 cannot be created.
220 *
221 * @return the maximum supported texture dimension
222 */
223 public int getMaximumTextureSize();
224
225 public int getRTTWidth(int w, Texture.WrapMode wrapMode);
226 public int getRTTHeight(int h, Texture.WrapMode wrapMode);
227
228 public Texture createMaskTexture(int width, int height, Texture.WrapMode wrapMode);
229 public Texture createFloatTexture(int width, int height);
230 public RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode);
231 public RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode, boolean antiAliasing);
232
233 /**
234 * A Texture may have been obtained from a different resource factory.
235 * @param tex the texture to check.
236 * @return whether this texture is compatible.
|