22 #define VTK_JAVA_DEBUG
25 #if defined(__APPLE__)
26 #if defined(__GNUC__) && ((__GNUC__ > 4) || \
27 ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)))
28 #pragma GCC diagnostic push
31 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
35 #if defined(_WIN32) || defined(WIN32)
36 #define WIN32_JAWT_LOCK_HACK
39 #if defined(WIN32_JAWT_LOCK_HACK)
40 #define WJLH_MAX_COUNT (32)
41 #define WJLH_HASH_FUNC(E,C,H) {\
42 jclass cls = E->GetObjectClass(C);\
43 jmethodID mid = E->GetMethodID(cls, "hashCode", "()I");\
44 H = E->CallIntMethod(C, mid); }
45 # include "vtkWindows.h"
46 int WJLH_init_check = 0;
48 std::map<int,int> WJLH_lock_map;
51 extern "C" JNIEXPORT jint JNICALL
54 #if defined(WIN32_JAWT_LOCK_HACK)
56 WJLH_HASH_FUNC(env, canvas, hash);
57 WJLH_lock_map[hash] = 0;
61 JAWT_DrawingSurface* ds;
62 JAWT_DrawingSurfaceInfo* dsi;
70 awt.version = JAWT_VERSION_1_3;
71 if (JAWT_GetAWT(env, &awt) == JNI_FALSE)
73 #ifndef VTK_JAVA_DEBUG
74 printf(
"AWT Not found\n");
80 ds = awt.GetDrawingSurface(env, canvas);
83 #ifndef VTK_JAVA_DEBUG
84 printf(
"NULL drawing surface\n");
91 if((lock & JAWT_LOCK_ERROR) != 0)
93 #ifndef VTK_JAVA_DEBUG
94 printf(
"Error locking surface\n");
96 awt.FreeDrawingSurface(ds);
101 dsi = ds->GetDrawingSurfaceInfo(ds);
104 printf(
"Error getting surface info\n");
106 awt.FreeDrawingSurface(ds);
111 #if defined(_WIN32) || defined(WIN32)
113 JAWT_Win32DrawingSurfaceInfo* dsi_win;
114 dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
120 #elif defined(__APPLE__)
121 JAWT_MacOSXDrawingSurfaceInfo* dsi_mac;
122 dsi_mac = (JAWT_MacOSXDrawingSurfaceInfo*)dsi->platformInfo;
126 JAWT_X11DrawingSurfaceInfo* dsi_x11;
127 dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
134 ds->FreeDrawingSurfaceInfo(dsi);
140 awt.FreeDrawingSurface(ds);
142 #if defined(WIN32_JAWT_LOCK_HACK)
143 if (WJLH_init_check == 0)
147 WJLH_lock_map[hash] = 1;
152 extern "C" JNIEXPORT jint JNICALL
155 #if defined(WIN32_JAWT_LOCK_HACK)
157 WJLH_HASH_FUNC(env, canvas, hash);
158 WJLH_lock_map[hash] = 0;
162 JAWT_DrawingSurface* ds;
163 JAWT_DrawingSurfaceInfo* dsi;
171 awt.version = JAWT_VERSION_1_3;
172 if (JAWT_GetAWT(env, &awt) == JNI_FALSE)
174 #ifndef VTK_JAVA_DEBUG
175 printf(
"AWT Not found\n");
181 ds = awt.GetDrawingSurface(env, canvas);
184 #ifndef VTK_JAVA_DEBUG
185 printf(
"NULL drawing surface\n");
192 if((lock & JAWT_LOCK_ERROR) != 0)
194 #ifndef VTK_JAVA_DEBUG
195 printf(
"Error locking surface\n");
197 awt.FreeDrawingSurface(ds);
202 dsi = ds->GetDrawingSurfaceInfo(ds);
205 printf(
"Error getting surface info\n");
207 awt.FreeDrawingSurface(ds);
212 #if defined(_WIN32) || defined(WIN32)
214 JAWT_Win32DrawingSurfaceInfo* dsi_win;
215 dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
221 #elif defined(__APPLE__)
222 JAWT_MacOSXDrawingSurfaceInfo* dsi_mac;
223 dsi_mac = (JAWT_MacOSXDrawingSurfaceInfo*)dsi->platformInfo;
227 JAWT_X11DrawingSurfaceInfo* dsi_x11;
228 dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
235 ds->FreeDrawingSurfaceInfo(dsi);
241 awt.FreeDrawingSurface(ds);
243 #if defined(WIN32_JAWT_LOCK_HACK)
244 if (WJLH_init_check == 0)
248 WJLH_lock_map[hash] = 1;
260 extern "C" JNIEXPORT jint JNICALL
265 JAWT_DrawingSurface* ds;
269 awt.version = JAWT_VERSION_1_3;
270 if (JAWT_GetAWT(env, &awt) == JNI_FALSE)
272 #ifndef VTK_JAVA_DEBUG
273 printf(
"AWT Not found\n");
279 ds = awt.GetDrawingSurface(env, canvas);
282 #ifndef VTK_JAVA_DEBUG
283 printf(
"NULL drawing surface\n");
288 #if defined(WIN32_JAWT_LOCK_HACK)
290 WJLH_HASH_FUNC(env, canvas, hash);
291 if (WJLH_init_check && WJLH_lock_map[hash] > WJLH_MAX_COUNT)
293 env->MonitorEnter(canvas);
300 if((lock & JAWT_LOCK_ERROR) != 0)
302 #ifndef VTK_JAVA_DEBUG
303 printf(
"Error locking surface\n");
305 awt.FreeDrawingSurface(ds);
308 #if defined(WIN32_JAWT_LOCK_HACK)
318 extern "C" JNIEXPORT jint JNICALL
323 JAWT_DrawingSurface* ds;
326 awt.version = JAWT_VERSION_1_3;
327 if (JAWT_GetAWT(env, &awt) == JNI_FALSE)
329 #ifndef VTK_JAVA_DEBUG
330 printf(
"AWT Not found\n");
336 ds = awt.GetDrawingSurface(env, canvas);
339 #ifndef VTK_JAVA_DEBUG
340 printf(
"NULL drawing surface\n");
345 #if defined(WIN32_JAWT_LOCK_HACK)
347 WJLH_HASH_FUNC(env, canvas, hash);
348 if (WJLH_init_check && WJLH_lock_map[hash] > WJLH_MAX_COUNT)
350 env->MonitorExit(canvas);
354 if (WJLH_init_check) WJLH_lock_map[hash]++;
358 #if defined(WIN32_JAWT_LOCK_HACK)
363 awt.FreeDrawingSurface(ds);
369 #if defined(__APPLE__)
370 #if defined(__GNUC__) && ((__GNUC__ > 4) || \
371 ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)))
372 #pragma GCC diagnostic pop
JNIEXPORT jint JNICALL Java_vtk_vtkPanel_RenderCreate(JNIEnv *env, jobject canvas, jobject id0)
virtual void Finalize()=0
JNIEXPORT jint JNICALL Java_vtk_vtkPanel_Lock(JNIEnv *env, jobject canvas)
virtual void SetWindowId(void *)=0
virtual void SetParentId(void *)=0
virtual void SetDisplayId(void *)=0
JNIEXPORT jint JNICALL Java_vtk_rendering_awt_vtkInternalAwtComponent_RenderCreate(JNIEnv *env, jobject canvas, jobject id0)
create a window for renderers to draw into
VTKWRAPPINGJAVA_EXPORT void * vtkJavaGetPointerFromObject(JNIEnv *env, jobject obj)
JNIEXPORT jint JNICALL Java_vtk_vtkPanel_UnLock(JNIEnv *env, jobject canvas)