author | erikj |
Thu, 07 Jun 2012 18:05:09 -0700 | |
changeset 12813 | c10ab96dcf41 |
parent 5506 | 202f599c92aa |
child 16734 | da1901d79073 |
permissions | -rw-r--r-- |
887 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. |
887 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
887 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
887 | 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 |
* |
|
5506 | 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. |
|
887 | 24 |
*/ |
25 |
||
26 |
package sun.java2d.pipe.hw; |
|
27 |
||
28 |
import java.awt.Rectangle; |
|
29 |
import sun.java2d.Surface; |
|
30 |
||
12813
c10ab96dcf41
7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents:
5506
diff
changeset
|
31 |
import javax.tools.annotation.GenerateNativeHeader; |
c10ab96dcf41
7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents:
5506
diff
changeset
|
32 |
|
887 | 33 |
/** |
34 |
* Abstraction for a hardware accelerated surface. |
|
35 |
*/ |
|
12813
c10ab96dcf41
7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents:
5506
diff
changeset
|
36 |
/* No native methods here, but the constants are needed in the supporting JNI code */ |
c10ab96dcf41
7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents:
5506
diff
changeset
|
37 |
@GenerateNativeHeader |
887 | 38 |
public interface AccelSurface extends BufferedContextProvider, Surface { |
39 |
/** |
|
40 |
* Undefined |
|
41 |
*/ |
|
42 |
public static final int UNDEFINED = 0; |
|
43 |
/** |
|
44 |
* Window (or window substitute) surface |
|
45 |
*/ |
|
46 |
public static final int WINDOW = 1; |
|
47 |
/** |
|
48 |
* Render-To Plain surface (pbuffer for OpenGL, Render Target surface |
|
49 |
* for Direct3D) |
|
50 |
*/ |
|
51 |
public static final int RT_PLAIN = 2; |
|
52 |
/** |
|
53 |
* Texture surface |
|
54 |
*/ |
|
55 |
public static final int TEXTURE = 3; |
|
56 |
/** |
|
57 |
* A back-buffer surface (SwapChain surface for Direct3D, backbuffer for |
|
58 |
* OpenGL) |
|
59 |
*/ |
|
60 |
public static final int FLIP_BACKBUFFER = 4; |
|
61 |
/** |
|
62 |
* Render-To Texture surface (fbobject for OpenGL, texture with render-to |
|
63 |
* attribute for Direct3D) |
|
64 |
*/ |
|
65 |
public static final int RT_TEXTURE = 5; |
|
66 |
||
67 |
/** |
|
68 |
* Returns {@code int} representing surface's type as defined by constants |
|
69 |
* in this interface. |
|
70 |
* |
|
71 |
* @return an integer representing this surface's type |
|
72 |
* @see AccelSurface#UNDEFINED |
|
73 |
* @see AccelSurface#WINDOW |
|
74 |
* @see AccelSurface#RT_PLAIN |
|
75 |
* @see AccelSurface#TEXTURE |
|
76 |
* @see AccelSurface#FLIP_BACKBUFFER |
|
77 |
* @see AccelSurface#RT_TEXTURE |
|
78 |
*/ |
|
79 |
public int getType(); |
|
80 |
||
81 |
/** |
|
82 |
* Returns a pointer to the native surface data associated with this |
|
83 |
* surface. |
|
84 |
* Note: this pointer is only valid on the rendering thread. |
|
85 |
* |
|
86 |
* @return pointer to the native surface's data |
|
87 |
*/ |
|
88 |
public long getNativeOps(); |
|
89 |
||
90 |
/** |
|
91 |
* Returns a pointer to the real native resource |
|
92 |
* of the specified type associated with this AccelSurface. |
|
93 |
* Note: this pointer is only valid on the rendering thread. |
|
94 |
* |
|
95 |
* @param resType the type of the requested resource |
|
96 |
* @return a long containing a pointer to the native resource of the |
|
97 |
* specified type or 0L if such resource doesn't exist for this surface |
|
98 |
*/ |
|
99 |
public long getNativeResource(int resType); |
|
100 |
||
101 |
/** |
|
102 |
* Marks this surface dirty. |
|
103 |
*/ |
|
104 |
public void markDirty(); |
|
105 |
||
106 |
/** |
|
107 |
* Returns whether the pipeline considers this surface valid. A surface |
|
108 |
* may become invalid if it is disposed of, or resized. |
|
109 |
* |
|
110 |
* @return true if valid, false otherwise |
|
111 |
*/ |
|
112 |
public boolean isValid(); |
|
113 |
||
114 |
/** |
|
115 |
* Returns whether this surface is lost. The return value is only valid |
|
116 |
* on the render thread, meaning that even if this method returns |
|
117 |
* {@code true} it could be lost in the next moment unless it is called |
|
118 |
* on the rendering thread. |
|
119 |
* |
|
120 |
* @return true if the surface is known to be lost, false otherwise |
|
121 |
*/ |
|
122 |
public boolean isSurfaceLost(); |
|
123 |
||
124 |
/** |
|
125 |
* Returns the requested bounds of the destination surface. The real bounds |
|
126 |
* of the native accelerated surface may differ. Use |
|
127 |
* {@link #getNativeBounds} to get the bounds of the native surface. |
|
128 |
* |
|
129 |
* @return Rectangle representing java surface's bounds |
|
130 |
*/ |
|
131 |
public Rectangle getBounds(); |
|
132 |
||
133 |
/** |
|
134 |
* Returns real bounds of the native surface, which may differ from those |
|
135 |
* returned by {@link #getBounds}. |
|
136 |
* |
|
137 |
* @return Rectangle representing native surface's bounds |
|
138 |
*/ |
|
139 |
public Rectangle getNativeBounds(); |
|
140 |
} |