|
1 /* |
|
2 * Copyright (c) 2007, 2008, 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 |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 package sun.java2d.pipe.hw; |
|
27 |
|
28 import java.awt.image.VolatileImage; |
|
29 |
|
30 /** |
|
31 * Implementors of this interface provida a way to create a |
|
32 * {@code VolatileImage} whose destination surface is an |
|
33 * {@link AccelSurface} of specified type. |
|
34 * |
|
35 * @see AccelSurface |
|
36 */ |
|
37 public interface AccelGraphicsConfig extends BufferedContextProvider { |
|
38 /** |
|
39 * Returns a VolatileImage with specified width, height, transparency |
|
40 * and guaranteed accelerated surface type. If such image can not be created |
|
41 * (out of vram error, specific surface type is not supported) null |
|
42 * is returned. |
|
43 * |
|
44 * Note: if {@link AccelSurface#TEXTURE} type is requested, rendering |
|
45 * to the image will be denied by throwing |
|
46 * {@code UnsupportedOperationException } |
|
47 * from {@link java.awt.image.VolatileImage#getGraphics} and |
|
48 * {@link java.awt.image.VolatileImage#createGraphics} |
|
49 * |
|
50 * @param width the width of the returned {@code VolatileImage} |
|
51 * @param height the height of the returned {@code VolatileImage} |
|
52 * @param transparency the specified transparency mode |
|
53 * @param type requested accelerated surface type as specified by constants |
|
54 * in AccelSurface interface |
|
55 * @return a {@code VolatileImage} backed up by requested accelerated |
|
56 * surface type or null |
|
57 * @throws IllegalArgumentException if the transparency is not a valid value |
|
58 * @see AccelSurface#TEXTURE |
|
59 * @see AccelSurface#RT_PLAIN |
|
60 * @see AccelSurface#RT_TEXTURE |
|
61 */ |
|
62 public VolatileImage createCompatibleVolatileImage(int width, int height, |
|
63 int transparency, |
|
64 int type); |
|
65 /** |
|
66 * Returns object representing capabilities of the context associated |
|
67 * with this {@code AccelGraphicsConfig}. |
|
68 * |
|
69 * @return ContextCapabilities object representing caps |
|
70 * @see ContextCapabilities |
|
71 */ |
|
72 public ContextCapabilities getContextCapabilities(); |
|
73 |
|
74 /** |
|
75 * Adds an {@code AccelDeviceEventListener} to listen to accelerated |
|
76 * device's (which is associated with this {@code AccelGraphicsConfig}) |
|
77 * events. |
|
78 * |
|
79 * Note: a hard link to the listener may be kept so it must be explicitly |
|
80 * removed via {@link #removeDeviceEventListener()}. |
|
81 * |
|
82 * @param l the listener |
|
83 * @see AccelDeviceEventListener |
|
84 */ |
|
85 public void addDeviceEventListener(AccelDeviceEventListener l); |
|
86 |
|
87 /** |
|
88 * Removes an {@code AccelDeviceEventListener} from the list of listeners |
|
89 * for this device's events. |
|
90 * |
|
91 * @param l the listener |
|
92 * @see AccelDeviceEventListener |
|
93 */ |
|
94 public void removeDeviceEventListener(AccelDeviceEventListener l); |
|
95 } |